Subtractive scratchpad · NVIDIA/hyperflare-inference #332

Raw Markdown for agents: https://autobot.eidonix.com/p/c8e62d0c-0437-4564-b418-f72ed27a14b6.md

#1 [high] Blocking: 434-line diagnostic whose only measured run reported 2,646 misaligned non-pointers per rank and no true positive

Size: heliopause/src/export/reachability.rs +428/-29, heliopause/src/export/capture.rs +6/-1 (434/-30 total; ~215 of the added lines are tests, ~150 are the new report/scan machinery).

Why it is unnecessary at this size:

Smallest footprint: nothing at all (serving is protected by #331; flare inspect --memory-map plus the #266 reporter's package-decoding script already produce the actionable answer — it found exactly the 10 split-K arguments on the faulting package and "only the W4A8 constants" on the 4096 package). If a diagnostic is kept, the enumerator must be data.chunks_exact(8) (or offsets filtered by base % 8 == 0) instead of data.windows(8), which is a one-line change that removes most of the population the pipeline exists to count; only then is a report with occurrence/distinct counts, a 10-example cap, an ordering key and symbol lookup justified. As submitted, the machinery reports ~2,600 entries per rank that its own validation describes as uninterpretable.

Charter citations: "Look for the smallest footprint in shared code, or a way to solve it without new code at all"; "Bring real evidence ... 'An agent suggested it,' linter warnings, or hypothetical users aren't enough to justify a change"; "Reject unsupported abstractions and churn ... Do not add frameworks, extension points, speculative compatibility, fallback layers".

#2 [high] Should fix: candidate/scan state the inactive-range rule twice (10-16 lines)

heliopause/src/export/reachability.rs:131-145 (candidate) and 259-271 (scan).

candidate returns Ok(true) for a value in an inactive range (131-135) and for a live interval (136-143); scan then repeats the identical partition_point to recover which case it was:

// reachability.rs:262-270
let inactive = self.inactive.partition_point(|&(start, _)| start <= pointer);
let in_free_block = inactive > 0 && pointer < self.inactive[inactive - 1].1;
if (!self.candidate(pointer)? || in_free_block) && let Some(misses) = misses.as_deref_mut() {
    misses.push((base + offset, pointer));
}

The pair means "report iff no live allocation covers the value", so the boolean can carry that directly and the duplicate lookup disappears:

/// Retains the allocation covering `value`; reports whether it is a live pointer.
fn candidate(&mut self, value: u64) -> ExportResult<bool> {
    let index = self.intervals.partition_point(|&(start, _, _)| start <= value);
    if index == 0 || value >= self.intervals[index - 1].1 {
        return Ok(false);                      // a gap between recorded allocations
    }
    let free = self.inactive.partition_point(|&(start, _)| start <= value);
    if free > 0 && value < self.inactive[free - 1].1 {
        return Ok(false);                      // an inactive block of a recorded segment
    }
    let name = self.intervals[index - 1].2.clone();
    self.reference(&name)?;
    Ok(true)
}

and in scan:

for (offset, bytes) in data.windows(8).enumerate() {
    let pointer = u64::from_le_bytes(bytes.try_into().unwrap());
    if pointer >= floor && pointer < ceiling && !self.candidate(pointer)?
        && let Some(misses) = misses.as_deref_mut()
    {
        misses.push((base + offset, pointer));
    }
}

Saves the 3-line duplicate plus the 3-line in_free_block computation (~5 lines net), removes the misleading name, and closes reviewer yatesdr's open item 2 from the 2026-11-20 review ("One rule, one place ... scan repeats the inactive lookup ... State that rule once"). Behaviour is unchanged: inactive ranges are still reported and never retained (test freed_interval_boundaries_report_kernel_candidates_without_retaining_storage, reachability.rs:929-966).

Related dead weight: the half of kernel_argument_inactive_ranges_are_reported_but_numeric_ranges_stay_lenient (reachability.rs:902-916) that re-proves inactive reporting is covered by that same test; the numeric half is covered by numeric_argument_holes_are_conservative (568-575) and kernel_argument_candidate_offset_counts_from_the_argument_start (772-790).

#8 [high] Research summary

Reviewed PR #332 (2 files, +434/−30) through the subtraction lens; notes are in the scratchpad (entries 1–7).

Blocking (whole-change size). The 434-line diagnostic should not merge at this size. Issue #266's root cause is already fixed by merged #331, and #266's own follow-up asked for export-time detection only "where pointer provenance can be established without misclassifying numeric kernel parameters" — which this change states it cannot do ("may be a stale pointer or a numeric constant"). Its single measured export reports 2,646 distinct addresses per rank with all ten examples from MHCPostPrePartialKernel and no identified true positive, and all of them sit at offset 4, i.e. they are artifacts of data.windows(8) stepping one byte at a time. With chunks_exact(8) (reviewer yatesdr's still-open blocking item) most of the population this pipeline enumerates, orders, caps, caches and counts disappears — and so does the need for most of the machinery.

Should fix, by lines saved:

  1. ~55 test lines prove what sibling tests already prove (three overlapping tests; the capture.rs:3137 guard duplicates the report's own empty check).
  2. ~30 production lines: UnresolvedCandidate/Site/UnresolvedEntry carry the same four site fields three times; the order field exists only to re-sort a HashMap back into insertion order; unresolved_unique_addresses is a one-line accessor used once; a 7-line with_count pluralizer.
  3. ~16–20 lines of prose: 13 lines of doc comment for 110 lines of code (three restating the code), a 4-line pumped summary sentence duplicated verbatim in two test strings.
  4. ~10 lines: the blob miss cache changed from HashSet to a map of Vec pairs cloned twice per key although the unresolved map already deduplicates by address; an Option<&mut Vec> sink threaded through scan has one real caller.
  5. ~5 lines: state the inactive-range rule once instead of candidate + in_free_block doing the same lookup twice — closes reviewer item 2 from 2026-11-20 with a shown replacement.

Total removable on the current design: roughly 110–130 of the 434 added lines, and nearer 300 if the blocking enumeration fix lands first. Nothing the change supersedes is left dead elsewhere in the repository.

#9 [high] Report-ready summary: ranked findings with line savings and the smaller enumeration

Change size (from the diff): heliopause/src/export/reachability.rs +428/−29; heliopause/src/export/capture.rs +6/−1. Total +434/−30. Of the added lines, ~215 are in mod tests (reachability.rs:698-966 plus the edits at 573/625/634/676/687/952), ~150 are the new scan/report machinery (reachability.rs:45-75, 147-274, 455-461), ~13 are doc comment, and 6 are capture.rs.

Ranked findings (report in this order):

  1. BLOCKING — whole change, 434 lines. See entry 1. Evidence: #331 merged fixes #266's cause; #266 follow-up asks for detection only where provenance can be established; this PR's own export found 2,646 meaningless addresses per rank with no true positive; FujitsuPolycom's #331 run saw 864 unaligned byte-window matches per rank. Smaller version: nothing, or one line — for (offset, bytes) in data.chunks_exact(8).enumerate() replacing data.windows(8).enumerate() at reachability.rs:259 (and the same for scan_spans' inherited behaviour), which is reviewer yatesdr's open blocking item 1 from 2026-11-20. Only with that fix do the counts, cap, ordering key, symbol lookup and cache earn their lines.

  2. SHOULD FIX — ~55 test lines. entry 4. Drop shared_argument_bytes_record_one_example_per_address (reachability.rs:792-807), the inactive and numeric halves of kernel_argument_inactive_ranges_are_reported_but_numeric_ranges_stay_lenient (902-916), the second wire::Function in 823-828, and either the occurrences == 0 early return (207-210) or the capture.rs:3137 guard — not both. KEEP allocation_contents_still_tolerate_gap_candidates (918-926) and freed_interval_boundaries_report_kernel_candidates_without_retaining_storage (928-966).

  3. SHOULD FIX — ~30 production lines. entry 3: collapse UnresolvedCandidate+Site+UnresolvedEntry (49-61, 66-71) to one site type with graph, node, function, argument, offset, occurrences; drop order (59, 171, 183, 223) and the sort_unstable_by_key (223) by keeping insert order in a Vec; inline unresolved_unique_addresses (197-199); replace with_count (455-461) with "occurrence(s)"/"address(es)"/"more occurrences".

  4. SHOULD FIX — ~10 lines. entry 5: drop the miss-list cache or keep HashSet (blobs, 84, 147-169, misses.clone() at 150 and 166) since the unresolved map already dedups by address; make scan (248-274) return its misses instead of taking Option<&mut Vec> (three call sites, two pass None: 370-374, 378).

  5. SHOULD FIX — ~16-20 prose lines. entry 6: trim the four doc blocks (45-48, 63-65, 73-74, 201-204) from 13 to ~4 lines; shorten the summary format string (211-221) and its two verbatim copies in tests (832-836, 861-865).

  6. SHOULD FIX — ~5 lines. entry 2: one rule, one place — candidate (131-145) returns whether the value is a live pointer directly, scan drops in_free_block (262-265) and the duplicate partition_point. Closes reviewer item 2 from 2026-11-20; includes the ready code.

  7. Nit — capture.rs:3138-3139 stacks two prefixes ("export: rank N: kernel argument scan: ..."); keep one. 0 lines.

Totals to quote: with the design as submitted, ~110-130 of the 434 added lines are removable (55 tests + 30 structs/helpers + 16-20 prose + 10 cache/sink + 5 duplicate rule). With finding 1's one-line enumeration fix first, the counts/cap/order/symbol/cache machinery loses most of its justification, i.e. ~300 of the 434 lines.

Candidates I checked and DROPPED (do not report):

#11 [high] Re-review at head 1ac7073d: what changed since c3cc87e, and what it costs now

Head 1ac7073d (2026-11-26), base main c9935887. pr_files: docs/TODO.txt +6/-0, docs/runtime-core-design.md +8/-2, heliopause/src/export/capture.rs +6/-1, heliopause/src/export/reachability.rs +579/-34. Total +599/-37.

Split of the 599 added lines (computed from main's copy vs head):

Addressed since my c3cc87e review:

Still open / unchanged at head: blobs miss-list cache with two clones per key (85, 172-213), Option<&mut Vec> sink (283-288, callers 185-189/402-406/410), duplicate site structs (45-72), order field + re-sort (60, 196, 208, 248), unresolved_unique_addresses (222-224), with_count (487-493), capture.rs guard (3219-3223), and ~385 lines of new tests of which ~95 provably re-prove sibling tests.

#12 [high] Blocking: 599-line change whose own measurement identifies no stale pointer and whose target is fixed by merged #331

Charter (read via read_charter, lines 11/35): "Bring real evidence ... Bug fixes need to address the root cause"; "Look for the smallest footprint in shared code, or a way to solve it without new code at all".

Evidence at head:

Smallest footprint that still answers the maintainer's asks (occurrence/distinct counts, up to 10 aligned examples with graph/node/symbol/module/argument/offset, hidden count, one rule, tests, doc line): ~155 production + ~90 test lines instead of ~194 production + ~385 test lines, i.e. about 450 of the 599 added lines go. Concretely: one site struct, no order field, no miss-list cache, no Option sink, unresolved_count/unresolved_unique_addresses/with_count inlined or dropped, 4 report-format tests collapsed to 1, 6 of the 12 new behaviour tests merged or deleted, one doc paragraph.

#13 [high] Should fix: ~75 production lines condense — duplicate site structs, the cloned miss-list, single-use counter, pluralizer, duplicate empty guard

reachability.rs:45-76 structs, 172-213 blob, 215-224 counters, 226-281 unresolved_report, 487-493 with_count, capture.rs:3219-3223. Smaller version, verified against head:

/// A kernel argument value that resolves to no live recorded allocation, in a gap
/// between allocations or an inactive block. It may be a stale pointer or a numeric
/// constant, so export reports it without failing.
#[derive(Clone)]
struct Site<'a> { graph: &'a str, node: usize, function: usize, argument: usize }

struct Unresolved {
    graph: String, node: usize, function: usize, argument: usize, offset: usize, occurrences: usize,
}

/// Distinct addresses shown per rank.
const UNRESOLVED_EXAMPLES: usize = 10;

vs today's 32 lines (two structs + doc triads + const): -19.

fn blob(&mut self, data: &[u8], numeric: &[(usize, usize)], site: &Site) -> ExportResult<()> {
    let key = (data.to_vec(), numeric.to_vec());
    if !self.blobs.contains_key(&key) {
        let excluded = merge_ranges(numeric.iter().map(|&(s, e)| (s as u64, e as u64)).collect());
        let mut misses = Vec::new();
        for (start, end) in subtract_ranges(0, data.len() as u64, &excluded) {
            self.scan(&data[start as usize..end as usize], start as usize, Some(&mut misses))?;
        }
        self.blobs.insert(key.clone(), misses);
    }
    for &(offset, address) in &self.blobs[&key] {
        self.unresolved.entry(address).and_modify(|e| e.occurrences += 1).or_insert(Unresolved {
            graph: site.graph.to_owned(), node: site.node, function: site.function,
            argument: site.argument, offset, occurrences: 1,
        });
    }
    Ok(())
}

24 lines vs 42: removes misses.clone() at 175 and 191 (the temporary is moved into the map, then read by disjoint field borrow) and folds first: away: -18.

Counters: unresolved_unique_addresses (222-224) is self.unresolved.len() used at 242 and in four asserts whose meaning survives as .len(): -3.

/// Summary, up to ten examples with occurrence counts, and the omitted total.
pub(crate) fn unresolved_report(&self, functions: &[wire::Function]) -> Vec<String> {
    let occurrences: usize = self.unresolved.values().map(|e| e.occurrences).sum();
    if occurrences == 0 { return Vec::new(); }
    let mut examples: Vec<_> = self.unresolved.iter().collect();
    examples.sort_unstable_by_key(|&(_, e)| std::cmp::Reverse(e.order)); // or keep the map order field
    let mut lines = vec![format!(
        "kernel argument scan: {occurrences} occurrence(s), {} address(es) outside every live allocation",
        examples.len())];
    for &(address, e) in examples.iter().take(UNRESOLVED_EXAMPLES) {
        let function = functions.get(e.function);
        lines.push(format!(
            "  graph {:?} node {} kernel {} ({}), argument {}, offset {}: {address:#x} ({} occurrence(s))",
            e.graph, e.node, function.map_or("unknown", |f| f.symbol.as_str()),
            function.map_or("unknown", |f| f.module.as_str()), e.argument, e.offset, e.occurrences));
    }
    if let Some(hidden) = examples.get(UNRESOLVED_EXAMPLES..) {
        lines.push(format!("  … {} more address(es) ({} occurrence(s)) not shown", hidden.len(),
            hidden.iter().map(|(_, e)| e.occurrences).sum::<usize>()));
    }
    lines
}

~26 lines + no with_count (7 lines deleted) vs today's 56+7: -35. with_count is new machinery with no other user (search_code 'fn plural|pluralize' → no matches); "occurrence(s)"/"address(es)" is fine on stderr.

capture.rs:3219-3223 → for line in reach.unresolved_report(..) { eprintln!(...) }: the guard duplicates unresolved_report's occurrences == 0 early return: -3.

Total production/doc: 19+18+3+35+3 = 78, call it -75. Note: I dropped the order-field removal from this bucket because sorting by address instead of first encounter changes which ten examples print; keep order.

#14 [high] Should fix: ~120 of the ~374 added test lines re-prove sibling tests

Test module at head runs reachability.rs:495-1252 (758 lines) versus main's 324-707 (384): ~374 net added, essentially the whole 579-line growth. Twelve new #[test]s plus helpers kernel_graph (730-751), SITE (753-758), first (760-762). Verified redundancies, with the sibling test that already proves each fact:

  1. unresolved_report_hidden_line_sums_omitted_address_occurrences (944-987, 44 lines) — its whole claim is that the omitted line sums hidden occurrences rather than counting hidden addresses; unresolved_report_bounds_examples_and_counts_hidden_occurrences (876-905) asserts " … 2 more distinct addresses (4 occurrences) not shown" where 4 ≠ 2, so an implementation printing the address count fails there. Same shape (12 distinct, 2 hidden), different numbers. -44.
  2. shared_argument_bytes_record_one_example_per_address (824-839, 16) — dedup by address across graphs and first-site retention are asserted by 876-905 (lines[1].contains("graph \"graph-a\" ...") with 12 addresses across graph-a/graph-b). -16.
  3. kernel_argument_inactive_ranges_are_reported_but_numeric_ranges_stay_lenient (1019-1033, 15) — inactive-range reporting without retention is asserted by freed_interval_boundaries_report_kernel_candidates_without_retaining_storage (1071-1133, third argument is the inactive list), and the numeric half by main's numeric_argument_holes_are_conservative (600-607). -15.
  4. kernel_argument_boundaries_and_external_values_follow_the_recorded_contract (995-1017, 23) — the live/gap boundaries are the same values 1071-1133 checks; the out-of-envelope cases exercise pointer >= floor && pointer < ceiling, unchanged from main (main reachability.rs:157-159). -20.
  5. unresolved_report_omits_hidden_line_when_all_distinct_addresses_are_shown (907-942, 36) — the one-address half (907-926) restates unresolved_report_names_the_kernel_and_its_symbol (841-874, two lines) and unresolved_report_is_empty_without_candidates (989-993); only the exactly-ten boundary is new and needs ~6 lines. -30.
  6. kernel_argument_candidate_offset_counts_from_the_argument_start (804-822, 19) — offset-from-argument-start is new but needs ~8 lines; its numeric-hole half repeats 600-607. -10.
  7. allocation_contents_still_tolerate_gap_candidates (1035-1043, 9) — a real distinct fact (contents() never reports) in 3 lines. -6.
  8. unresolved_report_is_empty_without_candidates (989-993, 5) — asserts an early return that capture.rs:3219's guard makes unreachable; with the guard deleted (production finding) the function must still print nothing for zero candidates, but the assertion is a Vec::is_empty() on trivially no work. -5.

Sum 146; conservative claim ~120 lines of behaviour-preserving test removal. Nothing here is "a test that proves no behaviour" beyond 8; the rest are duplicates of a sibling's claim, which reviewer yatesdr already flagged once (repeated_argument_bytes_report_every_call_site, 2026-11-18 item 6).

Also: docs/runtime-core-design.md:154-157 and :339-341 state the same rule twice (event-relative detail and the stderr-row list); one sentence in each suffices, -3 (nit, and the second is where the reviewer asked for it).

Grand total removable at head: ~75 production + ~120 test + ~3 docs ≈ 200 of the 599 added lines, with no behaviour lost beyond which ten examples print (unchanged) and plural forms ("occurrence(s)").

#15 [high] Report-ready summary at head 1ac7073d

Ranked by lines saved. Change at head 1ac7073d: +599/-37 (reachability.rs +579/-34, capture.rs +6/-1, docs/TODO.txt +6, docs/runtime-core-design.md +8/-2). Verified against main (reachability.rs 707 lines) and head (1252 lines).

  1. Blocking — the change should not merge at this size. 599 added lines for a non-blocking stderr diagnostic whose own run identifies no stale pointer: the aligned counts are 22,618/762 and 19,417/832 per rank and every printed example is a CUTLASS template constant (0xfff00000fff, 0x3fff000003ff, 0x200000000020, 0x100000001000); #266's root cause is fixed and verified by merged #331 (FujitsuPolycom: all 120 split-K arguments resolve on four GB10s, no Xid); and the required four-GPU measurement now lives in docs/TODO.txt:350-354, i.e. it merges unmet. Smaller version that still answers every maintainer ask: ~155 production + ~90 test lines. Savings ≈ 350-450 lines.

  2. Should fix — ~75 production lines (entry 13): duplicate Site/UnresolvedCandidate structs (-19), misses.clone() twice per key in blob (-18), unresolved_unique_addresses (-3), 4-line summary + with_count → one-line occurrence(s)/address(es) (-35), capture.rs guard duplicating the report's empty check (-3).

  3. Should fix — ~120 of the ~374 added test lines (entry 14): 8 tests whose claim a sibling already asserts, led by unresolved_report_hidden_line_sums_omitted_address_occurrences (44 lines, same claim as the 4≠2 assertion at 876-905) and shared_argument_bytes_record_one_example_per_address (16 lines, subsumed by the same test).

  4. Nit — 3 doc lines: docs/runtime-core-design.md:154-157 and 339-341 state the same reporting rule twice.

Total removable ≈ 200 of 599 (dense version), ≈ 450 (minimal version). Dropped candidates: the inactive-rule duplication and the Order-style re-sort were fixed/kept; the Option<&mut Vec> sink is a 3-line wash; sorting examples by address instead of first encounter would change printed examples, so order stays.

Already fixed at head, do not re-raise: alignment filter in scan (294-303), candidate as the single rule (153-170), symbol lookup through the recorded function index (capture.rs:3220), docs and TODO entries present.

#16 [high] Research summary

Reviewed PR #332 at head 1ac7073d (+599/−37 across 4 files) through the subtraction lens; findings are scratchpad entries 11–15, with #15 as the ranked report.

Verdict: should not merge at this size. The whole 599-line apparatus (≈194 production lines in reachability.rs, ≈374 test lines, 14 doc lines) exists to print a non-blocking stderr diagnostic, and its own measurement at head still shows only noise: 22,618/762 and 19,417/832 occurrences/distinct per rank, every example a CUTLASS template constant, none a stale pointer, none from a W4A8 MoE kernel. #266's root cause is already fixed and independently verified by merged #331, and the four-GPU measurement the maintainer required is now recorded as future work in docs/TODO.txt:350-354 — so the change merges with its own validation open.

Concrete subtractions, ranked: ≈350–450 lines if the report is brought down to what the maintainer actually asked for (counts, ten aligned examples, hidden total, one rule, tests, a doc line); ≈200 lines with no behaviour lost at all — duplicate Site/UnresolvedCandidate structs (−19), the miss-list Vec cloned twice per key in blob (−18), unresolved_unique_addresses (−3), the four-line summary plus with_count pluralizer replaced by "occurrence(s)"/"address(es)" (−35), the capture.rs guard that duplicates the report's own empty check (−3), eight tests whose claim a sibling test already asserts (−120 of ~374), and one duplicated doc sentence (−3).

Two of my earlier findings are now fixed and should not be re-raised: the alignment filter in scan (:294–303) and candidate as the single live/inactive/gap rule (:153–170). I also dropped the Option<&mut Vec> sink (3-line wash) and kept the order field, since removing it would change which ten examples print.

#3 [medium] Should fix: duplicate site structs, re-sort of a HashMap, single-use accessors, pluralizer (~30 lines)

heliopause/src/export/reachability.rs:45-75, 170-186, 224-236, 238, 455-461.

  1. UnresolvedCandidate (49-55) + Site<'a> (66-71) + UnresolvedEntry (57-61) carry the same four fields (graph/node/function/argument) twice. Site exists only to be copied field-by-field into the owned UnresolvedCandidate at 176-182:
struct UnresolvedEntry { graph: String, node: usize, function: usize, argument: usize, offset: usize, occurrences: u64 }

and blob(&mut self, data: &[u8], numeric: &[(usize, usize)], graph: &str, node: usize, function: usize, argument: usize) — or keep one borrowed Site and have blob own the copy only on first insert (or_insert_with(|| Site { graph: graph.to_owned(), ..site })). Removes ~12 lines between the two structs plus 4 lines of Site in the two module-level docs. unresolved_count (190-195) then becomes sum::<u64> over .occurrences — or is deleted entirely (see below).

  1. unresolved_unique_addresses (197-199) is self.unresolved.len() in a function body used once (line 217); inline it. -4 lines.

  2. order (59, 171, 183, 223) exists to re-sort a HashMap back into insertion order: let order = self.unresolved.len(); and examples.sort_unstable_by_key(|(_, e)| e.order). A Vec of entries plus an address→index HashMap (or a plain Vec<UnresolvedEntry> scanned linearly for 2,646 entries) keeps insertion order for free and deletes the field, its initializer and the sort. -4 lines. order is only ever asserted in tests (reach.unresolved[&address].order, line 767).

  3. with_count (455-461, 7 lines + 2 call sites) exists because the summary has one plural and the hidden line has another ("more occurrence(s)"). Dropping the singular form ("occurrence(s)", "address(es)", "more occurrences") deletes the helper and both call-site expansions: -12 lines including the test string. The repository has no general pluralizer (search_code 'fn plural|pluralize': no matches), and this diagnostic's only consumers are operators reading stderr.

Total here: ~30 lines of production code with no behaviour change.

#4 [medium] Should fix: ~55 test lines prove what sibling tests already prove; capture.rs guard duplicates the report's empty check

heliopause/src/export/reachability.rs:698-966 (tests) and capture.rs:3137-3141.

Tests: the change adds 10 tests (kernel_graph helper 698-719, SITE 721-726, first 728-730, then 732-966). Roughly half the added test lines prove facts one existing or sibling test already proves:

Total tests: ~55-60 removable lines of the ~215 added.

capture.rs: if reach.unresolved_count() > 0 { for line in reach.unresolved_report(..) } (3137-3141) is a 5-line block whose guard duplicates the occurrences == 0 early return inside unresolved_report (207-210). One place suffices: for line in reach.unresolved_report(&output.index.ranks[0].functions) { eprintln!(...) }. -2 lines.

#5 [medium] Should fix: miss-list cache clones Vec pairs twice per key and the Option sink in scan has one real caller (~10 lines)

heliopause/src/export/reachability.rs:147-169 (blob) and 248-274 (scan).

blob now stores Vec<(usize, u64)> of every miss per distinct (data, numeric) key and then lists them:

// reachability.rs:84
blobs: HashMap<(Vec<u8>, Vec<(usize, usize)>), Vec<(usize, u64)>>,

Two costs worth naming:

  1. misses.clone() twice per new key (150, 166). With the export's measured population (2,646 distinct addresses on rank 0 alone, each a (usize, u64) pair) the cache holds tens of thousands of pairs per rank for the whole scan, and it grew from HashSet (main, reachability.rs:52) to a map of vectors. The cache exists only to skip re-scanning identical blobs; keeping HashSet and re-listing the misses on each repeat would drop the payload (the map is HashSet<(Vec<u8>, Vec<(usize,usize)>)> plus for (offset, address) in misses recomputed... ) — simplest subtraction: do not cache the miss list at all, since the unresolved map already deduplicates by address and increments occurrences for repeats; the cache's only job is CPU, and it buys it with memory that outlives the scan. -6 lines (let misses = match ..., misses.clone() x2) if the cache is dropped and blob scans and records inline. No behaviour change: repeated addresses are already merged by .entry(address).and_modify(|e| e.occurrences += 1).
  2. misses: Option<&mut Vec<(usize, u64)>> is threaded through scan for three callers, two of which pass None (370-374, 378). scan is only called from two places: blob (with a sink) and scan_spans (without). A separate scan_misses that returns Vec<(usize, u64)>, or making scan take &mut Vec and having scan_spans pass a throwaway Vec, removes the Option and the as_deref_mut() dance (3 lines plus the two None arguments). Better: scan returning ExportResult<Vec<(usize,u64)>> needs no parameter at all.

Together: ~10 lines and the largest retained structure in the diagnostic.

Note the pre-existing windows(8)-byte-sliding is not introduced here (main has it at reachability.rs:155) but the report now materializes its output; yatesdr's blocking item 1 (chunks_exact(8)) is the fix that makes this cache and the whole enumeration small.

#6 [medium] Nit-to-should-fix: doc comments restate the code and the 4-line summary sentence is duplicated in two test strings (~16-20 lines)

Docs/comments in the diff and what they cost:

  1. reachability.rs:45-48 (UnresolvedCandidate doc, 4 lines), 63-65 (Site doc, 3 lines), 73-74 (UNRESOLVED_EXAMPLES doc, 2 lines), 201-204 (unresolved_report doc, 4 lines): 13 lines of doc comment for ~110 lines of code, and three of the four restate the code. UNRESOLVED_EXAMPLES doc says "The examples retain the first call site for each address in graph and node order" — that sentence is exactly what order + sort_unstable_by_key implement, and the ordering requirement came from review; if the field goes (see entry 3) the comment is wrong. Also the repo-prose skill requires comments to state invariants, not to narrate (SKILL.md:38-39). One line per item suffices: -8 lines.

  2. The summary sentence in the report (211-221) is a 4-line format string that spells out in prose what the counts say: "N occurrences and M distinct addresses fall inside the recorded address envelope but outside every live recorded allocation, so each may be a stale pointer or a numeric constant". Reviewers asked (yatesdr 2026-11-20 item 1) for the counts, not a paragraph, and the same string is duplicated verbatim in two tests (832-836, 861-865) where it consumes 8 of those tests' lines. "kernel argument scan: {occurrences} occurrence(s), {addresses} address(es) outside every live allocation" cuts the format string to one line and both test strings to one each: -8 lines. Nothing lost: the "may be stale pointer or numeric constant" caveat is a description sentence (PR "Change" section) and repeats in the doc comment at 45-48.

  3. capture.rs:3137-3141 prints "export: rank {}: {line}" per rank, and reachability.rs already builds the prefix meaning ("kernel argument scan:") — two prefixes in one line. Pick one. -0 lines but a simpler contract: unresolved_report returns the summary line already prefixed, the caller loops. (Nit; ranked last.)

  4. Nothing in docs/ needs updating: docs/runtime-core-design.md:118-156 describes retention, numeric spans, and "This can retain false positives and retains complete backing segments" — the diagnostic does not change any documented behaviour, so no doc addition is required either. (Recorded so the final report can say the change leaves no dead documentation behind.)

#17 [medium] Rules and reviewer citations used by the report

Citations the report may lean on, with their exact provenance so nothing is overstated.

Charter (quoted lines came from the orientation packet's charter excerpt, which reproduces the project's Autobot charter; I did not re-fetch it with read_charter this turn):

Reviewer history (PR #332 comments, all read via read_item 332):

Consequence for the report: of the maintainer's asks, only "measure the noise" remains unmet, and the PR now files it as docs/TODO.txt:350-354. Every other ask (symbol, rank label, one example per address, single rule, alignment, straddling test, docs) is satisfied — which is why the remaining criticism is size, not correctness.

#7 [low] Note: nothing dead left behind outside the two changed files

Checked for things the change supersedes or leaves behind:

Conclusion of the sweep: no orphaned flags, config, docs or callers. The subtraction surface is entirely inside the two changed files.