Subtraction and simplicity report · NVIDIA/hyperflare-inference #714

Raw Markdown for agents: https://autobot.eidonix.com/p/b06a6d5f-a558-4697-8c05-12da5b94b189.md

Subtraction & Simplicity audit — PR #714 (fix(helios): add missing external_extents field in cache_memory test Core literal)

Verdict: the diff is already lean. No subtraction available, no changes requested.

pr_files = helios/src/runtime_core/cache_memory.rs (modified, +1 -0). The added line is

helios/src/runtime_core/cache_memory.rs:1670            external_extents: vec![],

This is the minimum possible edit. Core declares pub external_extents: Vec<ExternalExtentTable>, at helios/src/runtime_core/format.rs:35; Rust requires every field in a struct literal, and vec![] is the empty value already used by the 13 other literals. The PR introduces no CLI flag, config knob, wrapper, dead/unreachable branch, speculative generality, or new helper. There is no line in the diff that could be deleted and still compile, and no repeated validation to collapse within a single line. Per the brief: if the diff is lean, say so plainly — it is.

Two process notes for anyone re-auditing: (a) pr_diff for this PR returns a large cumulative stale-merge-base diff (.github/workflows/native-serving.yml (not opened), AGENTS.md, docs/*.md, plus a multi-hundred-line cache_memory.rs hunk from #659/#674) — that is not this PR's change; pr_files (+1 −0) is authoritative. (b) The author restored the missing field rather than deleting the test, removing the field, or #[ignore]ing it — no swallowed error, consistent with the charter's root-cause rule.


Follow-up 1 (highest value): the recurrence mechanism is 14 hand-maintained Core literals — collapse them

#711 added external_extents to 13 of 14 literals and missed one. That is this bug, and it will recur on the next field add. All sites that must be hand-edited today:

Core (format.rs:23-36) has no Default, but every one of its eleven fields already implements Default, so a constructor compiles today with no other edit: resources: HashMap (:25), architecture: [i32; 2] (:26), allocations/modules/functions/graphs/reservations/events/external_extents as Vecs (:27-31, :34-35), execution: Option<wire::Execution> (:32), and context: Context where Context carries #[derive(Debug, Default)] at format.rs:38. That turns each 11–12-line literal (e.g. the one this PR patches, cache_memory.rs:1659-1671) into Core { architecture, ..Core::empty() }.

The repo already uses exactly this idiom, one file over — helios/src/runtime_core/model.rs:1829-1832:

let plain_core = || Core {
    execution: Some(protobuf::wire::Execution::default()),
    ..worker_core()
};

which is precisely why the second literal in model.rs needed no external_extents: line from #711, while cache_memory.rs's second literal did. Honest caveat: a default-constructed Core is invalid by construction — format.rs:287-289: if self.allocations.is_empty() || self.graphs.is_empty() { return Err(invalid("unsupported or empty runtime core")); } — so expose it as #[cfg(test)] fn empty() in the tests module, not as impl Default for Core, to avoid manufacturing an invalid-state constructor in production code.

Follow-up 2: ~41 duplicated lines inside the very file this PR touches

The two #[ignore = "requires an assigned CUDA_VISIBLE_DEVICES GPU"] GPU tests (cache_memory.rs:1363, :1637) repeat the same preamble verbatim, differing only by indentation because one sits inside a loop:

The repo already has the compact form worth copying — helios/src/runtime_core/persistent_worker.rs:1356-1366:

let attr = |code: i32| { ... };
(attr(75), attr(76), attr(16), attr(81), attr(97))

One fn cuda_device() -> (Driver, c_int, [i32; 2]) helper deletes ~40 lines across these two tests and absorbs the third copy of the same probe at helios/src/runtime_core/memory.rs:2268-2283 (for (value, attribute) in p.architecture.iter_mut().zip([75, 76])). No assertion changes.

Follow-up 3 (lowest value): AllocationProperties device literal written out five times

Byte-identical except the device argument: cache_memory.rs:1400-1406, :1673-1679, :2139-2148 (fn map_cache_chunk), helios/src/runtime_core/mod.rs:599-608, :1452-1461. Definition at helios/src/runtime_core/driver.rs:70-77. A fn device_properties(device: c_int) -> AllocationProperties collapses ~35 lines to five one-liners. Cited only because it sits in the test block this PR edits.

Adjacent observation (out of scope, flagged for accuracy)

external_extents is mirrored into a parallel wire-side struct: fixtures at helios/src/core/export.rs:2872 and helios/src/core/protection.rs:2023 set external_extents: vec![], on wire::CoreBody (export.rs:2773). So a field add on runtime_core::Core also ripples into wire::CoreBody and its literals — a second hand-maintained shape, same failure mode. I verified only these two literals; I did not enumerate all wire::CoreBody sites, so treat the breadth as unquantified.


Not found (so nobody re-audits)

Bottom line for the reviewer: zero findings against the diff. The only simplification story is that the author's one-line patch papers over a structural seam — 14 hand-maintained Core literals plus a mirrored wire::CoreBody — where a test-only Core::empty() and struct-update syntax would make this class of E0063 unrepresentable. That belongs in its own PR so this one-line unblock for #694/#314 and the native-serving runtime-core job can land immediately.