Conversation
The endpoint canonicalisation in 2709681 fixed the hash-seed drift reported in Graphify-Labs#2817, but only _partition orientation invariance is tested. Add a cross-process test that runs the full cluster() - oversize and cohesion split passes included - under PYTHONHASHSEED 0-3 and asserts identical output. Fails on 2709681^ with both Leiden and the Louvain fallback.
There was a problem hiding this comment.
Graphify reviewed this change.
Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).
Graphify review — findings
Adds a subprocess-based regression test that runs cluster() on a fixed 10-block graph with a bridging doc hub under four different PYTHONHASHSEED values and asserts all four SHA-256 digests of the sorted result are identical. This pins down determinism through the oversize and cohesion re-split passes, which previously drifted with hash seed even though _partition alone was stable.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 31 functions depend on the 31 functions this change touches.
Health — grade A; no new coupling hotspots.
Verification — 31 functions in the blast radius were not formally verified this run (proofs are advisory here).
Gate & verification
graphify gate
PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 31 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
1 of 290 test file(s) selected (0%) via static blast radius.
tests/test_cluster.py— impact, changed-test
Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.
#2817 reported that
cluster()output changed withPYTHONHASHSEEDeven though_partitionon the full graph did not. On one corpus the same input gave anywhere from 273 to 508 communities.2709681 (v0.9.51, "canonicalise edge endpoints before sorting in _partition") fixed the underlying cause. The only test added with it checks
_partitionorientation invariance directly. Nothing checks the symptom the issue actually describes: the wholecluster()result, including the oversize and cohesion split passes, running in separate processes with different hash seeds.This PR adds that test.
What the test does
set, so insertion order and endpoint orientation follow each process's string-hash order, the same way real extraction builds the graph.cluster()in subprocesses withPYTHONHASHSEED0–3 and asserts that all four SHA-256 digests match.Checking that the test catches the regression
cluster.py2709681^(pre-fix)2709681^(pre-fix)End-to-end check on HEAD (v0.9.65, macOS, Python 3.14)
graphify update .withPYTHONHASHSEED0–3. Node, edge and community hashes were identical on every seed:packages/(TypeScript, the language of the 0.9.56 report): 6408 nodes, 10073 edges, 388 communities.Closes #2817