Addresses remaining findings on PR #1479 from Claude's re-review of
commit ad7bd31 + verifies the outstanding Bugbot HIGH severity.
1. F1 — Transitive importer expansion (Claude, was Medium-but-noted).
Previous 1-hop importer expansion missed barrel re-export chains
(A imports C, C re-exports B; when B changes, only C was pulled in
— A was left with potentially-stale CALLS edges to refined targets).
Replaced the single pass with a bounded BFS over the IMPORTS graph
(depth ≤ 4). Catches nested barrel pyramids without ballooning into
a near-full rebuild on monorepos with deep re-export trees. `--force`
remains the escape hatch documented in GUARDRAILS.md for cases that
exceed the bound.
2. F2 — Integration test for incremental orchestration (Claude, BLOCKER,
DoD §2.7). The unit tests added in ad7bd31 covered `diffFileHashes`,
`extractChangedSubgraph`, `computeChunkHash`, `pruneCache`, and the
Map/Set JSON round-trip — but none of them exercised the real
`runFullAnalysis` orchestration. Added gitnexus/test/unit/
incremental-orchestration.test.ts with four end-to-end tests against
a real git-initialized fixture repo + real LadybugDB:
a. First run populates fileHashes + schemaVersion and clears
incrementalInProgress on success.
b. Second run on unchanged state takes the alreadyUpToDate fast
path (early-return).
c. Second run after a source edit takes the incremental path
(not full rebuild) and rotates fileHashes for the touched file
while keeping the dirty flag cleared.
d. A pre-set incrementalInProgress flag forces a full rebuild
that clears it (crash-recovery wire).
These would catch any regression that wires `isIncremental` from a
pre-pipeline prediction (the Bugbot finding from commit 5eb0597) or
accidentally re-gates the embedding re-insert on `!isIncremental`
(the Bugbot finding from commit 60c10f1).
3. F3 — GUARDRAILS.md docs accuracy (Claude, Low). Line 33 still said
"only changed files are re-parsed" — AGENTS.md was already corrected
in ad7bd31 but GUARDRAILS.md was missed. Reworded to match.
4. F5 — Atomic saveMeta (Claude, Medium; vvladescu-tb fork). The dirty
flag (`incrementalInProgress`) travels through meta.json. A crash
mid-write would leave a corrupt meta.json that `loadMeta` would
silently treat as "no prior index", losing the flag and skipping
recovery. Switched to tmp-file + rename matching saveParseCache.
5. Bugbot's "Subgraph edges reference nodes absent from subgraph"
(HIGH severity). Verified as FALSE POSITIVE: `getNodeLabel` in
lbug-adapter.ts derives labels from the node-ID string (parses
the table prefix), not from the in-memory graph. The CSV
generator writes (src_id, dst_id, type) rows without consulting
node objects; `splitRelCsvByLabelPair` routes by ID-derived label;
`COPY ... (from=X, to=Y)` resolves both endpoints against the live
LadybugDB where unchanged-file nodes still exist. No fix needed.
All 213 tests pass locally (including the 4 new integration tests
and the previously-failing CI tests).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>