fix(#5915 P2): cross-repo link passes handle segment-set repos end-to-end#5919
Merged
Conversation
…ented repos (#5904(e) PR-c) stageGraphsDir and the phantom-edge existence gate both resolved a repo's graph via the flat-file-only graph.CurrentGraphPath, so a SEGMENTED repo (graph.<gen>/ dir + manifest.json, no flat .fb) was silently dropped from cross-repo link staging and skipped before its (already segment-aware) load (#5915 P2 gap). Both now resolve via graph.CurrentGraphDescriptor: - stageGraphsDir stages a GraphSegmentSet repo by symlinking the whole generation (every seg-*.fb + manifest.json) into dstDir/graph.<gen>/ and writing a `current` pointer in dstDir naming that gen dir, so LoadGraphFromDir(dstDir) resolves it identically to the real state dir. GraphSingleFile staging is unchanged (still symlinked as graph.fb). - runPhantomEdgePass's existence gate now checks CurrentGraphDescriptor(...).Kind != GraphAbsent instead of stat'ing the flat graph.fb path, so a segment-set repo reaches loadGraphDocument (LoadGraphFromDir is already segment-aware). Scope: internal/cli/links.go only (staging + phantom-edge load gate). Does not touch phantom-edge writeback (PR-b), description overlay (PR-a), or the broad P2 sweep (J2).
…or segmented repos (#5904(e) PR-c) Adds three tests exercising the #5915 P2 fix: - TestStageGraphsDir_SegmentSetAndSingleFile: a fleet with a single-file repo AND a SEGMENTED repo (graph.<gen>/ dir + manifest.json, no flat .fb) — both are staged, and graph.LoadGraphFromDir resolves the staged segment-set repo with its entities intact. - TestStageGraphsDir_SingleFileParity: single-file staging remains byte-for-byte identical to the pre-fix behavior (symlink target / bytes). - TestRunPhantomEdgePass_SegmentSetNotSkipped: a CALLS/http link sourced from a segment-set repo actually promotes a phantom edge, proving the existence gate no longer skips it before loadGraphDocument. writeSingleFileRepo/writeSegmentSetRepo hand-build fixtures directly (the graph package's writeSegmentSet test helper lives in an external _test.go file and isn't exported). All tests use t.TempDir() + the stageGraphsDir cleanup closure, no long-lived handles, so teardown is Windows-safe.
…pos (#5904(e) PR-c) loadAllGraphs' WalkDir added a repo dir to the discovery set only on graph.json or graph.IsGraphFileName (graph.fb / graph.<gen>.fb). A SEGMENTED repo's active generation is a graph.<gen>/ dir (seg-NNNN.fb + manifest.json) named by a `current` pointer with NO flat graph.fb — none of those filenames matched, so the repo was silently dropped from every cross-repo pass even after PR-c's staging fix. This completes the P2 fix end-to-end: staging a segment-set repo was useless while the real consumer (RunAllPasses -> loadAllGraphs) still couldn't discover it. Discovery now also recognizes the `current` pointer file (graph.CurrentPointerName, newly exported) as a state-dir marker and confirms it via graph.CurrentGraphDescriptor, registering the dir only when Kind == GraphSegmentSet. Guards: - Single-file parity: a single-file repo is still discovered by its graph.fb / graph.<gen>.fb match (unchanged branch, early return); the new branch never fires for it (its descriptor is GraphSingleFile, and its graph.<gen>.fb already registered the dir). - Stray/legacy `current` with no valid gen dir resolves to GraphAbsent and is ignored (no false-positive repo). - Dedupe: only the pointer's dir (the state dir) is added, never the graph.<gen>/ gen dir — its seg-NNNN.fb / manifest.json never match the graph-file check, so the gen dir cannot register a phantom repo entry.
#5904(e) PR-c) Two tests through the REAL consumer: - TestLoadAllGraphs_DiscoversSegmentSet: a graphs dir with a single-file repo AND a segment-set repo yields BOTH repoGraphs; the graph.<gen>/ gen dir does NOT register a phantom repo entry (dedupe guard), and exactly 2 repos are discovered (single-file parity). - TestRunAllPasses_SegmentSetContributesCrossRepoLink: the end-to-end P2 assertion — a segment-set repo owning an entity with an IMPORTS edge into a single-file repo yields a cross-repo import link SOURCED FROM the segment-set repo in RunAllPasses output, proving it is no longer dropped at discovery. writeSingleFileFBRepo/writeSegmentSetFBRepo build the staged-equivalent layout directly (the graph package's segment fixture helper lives in an external _test.go and isn't importable from package links).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Cross-repo link passes silently dropped segmented repos (a
currentpointer +graph.<gen>/dir ofseg-NNNN.fb+manifest.json, no flatgraph.fb). A #5915 P2 gap. This closes it end-to-end: discovery → staging → load → pass contribution.Changes (all in the cross-repo link path)
internal/links/links.goloadAllGraphsdiscovery — added a branch keyed onbase == graph.CurrentPointerNamethat registers the dir only whengraph.CurrentGraphDescriptor(dir).Kind == GraphSegmentSet(not!= GraphAbsent— scoped to exactly the missing case, single-file discovery untouched). The gen dir'sseg-*.fb/manifest.jsonmatch neitherIsGraphFileNamenorgraph.json, so it can't self-register as a phantom repo;dirSetdedupes.internal/cli/links.gostageGraphsDir— descriptor-branch:GraphSingleFilesymlinks asgraph.fb(byte-parity);GraphSegmentSetstages the gen dir (symlink segments+manifest) +WriteCurrentPointerRaw;GraphAbsentskipped.internal/cli/links.gophantom-edge gate —os.Statpair →CurrentGraphDescriptor(...).Kind != GraphAbsent.internal/graph/genpath.go— exportedCurrentPointerName.Verification (independent adversarial review — APPROVE)
current-pointer NOT misclassified: classifiesGraphSingleFile, guard excludes it → discovery count 1 (the load-bearing safety for existing users).current→GraphAbsent; loud-fail on broken segment/manifest; copy-fallback resolves.RunAllPassese2e: a segment-set repo now contributes a cross-repo import link (wasgot []).Follow-up (noted by review, out of scope → J2 sweep)
~13 more
os.Stat(CurrentGraphPath)existence gates (audit, groupalgo, dashboard store/refs, daemon state_path, doctor, status_stats) still assume flatgraph.fb. Latent (no production writer emits segment-sets yet), swept before the flip.Refs #5915
🤖 Generated with Claude Code