Code correctness report · NVIDIA/hyperflare-inference #714

Raw Markdown for agents: https://autobot.eidonix.com/p/e16f5764-c6c9-48d8-be7f-e9cdfa3e3cae.md

Deep Correctness / Invariants / Hot-Path Audit — PR #714 (1efb1f0)

Verdict: no verified code bug, no state-machine defect, and no hot-path performance defect. The change is correct and complete, and I could not construct a counterexample against it.


0. Scope determination (no partitioning needed)

pr_files reports exactly 1 file, +1/−0: helios/src/runtime_core/cache_memory.rs. That is far below the >12 files / >900 LOC partition threshold, so I audited directly rather than spawning sub-agents.

⚠️ One caveat for anyone re-running this review: the unfiltered pr_diff is misleading — it returned a ~1.6 MB diff touching .github/workflows/native-serving.yml (not opened), AGENTS.md (not opened), docs/api.md (not opened), docs/cli-design.md (not opened), docs/core-design.md (not opened), etc. That is head-vs-tip/main drift, not this PR's change. The path-filtered diff confirms the PR is one line:

// helios/src/runtime_core/cache_memory.rs:1670
             let mut core = Core {
                 resources: Default::default(),
                 ...
                 allocations: vec![],
+                external_extents: vec![],
             };

(Consistent with the since-fixed #711 case-file noise; the PR-description's 52 passed count also does not match this file's 18 #[test] fns / 2 #[ignore] = 16 runnable, so the stated command evidently matched a wider filter — a description matter, out of my lens.)


1. Callee / enum / design-invariant resolution

The struct literal is format::Core, defined at helios/src/runtime_core/format.rs:23-36:

23  #[derive(Debug)]
24  pub(super) struct Core {
25      pub resources: HashMap<String, super::protobuf::wire::Span>,
...
35      pub external_extents: Vec<ExternalExtentTable>,
36  }

and the element type at format.rs:16-21:

16  #[derive(Clone, Debug, PartialEq, Eq)]
17  pub(super) struct ExternalExtentTable {
18      pub channel: String,
19      pub segments: Vec<String>,
20      pub directory: String,
21  }

Is vec![] the semantically correct value, not merely a compilable one? Yes. The only runtime consumer is NativeResources::prepare_async_transfers (helios/src/runtime_core/mod.rs:1483), which resolves extents at mod.rs:1515-1552:

1515  // Resolve authenticated extents from either payload-format `external_extents` or legacy `extents`.
1533  let extents = if let Some(table) = core
1534      .external_extents
1535      .iter()
1536      .find(|t| t.channel == channel.name)
1537  {
1538      let dir_bytes = files.read(core, &table.directory)?;

That whole block is reachable only when the core declares Execution.async_transfers, and the literal under repair sets execution: None (cache_memory.rs:1667). So an empty table list is exactly what a test core with no async-transfer channels must carry — it is inert, and it selects the legacy channel.extents fallback at mod.rs:1553+.

Crucially, the inverse would be a defect: a non-empty external_extents without a matching execution manifest is actively rejected at export (heliopause/src/export/capture.rs:3332-3335 (not opened), "external_extents requires an execution manifest with matching async_transfers"). So vec![] is the only value that is both compilable and valid here — no enum-variant/cost-model outlier, no design-doc mismatch (docs/runtime-core-design.md:705 (not opened) describes RankBody.external_extents payload segments; unaffected).

2. Order-of-operations / state-transition tracing — N/A, verified

The changed line performs no read-before-write of a flag, counter, timestamp or invariant: it is a field initializer in a #[cfg(test)] module (cache_memory.rs:896). I traced the enclosing test cuda_sentinel_row_with_exact_granule_stride_maps_without_tail (:1636-1777) to confirm the literal's fields are only consumed by NativeResources::initialize(&core, 0) (:1672; callee mod.rs:342-352) and owner.allocate_shared_cache(&core, &geometry, &layout) (:1719; callee cache_memory.rs:2040-2046), neither of which reads external_extents. No retry/rollback/unpin path is touched.

3. Adversarial boundary inputs — N/A plus one positive check

No formula, median, comparator or sort key is introduced or modified. The sentinel_granules == 0 / tail == 0 arithmetic the test exercises (layout.fixed_segments() == (2, alignment, 0) at :1716, verify_physical_invariants at :1717) is unchanged by this PR.

Positive check on the fix itself under the protocol's "did they miss another site" question: I enumerated every Core { ... } literal reachable under --features runtime-core and confirmed all now carry the field — cache_memory.rs:1386 and :1659, engram.rs:602 (field at :630), format.rs:645, memory.rs:2003, model.rs:1804, persistent_worker.rs:1607/2083/2373/2743, protobuf.rs:518/1539/1860, selection.rs:575 (plus the ..worker_core() / ..Default::default()-derived ones at model.rs:1829, selection.rs:603/1545/1671/1930 and the Self-literal family). helios/src/async_transfer/ contains no Core literal. No remaining E0063 site.

4. Hot-path algorithmic complexity — N/A

vec![] allocates nothing (Vec::new()), executes once per ignored GPU test, and is never on the serving, eviction, or per-step path. No loop, no scan, no Vec::clone/HashMap::new introduced.


Records / out-of-scope observations (deliberately not raised as findings)

Answer to the audit question: this PR contains no real code bug, numerical/algorithmic defect, state-machine/ordering bug, broken test in the changed code, or hot-path algorithmic regression. The one added line supplies the only semantically valid value (vec![]) for a new format::Core field on a test-only, channel-free core, and it closes the last missing initializer across all runtime-core Core literals.