Skip to content

fix: stabilize update determinism - #824

Merged
safishamsi merged 3 commits into
Graphify-Labs:v7from
FatahChan:fix/update-idempotency-churn-v2
May 13, 2026
Merged

safishamsi merged 3 commits into
Graphify-Labs:v7from
FatahChan:fix/update-idempotency-churn-v2

Conversation

@FatahChan

Copy link
Copy Markdown
Contributor

Summary

  • add a pre-cluster topology comparison fast path in watch._rebuild_code
  • short-circuit unchanged updates before cluster()/report/json/html regeneration
  • keep outputs untouched when topology is unchanged and still refresh manifest/flags
  • add regression coverage to ensure clustering is skipped on unchanged topology

Closes #741

Test plan

  • uv run --with pytest pytest tests/test_watch.py tests/test_cluster.py tests/test_cli_export.py
  • uv run python -m graphify update \"/Users/ahmadfathallah/dev/raven-monorepo-copy\" (run twice)
  • confirm identical hashes across repeated unchanged updates for graph.json and GRAPH_REPORT.md

Made with Cursor

Ahmad Fathallah and others added 2 commits May 12, 2026 02:23
Make `graphify update` idempotent by skipping output rewrites when graph/report content is unchanged, add `update --no-cluster`, and preserve community IDs across runs via overlap-based remapping with deterministic partition inputs.

Co-authored-by: Cursor <[email protected]>
Use safe JSON serialization fallbacks for deterministic sort keys in clustering and graph canonicalization, and skip invalid community IDs with a stderr warning instead of raising during update rebuilds.

Co-authored-by: Cursor <[email protected]>
@FatahChan
FatahChan force-pushed the fix/update-idempotency-churn-v2 branch from 937e817 to c9f201d Compare May 12, 2026 00:26
Add a pre-cluster topology comparison fast path in update rebuilds so unchanged graphs short-circuit before clustering and report generation, preventing residual run-to-run community-count drift.

Co-authored-by: Cursor <[email protected]>
@FatahChan
FatahChan force-pushed the fix/update-idempotency-churn-v2 branch from c9f201d to 28fc71e Compare May 12, 2026 00:36
@FatahChan FatahChan changed the title Stabilize update determinism with topology fast-path fix: stabilize update determinism May 12, 2026
@safishamsi

Copy link
Copy Markdown
Member

Thanks for the topology short-circuit approach! The non-determinism in --update (issue #741) is on our radar. This PR is a solid start but the watch-layer short-circuit doesn't cover the full surface (headless graphify update has the same issue). We want to fix it at the manifest/hash layer so both paths benefit. Closing this PR — will credit the approach when we land the broader fix.

@safishamsi safishamsi closed this May 13, 2026
@safishamsi safishamsi reopened this May 13, 2026
@safishamsi
safishamsi merged commit 1b8b768 into Graphify-Labs:v7 May 13, 2026
2 checks passed
PerryLin-0420 pushed a commit to PerryLin-0420/graphify-decouple that referenced this pull request Aug 13, 2026
…aph, --no-cluster for update (PR Graphify-Labs#824, FatahChan)

Co-Authored-By: FatahChan <[email protected]>
zeekay pushed a commit to Dream-AI-4444/graphify that referenced this pull request Sep 10, 2026
…aph, --no-cluster for update (PR Graphify-Labs#824, FatahChan)

Co-Authored-By: FatahChan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question — graphify update non-determinism produces ~11k-line diff per run on unchanged source: intended or addressable?

2 participants