No 🔴 critical correctness bugs. cargo clippy --all-targets is clean
(pedantic-only), so existence/type/signature errors are ruled out by the
compiler. The hard algorithms — forward-push PPR, CELF lazy-greedy
selection, unified=0 hunk parsing — were read line by line and verified
correct. Real defects are three 🟡 edge/efficiency issues and a handful of
🔵 notes.
- ✅ 🟡
postpass.rs:210,248—_batch_reader: Option<&mut CatFileBatch>is unused; the missing-changed-file fallback callscreate_whole_file_fragment(path, root_dir, preferred_revs, None)— alwaysNone. Caller (pipeline.rs:164) builds aCatFileBatchand passesbatch_reader.as_mut(), but it is never used: every rescued changed file spawns a freshgit showsubprocess instead of reusing the batch. Correct output, wasted process spawns, and a parameter name that lies about plumbing that doesn't happen. - ✅ 🟡
git.rs:379vsgit.rs:396/candidate_files.rs:79-84— path normalization is inconsistent.get_changed_filesreturnsrepo_root.join(p)uncanonicalized, whileget_deleted_files(:396) and discovered files (normalize_path) DO canonicalize. When a tracked path traverses a symlinked directory component, the same physical file gets two distinctPathBuf→FragmentIdkeys, soseen_frag_ids(pipeline.rs:163) fails to dedup → duplicate fragments for one file. Edge case (symlinked tracked dir), but a genuine normalization mismatch. - ✅ 🟡
signatures.rs:75—find_signature_endreturns at the first line whereob - cb > 0(any unmatched{).count_brackets_outside_stringsstrips string literals but not braces inside parameter defaults or annotations, so a Pythondef f(x={}):(or a multi-line header with a dict/type-brace default) terminates the signature mid-parameter-list, emitting a wrongsig_end_line. Supplementary signature variant only.
interval.rs:52—overlapsuses strictend > start; with inclusive[start,end]ranges (types.rs:230end-start+1) two fragments sharing a boundary line both pass and that shared line can render twice. The comment frames it as "adjacent, not overlapping" — a deliberate, documented tradeoff (strict>avoids dropping the next fragment in compact languages). Terminologically loose, but intentional; not a bug.tokenizer.rs:43— degraded fallback((text.len() as u32)/4).max(1)returns 1 for the empty string (vs 0 on the normal path) and over-counts multibyte (Cyrillic/emoji) text ~2-4×. Only on encoder-init failure.filtering.rs:147—*count >= 1is always true (counts start at 1); dead predicate, the real gate isdeps.len() >= hub_reverse_threshold. Misleading, harmless.ppr.rstruncated runs are silently sum-renormalized; documented in the comment + atracing::warn!, but downstream selection consumes the biased scores with no programmatic guard. Reachable only on graphs hittingmax_pushes_cap(~>20k fragments). Documented.
- CELF lazy-greedy stale-gain commit (
select.rs:285-315): correct — pops top, ifversion < cvrecomputes against live state and re-pushes, commits only when versions match. Textbook CELF. - Render escaping:
render.rsdelegates toserde_yaml/serde_json— no hand-rolled YAML literal-block/quoting bugs. - Hunk parsing
@@ -a,b +c,d @@with omitted count: defaults to 1 per git spec (git.rs:302,307); deletions (new_len==0) handled (types.rs:246). fragmentation.rs:147lines.len() - max_linesunderflow: unreachable (create_snippetjoins exactlyline_countlines; early-return guaranteeslen > max_lines).- "Changed-file fragments render with absolute paths": refuted — both
changed and discovered paths retain the
repo_rootprefix, sostrip_prefixsucceeds.
- 🟡 #1
postpass.rs—_batch_readerwired through viabatch_reader.as_deref_mut(); rescued files now reuse theCatFileBatchinstead of spawning agit showeach. - 🟡 #2
git.rs—get_changed_filesandget_untracked_filesnow canonicalize (repo_root.join(p).canonicalize()), matchingget_deleted_files/normalize_path. - 🟡 #3
signatures.rs— body-brace detection gated onparen_depth <= 0, so braces in parameter defaults/annotations no longer truncate the signature. - 🔵
tokenizer.rs— degraded fallback returns 0 for the empty string (matches normal path). - 🔵
filtering.rs— dead*count >= 1predicate removed. - 🔵
interval.rs— comment corrected to state the deliberate one-line-overlap tradeoff (behavior unchanged — strict>is intentional). - 🔵
ppr.rstruncation renormalization — left as-is (by design, already documented + warns).
cargo build+cargo clippy --libclean;pytest409 passed / 1 skipped.cargo test --test yaml_casesis a quality-benchmark eval, not a pass/fail gate: ~2258/2725 pass on clean HEAD and on the pre-dependency-bump commit98438386alike, so the ~465 "failures" are the corpus's standing baseline (hard cases below the per-case 10% score threshold), NOT a regression. The suite is mildly flaky (~5 threshold-boundary cases flip per run). My changes hold the aggregate within that noise band — no real regression.
4/0 (module-scale, folded into verdict per pyramid).
Root-caused and FIXED the "mild flakiness" the previous entry accepted as
noise: the diff-context pipeline was genuinely nondeterministic across
processes (same input → different selection), violating the advertised
"Deterministic, side-effect-free" guarantee. Also fixed a real
cross-language inconsistency in Python import edges. After fixes,
cargo test --test yaml_cases is bit-for-bit deterministic across runs
(two full runs → identical failure sets); aggregate unchanged
(2258/2725), so determinism gained with zero ranking regression.
- 🔴
graph.rs:233(ego_graph) —*scores.entry(idx).or_insert(0.0) += contributionaccumulated in seed-iteration order, where seeds is anFxHashSet<FragmentId>keyed by absolute paths containing the per-run random temp dir. Non-associative float+=in a per-process-varying order → scores differing by ULPs → near-tie fragments flip in selection → the same test case passes or fails at random across runs (persisted even single-threaded). FIX:valid_seed_idxs.sort_unstable()before the accumulation (seed indices are run-stable values viafreeze()'snodes.sort()). - 🔴
filtering.rs:289(cap_context_fragments) — within-file cap used an unstable sort (partial_cmp, no tie-break) beforetake(N), and the candidate vector was emitted inFxHashMap(path)-iteration order. With tied rel-scores,take(N)dropped different fragments per run. FIX:total_cmp().then_with(|| a.id.cmp(&b.id))+ finalresult.sort_by(id)to canonicalize candidate order. - 🟡
select.rs:73(HeapEntry::cmp) — greedy selection heap tie-broke on density only; equal-density entries popped in insertion order. Added a stablefrag_idsecondary key (defense-in-depth; the two leaks above were the dominant cause). - 🟡
edges/semantic/python.rs:253— Python module-import edges were inserted forward-only (importer→module), bypassingbase::add_edge, while Python's own symbol-ref edges (same file, ~237) and every other language's import edges (go/js/rust) are bidirectional viaadd_edge(forward +reverse_factorreverse). The graph is built directed with no symmetrization (graph.rs:383), so a changed imported module never propagated relevance back to its importers. FIX: route throughbase::add_edge(..., import_weight, reverse_factor).
Per-process nondeterminism from iterating FxHashMap/FxHashSet keyed by
fragment paths/ids (which embed the random temp dir in tests, and absolute
paths in prod) and letting that order drive (a) non-associative float
accumulation and (b) tie-affected truncation/selection. FxHashMap is only
deterministic for identical key sets in identical processes; any output
ordering derived from it must be re-sorted by a stable key. Root cause is
not parallelism (reproduced with RAYON_NUM_THREADS=1).
- 🔵
scoring.rs:215/discovery.rs:240BM25 IDF uses.ln_1p()(=log(1 + (N−df+0.5)/(df+0.5))). NOT a bug — this is the Lucene/Elasticsearch default BM25 IDF, deliberately chosen for non-negativity; downstream code gates onscore > 0.0and feeds PPR seed weights, so plain.ln()(which can go negative when df > N/2) would introduce a bug. Confirmed correct. - 🔵 Path-canonicalization "mismatch" in
git.rs/core.rs— false alarm. Both the diff-hunk key and the fragment key use the same non-canonicalrepo_root.join(rel)form;parse_path_linecanonicalizes only for the containment guard. No lookup mismatch. - 🔵 PPR (
ppr.rs) — verified correct: teleport1−alpha, sum-to-1 personalization, dangling handling, and a closed-form star-graph test to <1e-3. Internally deterministic (freeze()sorts nodes).
cargo build,cargo clippy --libclean (only a pre-existing float-!=warning inedges/mod.rs);cargo test --lib57/57.- Determinism proof: two consecutive
cargo test --test yaml_casesruns → identical failure sets (was ~463–466 fluctuating; now stable at 467). gap_008 (the Python-import eval case) went from ~50/50 flaky to 10/10 stable. Aggregate pass count within prior noise band → no regression. - The 467 standing eval-threshold failures are a ranking-quality tuning matter (out of scope here) — but now reproducible, so they can be worked on reliably.
- Cross-process CLI determinism confirmed for BOTH modes (real
python -m diffctxruns, byte-identical output): tree-mapping (diffctx <dir>, structure-only and full-content) over 8 runs, and diff-context (diffctx . --diff HEAD~1) over 5 runs.
5 scouts / 3 synthesis-verifiers (1 dedicated determinism root-cause hunt).
Deterministic layer already green (pytest 413, cargo test --lib 57, clippy,
mypy, full yaml_cases). 8 scouts → 4 adversarial verifiers → 2 final
verifiers → orchestrator. Most scout "criticals" were REFUTED on verification;
the pyramid's value showed twice (the Haskell "typo" and the role-stripping
claim both flipped to refuted only at R2/R3).
- 🟡 Citation builder could emit self-edges.
edges/document/mod.rsCitationEdgeBuilder pushes a fragment id once per regex match, so a fragment citing the same key twice could become a(hub, hub)edge;graph.rs add_edgehad nosrc == dstguard (other builders like AnchorLink/ Containment guard locally). Fix: central guardif src == dst { return; }inadd_edge(graph.rs:116). Verified no algorithm relies on self-edges. - 🟡 Test→source import edges matched imports in comments/strings.
edges/structural/testing.rs:14IMPORT_RElacked a line anchor, unlike the Python semantic builder. Fix:(?m)^\s*prefix — still matches indented imports, drops false matches inside comments/strings/docstrings. - 🟡 MCP
get_file_contextover-reported copied file count.mcp/server.py_build_file_content_reportreturnedlen(matched)while skipping size-exceeding files, so "Copied N files" overstated. Fix: returnincluded_count(only files whose content was actually emitted). - 🟡 Stale normative parameter doc.
docs/parameter-strategy.mddocumentedEGO.per_hop_decay (γ) = 1.0, but the code default has been0.5since commit 6c28522b ("paper-aligned EGO scoring"); ego is the default scoring mode, and the env clamp(EPS, 1-EPS)makes 1.0 unreachable anyway. Doc is the wrong side — updated to 0.5 (code is correct). - 🔵
--tauhad no upper bound and misleading help.cli.py _validate_tauallows tau>1, which silently keeps only changed code (select.rs:best_density < tau * peak_densitytrips immediately). Clarified help text ("typical 0-1; >1 keeps only changed code"); no behavior change.
- NOT a bug:
node_end_line+1(tree_sitter_strategy.rs). tree-sitterend_position().rowis 0-indexed inclusive of the last content line;+1yields the correct 1-indexed inclusive display end AND the correct exclusive slice bound (mod.rs create_snippetuseslines[start-1..end]). Tests agree. - NOT a bug:
rolestripped for consumers.pybridge.rs to_serializable/PyFragmentdo droprole, but the real path (#[pyfunction] build_diff_context→ dict) setsroledirectly fromDiffContextOutput; MCP/CLI use that path; the role invariant test passes.DiffContextResult.to_yaml/to_jsonis a secondary path with no consumer (🔵 latent only — left as-is). - NOT a typo: Haskell
type_synomym(tree_sitter_strategy.rs). Matches the actual tree-sitter-haskell 0.23.1 grammar node name (misspelled upstream). "Fixing" totype_synonymwould BREAK Haskell extraction. Verified against the crate'snode-types.json. All other definition_types from commit 4d39f58b also match their grammars. - NOT a bug: lexical clamp
.max()of per-language minimums (intentional "stricter language wins"); sibling 20-file cap (configured perf cap); hub-suppression>vs>=(>correct);extract_identifiersincludes keywords (two-phase design, filtered downstream); deletionnew_start.max(1)normalization (harmless); MCP double-resolve()(redundant but secure — no traversal hole found).
cargo test --lib57/57; fullyaml_cases2260 passed / 465 failed — identical to pre-fix baseline (self-edge guard + import anchor fix edge cases the synthetic suite doesn't exercise; no regression). pytest 413 passed, 1 skipped; test_mcp + test_cli 27 passed.
8 scouts / 4 adversarial verifiers / 2 final verifiers / 1 orchestrator.