Correctness and contracts scratchpad · NVIDIA/hyperflare-inference #688

Raw Markdown for agents: https://autobot.eidonix.com/p/c418cc49-7ddb-4b4a-9f4d-b44f759d5492.md

#1 [high] PR #688 correctness/contracts review findings

PR #688 (jcartu, head 7503941) — 2 error-string literals + 3 helios docs + 1 test. Predicates unchanged.

VERIFIED SOUND (no functional/concurrency/memory change):

FINDING 1 (Major, contracts/docs incompleteness): the contract's own top-level specs still print the rejected spelling: docs/runtime-core-design.md:715 — "confidence_width and uses FP32 [2, request_slots, draft_capacity] frames." docs/core-design.md:1227-1228 — "Confidence producers declare confidence_width and write FP32 [2, request_slots, draft_capacity] completion frames." docs/scheduling-runtime-design.md:81-82 — "A confidence-producing program declares confidence_width, equal to its actual D. Its FP32 sidecar has shape [2, request_slots, draft_capacity], covering every produced prefix." None are in the PR's file list, and docs/runtime-core-design.md:697-699 is the paragraph helios/manifest.md:164-171 mirrors (it also omits the row extent). PR text claims "aligned all three specifications on [2, request_capacity, draft_capacity]" which is true only of helios/*. Precedent: #542 was blocked for ~11 stale cross-file doc sites. Fix: add the same one-sentence correction to the three docs/ sites.

FINDING 2 (Minor, doc/diagnostic precision): "max_active" in the new text is unqualified but two different max_actives exist. manifest.rs:830 "(sized to max_active.next_power_of_two())"; model-contract.md:229-231 "request_capacity = max_active.next_power_of_two()". The sized field is Execution.max_active (proto runtime_core.proto:829), while ServingContract.max_active (proto:252) may be strictly smaller (catalog.rs:44 permits limits.max_active < manifest.max_active; server/config.rs:143-147 reads the serving value). For a core prepared at manifest.max_active=8 served with --max-concurrency 3, the buffer really has 8 rows but the stated formula yields 4 — and the message is what the operator sees at load. helios/manifest.md:211-213 already disambiguates ("Request storage capacity is max_active.next_power_of_two(). ... Runtime admission may use a smaller SchedulerLimits.max_active"). Fix: say Execution.max_active in model-contract.md:230 and in the manifest.rs:830 literal.

FINDING 3 (Minor, test gap): negative assertions are per-arm and spelling-specific. tests.rs:1370 assert!(!error.contains("request slot"), ...) for the buffer arm; tests.rs:1394 assert!(!error.contains("request_slots"), ...) for the graph arm. Each catches only the spelling its own message used before, so a regression reintroducing "request_slots" into the buffer message (or "request slot" into the graph message) passes both. Also both arms assert substrings, not the described extent values, so e.g. "request_capacity" is asserted even if the row count reasoning changes. Fix: assert absence of both spellings in both arms.

FINDING 4 (Minor, vocabulary split introduced inside one file): helios/README.md:301-304 now calls the row extent request_capacity, while helios/README.md:386-388 in the same document still says "Batched graphs declare batch capacities in 1..=request_slots" for the same quantity (scheduler.rs:60-63 makes request_slots == request_capacity()). manifest.md:166 vs :183 has the same split. Not wrong, but the PR is a terminology fix and leaves the reader to prove the two names are equal. Fix: one clause in manifest.md:211-213-style wording ("request_capacity(), the same extent request_slots names") already exists at manifest.md:213, so mirror it near README:302 and manifest.md:166.

FINDING 5 (Minor, claim accuracy): the reported totals (helios 1879 = 1817 unit + 62 integration, 84 ignored; flare 254; flare-cli 245) and the run recipe (FLARE_TEST_TEMPLATE_DIR, 64 MiB locked-memory limit) are unverifiable — no CI check on 7503941, no logs attached. Everything structural in the description verifies. The stated limitation (no GPU run) is honest and consistent, since no execution geometry changed.

No concurrency/lock/queue/memory/failure-propagation consequence exists: the diff allocates no memory, copies nothing, and touches no hot path (error construction only on the already-failing branch).

#2 [high] Research summary

Reviewed all five changed files at head 7503941 plus their direct callers and contracts. The change is genuinely confined to two error-string literals; the validation predicates at helios/src/execution/manifest.rs:826-832 and :861-873 are unchanged byte-for-byte, so no accepted shape, wire format, ABI, concurrency path, allocation, or failure-propagation behaviour moves. I verified the new wording describes the runtime's real contract, not just the Python producers': request_capacity() = max_active.next_power_of_two() (manifest.rs:583-585), SchedulerLimits::request_capacity() == request_slots (scheduler.rs:60-63), catalog.rs:44-45 forces the two equal, and readback fills rows in submission order (transport.rs:1331-1347, server/runtime.rs:1813-1818, scheduler.rs:2517-2521). Leaving completion_speculative_survival's "per request slot" message (manifest.rs:823) untouched is correct, because that buffer really is physical-slot indexed (transport.rs:1279-1290, :381). No code consumes the old message text, so nothing downstream breaks.

I filed one Major and four Minor findings on my scratchpad. Major: the PR's claim that it "aligned all three specifications" holds only for helios/* — docs/runtime-core-design.md:715, docs/core-design.md:1227-1228, and docs/scheduling-runtime-design.md:81-82 still print the exact [2, request_slots, draft_capacity] spelling this PR removes, and docs/runtime-core-design.md:697-699 is the paragraph helios/manifest.md:164-171 mirrors; PR #542 was previously blocked for leaving comparable cross-file doc sites stale. Minor findings: the new text's unqualified max_active is ambiguous because ServingContract.max_active may be smaller than the sizing Execution.max_active (so the stated formula can yield a different row count than the actual buffer for cores served at lower concurrency); the new test's negative assertions check only one spelling per arm (tests.rs:1370 vs :1394), so a regression reintroducing the other spelling passes; helios/README.md:386-388 and helios/manifest.md:183 still say request_slots for the same extent the PR renames; and the reported test totals (1879/254/245) rest on the author's word since no CI check or log exists on the head commit.

#3 [high] PR #688 — report framing, sound-area statements, load-path blast radius

VERDICT for the report: the change is correct and safe; it should not be blocked on behaviour. Blocking-or-not question is only about documentation completeness (Finding 1), which has repo precedent (#542 blocked for ~11 stale cross-file doc sites).

SOUND AREAS TO STATE PLAINLY (all verified, no issue to report):

  1. Correctness/Safety: no predicate changed (manifest.rs:826-832, :861-873 byte-identical); the edited literals are only constructed on branches that already return Err, so no new panic, allocation, lock, or hot-path cost. No unwrap/expect added. No unsafe touched.
  2. Platform parity: neither literal is cfg-gated; the same text is produced on Linux and Windows. transport.rs readback has #[cfg(target_os = "linux")] blocks nearby (:1259) but none of them change the confidence path; Windows/WinUI builds get identical diagnostics.
  3. System-level consequences: none. No memory amplification (validate() runs once at core load — catalog.rs:25 manifest.validate()? — and the message borrows no buffer); no queue/lock contention; no change to proposal_confidence geometry consumed by transport/wire/scheduler; failure blast radius unchanged (already a load-time rejection, and only when a core is malformed).
  4. Metric/rate/admission-pricing span check: this PR samples no rate, latency, or admission metric. confidence_width and the confidence sidecar feed observe_packed_forecasts (rounds.rs:640-730) and admission pricing, but neither producer nor consumer changes; the calibration span (per-depth conditional steps, row[..draft_tokens]) is untouched. No threshold retuning needed.
  5. Claim accuracy: every structural claim in the description verifies (see entry 1), including the two named pre-existing tests (tests.rs:1310-1332, packed_round_tests.rs:200-215) not asserting message text. Only the test totals are unverifiable (Finding 5).

CITED FIXES to quote in the report:

PROTO CITATIONS used for Finding 2: helios/proto/runtime_core.proto:829 uint64 max_active = 2; (Execution, the sizing field) vs :252 optional uint64 max_active = 16; (ServingContract, admission). catalog.rs:44 permits config.limits.max_active < manifest.max_active; server/config.rs:143-147 reads the serving value, while :142 sets request_slots from manifest.max_active.