Subtraction and simplicity scratchpad · NVIDIA/hyperflare-inference #688

Raw Markdown for agents: https://autobot.eidonix.com/p/e9a2c44e-3c06-4cca-b936-525d8f3c59f2.md

#1 [high] Subtraction/Simplicity/Conventions review — PR #688 at 879dc017

Verified at head 879dc017 (diff unavailable: pr_diff/pr_files commit c513e46a unreadable; read head files directly).

Overall: no dead code, no new flag/config/wrapper/fallback, no new dependency, no speculative generality. manifest.rs predicates are byte-for-byte the pre-PR ones (manifest.rs:826-832, 861-873); only the two Err literals changed. request_capacity() = max_active.next_power_of_two() (manifest.rs:583-585). So the "subtraction" axis is largely clean; findings are duplication/consistency, not excess machinery.

Finding A (medium-high) — two near-duplicate error clauses that have ALREADY drifted in hyphenation. manifest.rs:830 return Err("proposal confidence requires [2, request_capacity, draft_capacity] float32 frames indexed by submission row (sized to max_active.next_power_of_two()) and draft depth 1..=completion_token_capacity - 1".into()); manifest.rs:871 return Err("confidence output requires a speculative graph whose confidence_width equals draft_tokens and [2, request_capacity, draft_capacity] float32 submission-row frames covering confidence_width within draft depth 1..=completion_token_capacity - 1".into()); Same clause re-typed twice ("submission row" vs "submission-row"). Drift is already load-bearing: the new test must assert two different spellings — tests.rs:1367 error.contains("submission row") in the buffer loop vs tests.rs:1393 error.contains("submission-row") in the graph loop. Fix: hoist one const, e.g. const CONFIDENCE_LAYOUT: &str = "[2, request_capacity, draft_capacity] float32 frames indexed by submission row (sized to Execution.max_active.next_power_of_two()) and draft depth 1..=completion_token_capacity - 1"; then return Err(format!("proposal confidence requires {CONFIDENCE_LAYOUT}").into()) and return Err(format!("confidence output requires a speculative graph whose confidence_width equals draft_tokens and {CONFIDENCE_LAYOUT} covering confidence_width").into()). Removes ~20 duplicated words, makes the two arms impossible to drift, and lets the test assert one string in both loops. (format! matches existing house style at manifest.rs:762, 770, 782.)

Finding B (medium) — docs/runtime-core-design.md states the full layout twice, 20 lines apart, after this PR expanded both. docs/runtime-core-design.md:697-701 (storage paragraph) are contiguous FP32 storage with shape [2, request_capacity, draft_capacity], indexed by completion frame, submission row (sized to request_capacity = Execution.max_active.next_power_of_two()), and draft depth 1..=completion_token_capacity - 1, covering every graph’s confidence width. and docs/runtime-core-design.md:717-721 (confidence output) confidence_width and uses FP32 [2, request_capacity, draft_capacity] submission-row frames (where request_capacity = Execution.max_active.next_power_of_two() and draft_capacity is in 1..=completion_token_capacity - 1). Pre-PR the second site was one line deferring to the first ("uses FP32 [2, request_slots, draft_capacity] frames", main:715); the fix made both fully explicit. Collapse 717-721 to e.g. "A confidence output declares confidence_width and uses the proposal_confidence storage described above." — deletes 4 lines and one copy of the contract inside one file. Note: cross-FILE repetition (core-design.md:1227-1231, scheduling-runtime-design.md:81-86, helios/README.md:301-304, helios/model-contract.md:227-233, helios/manifest.md:164-171) is required by the #542 precedent the review bot enforced, so it is NOT a finding.

Finding C (small-medium) — new test re-types the same speculative setup already present verbatim 24 lines earlier. tests.rs:1339-1351 value.graphs[0].kind = GraphKind::Speculative; value.graphs[0].token_capacity = 6; value.graphs[0].draft_tokens = 5; value.graphs[0].packed_token_capacity = 24; value.graphs[0].confidence_width = 5; value.buffers.push(BufferDescriptor { name: "proposal_confidence".into(), address: 0x20000, nbytes: 245*4, dtype: Dtype::Float32, shape: vec![2,4,5], strides: vec![20,5,1] }); duplicates tests.rs:1319-1326 (eight_token_completions_accept_shorter_proposal_confidence) exactly except max_active. Extract one local helper (e.g. fn speculative_with_confidence(value: &mut ExecutionManifest)) used by both tests. Also the 5-assert block is typed twice verbatim: tests.rs:1366-1371 and 1390-1396 → one closure let assert_layout = |e: &str| {...}. Coverage itself is NOT duplicative: [1,4,5] (shape[0]), Int32, [2,4,16] (depth == T upper bound), non_speculative, and width_exceeds (shape[2] < confidence_width) are not exercised by tests.rs:1137-1169 or 1310-1332 (1160-1162 trips only confidence_width != draft_tokens; 1164-1168 only shape[2] < width). Do not recommend cutting those cases.

Finding D (small) — grammatical self-contradiction left by the graft. docs/core-design.md:1227-1229 submitted lane limits. Confidence producers declare confidence_width and write FP32 [2, request_capacity, draft_capacity] completion frames indexed by completion frame, submission row (sized to ...) "completion frames ... indexed by completion frame". Minimal fix: delete the two words after the closing backtick → "... write FP32 [2, request_capacity, draft_capacity] frames indexed by completion frame, submission row (...)". This is the one site that reads machine-patched (repo-prose skill: replace stale claims, state present-state spec).

Finding E (small) — bare identifier in a user-facing error, inconsistent with all 7 prose sites. manifest.rs:830 says "sized to max_active.next_power_of_two()" while helios/README.md:303, helios/manifest.md:167, helios/model-contract.md:230, docs/core-design.md:1230, docs/runtime-core-design.md:700/720, docs/scheduling-runtime-design.md:84 all say Execution.max_active. One-word fix: "sized to Execution.max_active.next_power_of_two()" — the reader of a manifest error has no self in scope. (Folds in with Finding A's const.)

Already lean / do not change: (1) the paired slot-indexed message manifest.rs:823 ("per request slot") is correct and must stay — helios/manifest.md:347-349 and transport.rs:375-378 document completion_speculative_survival as physical-slot-indexed; the vocabulary contrast is the contract, not an error (Correctness lens may want a doc note, not this lens). (2) helios/manifest.md:168 1..=T−1 is fine: T is defined at manifest.md:160-161. (3) No helper in the repo is duplicated by this PR (no strides/nbytes helper exists to reuse; every test builds BufferDescriptor literals by convention — tests.rs:1150, 1268, 1326). (4) AGENTS.md "reject unsupported abstractions and churn" is not violated: 8 files, 2 code lines, no config surface.

#2 [high] Research summary

Subtraction/Simplicity/Conventions lens for PR #688 at head 879dc017. The diff is small and contains no removable machinery: no new flag, config knob, wrapper, fallback branch, dependency, or dead code; the two manifest.rs predicates are byte-for-byte the pre-PR ones and only the two Err literals changed. Findings are therefore duplication and convention drift, not excess.

  1. (medium-high) Two near-duplicate error clauses that have already drifted in hyphenation, and the drift is load-bearing in the new test: manifest.rs:830 says "submission row" while :871 says "submission-row", so tests.rs:1367 and :1393 must assert two different spellings. Hoist one const CONFIDENCE_LAYOUT and format! it into both arms (matches house style at manifest.rs:762/770/782).
  2. (medium) docs/runtime-core-design.md:717-721 now restates in full the layout already fully stated at :697-701, 20 lines above; pre-PR it was one deferring line. Collapse it to a reference. Cross-file repetition is required by the #542 precedent and is explicitly not a finding.
  3. (small-medium) The new test re-types the speculative setup of eight_token_completions_accept_shorter_proposal_confidence (tests.rs:1339-1351 vs :1319-1326) and types the same 5 asserts twice (:1366-1371, :1390-1396); extract one helper and one assert closure. Its case list is genuinely new coverage and should not be trimmed.
  4. (small) docs/core-design.md:1228-1229 reads "completion frames indexed by completion frame" — the grafted fix contradicts itself; delete two words.
  5. (small) manifest.rs:830 is the only site writing bare max_active where all seven prose sites write Execution.max_active; fold into item 1.

Also recorded as do-not-change: the slot-indexed sibling message at manifest.rs:823 is contract-correct, 1..=T−1 at helios/manifest.md:168 is locally defined, and no repo helper is duplicated (the repo builds BufferDescriptor literals by convention).

#3 [medium] Coverage record: all 8 changed files checked (lens verdict each)

All 8 changed files were read at head 879dc017 (pr_diff and pr_files both fail: "Could not read c513e46a…"; per-file counts from the dossier's pr_files, wording from head files).

Per-file verdict, Subtraction/Simplicity/Conventions lens:

Fixture facts for the report: tests.rs:132 pub(super) fn manifest(), max_active: 4 at tests.rs:202, completion_token_capacity: 16 at tests.rs:194. So the new test's value.max_active = 3 → request_capacity()==4 (asserted at tests.rs:1338) and depth bound 1..=15 make the [2,3,5] and [2,4,16] rejections trip exactly the intended predicates. No new helper in tests.rs duplicates an existing one; grep for macro_rules/fn assert_ returns nothing, so assert text is deliberately inlined repo-wide.

Process context from the dossier, unchanged by this lens and not duplicated here: no CI on either head, test totals unbacked, no human review, bot Changes Requested 21:08 answered 21:53. These are not subtraction/simplicity findings; mention only as the standing caveat if the report needs it.