Subtraction, Simplicity & Conventions review — PR #621
Key findings
GraphKind::is_text_forward()is a second name for the existingsamples(); the entirehelios/src/execution/manifest.rshunk (and thecontract.rsdeletion it feeds) can be dropped. (high) — manifest.rs:89-104, call sites contract.rs:652 and helios/src/model/packing.rs:140.- Two design docs gained a "what the tests cover" inventory that duplicates
docs/TODO.txt:10-16and belongs there, not in an API reference / execution guide. (high) — docs/api.md:768-771, docs/direct-execution.md:87-90 vs AGENTS.md:57-60. - The
Layout.__post_init__try/exceptwrappers now discard thelabelthat the newly-shared helper was given for exactly that purpose. (low) — ignition/direct/scheduler.py:119-136 vs ignition/preparation/contract.py:15-28. - Otherwise the diff is lean, and the core change is a net deletion:
helios/src/server/runtime.rs−36/+8 by removing the threadedcore_parameter_defsparameter from three helpers and four call sites, andignition/direct/scheduler.pylegitimately deletes its private_wire_fp32/_FP32_MAXduplicate plus the deadtokens=Noneparameter of_cache_key. No new flags, config knobs, fallback branches, or wrappers were introduced.
1. Subtraction — removable code
1.1 is_text_forward() duplicates samples(); drop the whole manifest.rs change (high)
helios/src/execution/manifest.rs:89-104 (head), verbatim:
pub fn samples(self) -> bool {
self.is_text_forward()
}
pub(crate) fn is_text_forward(self) -> bool {
matches!(
self,
Self::Prefill
| Self::TerminalPrefill
| Self::ScoredPrefill
| Self::Resume
| Self::Decode
| Self::Speculative
| Self::Mixed
)
}
The diff (pr_diff --path helios/src/execution/manifest.rs) shows this is purely a rename-in-place: samples()'s body on main was this seven-kind matches! (only Self::Resume changes position), and it was reduced to a one-line forwarder to a new pub(crate) twin. Two names, one predicate, one of them a forwarder.
What to remove: the whole hunk — leave samples() as it is on main, and replace the deleted free function at its two call sites with the pre-existing public method, keeping the existing import style:
helios/src/model/contract.rs:652—let text_forward = descriptor.kind.is_text_forward();→let text_forward = descriptor.kind.samples();helios/src/model/packing.rs:140—graph.kind.is_text_forward()→graph.kind.samples()
and do not delete is_text_forward_graph's body at all in the sense of re-homing it: helios/src/model/contract.rs lines 421-433 (the −14 lines) can simply go with the two call sites retargeted, which is what the PR does — but with manifest.rs untouched (+5/−1 becomes 0). Existing samples() callers already read it as the text-forward predicate, so no semantic drift: helios/src/execution/manifest.rs:944 (if logprobs && graph.kind.samples()), helios/src/execution/transport.rs:1537 (not opened),1552, helios/src/model/testing.rs:171 (not opened), helios/src/server/runtime.rs:2949 (if !step.kind.samples()).
Why this is in scope for the lens: the admission fix does not need the relocation. AGENTS.md:188-193 — "Unsolicited … renaming … annotation sweeps, and file rearrangements are not contributions by themselves. Refactoring must directly support the requested behavior" — fits, and helios/src/execution/manifest.rs is the file most exposed to the ten commits that landed after base 2147cd4c (dossier §4), so removing the hunk also removes the likeliest conflict.
2. Simplicity & duplication
2.1 Test inventories added to two design docs duplicate docs/TODO.txt:10-16 (high)
docs/api.md:768-771 (head), verbatim:
tests cover the wire contract, request decoding, prefix-cache identity, and
packing paths, and Kani harnesses cover declaration validation and resolution.
Live GPU export and serving with a core that declares `core_parameters` remain
pending qualification.
docs/direct-execution.md:87-90 (head), verbatim:
resolves defaults and ranges before prefix lookup. Direct core-parameter
resolution, packing, and checkpoint isolation are verified by CPU tests; live
GPU direct execution with a recipe that declares `core_parameters` remains
pending qualification.
The same fact, with a close criterion, is already recorded once at docs/TODO.txt:10-16:
[ ] Qualify core-declared FP32 `core_parameters` on GPU: export and serve a
core that declares `core_parameters` through `flare run` ... Close when
those GPU runs pass and the qualification notes in docs/api.md and
docs/direct-execution.md are updated.
AGENTS.md:57-60 says it directly: "Record unresolved defects, unrun checks, and pending measurements in docs/TODO.txt, not in design documents." AGENTS.md:119-120 additionally warns against "exhaustive inventories of changed files, preserved properties, buffers, and tests." The two new passages are also unverifiable from the documents that host them — no suite paths, no commands.
What to replace them with: one sentence each stating present qualification without the inventory, e.g. api.md: "CPU tests cover this path; live GPU export and serving with a core that declares core_parameters are not qualified (docs/TODO.txt)." and the analogous single sentence in direct-execution.md. That still satisfies the AGENTS.md:52-57 requirement to state "what is implemented ... and what is not qualified", at a fraction of the text.
2.2 The rewritten admission bullet grew and left a mis-wrapped line (low, same section)
docs/prefix-cache-offload.md:773-785 (head) — the bullet goes from 9 to 13 lines and the wrap breaks at :781:
and creates the request. `admit(spec)` combines these steps for a core
without declarations and no inbound hit. With an inbound hit at consumed
count `c` and `n` chain pages under GPU ancestor `A`, the request reserves
pages and snapshots as if its prefix depth were `c`, and the scheduler creates or joins
an inbound ticket for the key: `n` pages and one snapshot popped from the
Three sentences carry the whole addition: declaring cores must pass resolved values to plan_admission_with_core_parameters; plan_admission/admit are the declaration-free forms and reject a declaring core; both return history plus GPU lookup in an AdmissionPlan without reserving. Replace the new 7-line block with that and restore the original sentence flow (and the normal wrap at :781).
2.3 The wire_fp32 error normalisation in Layout is now redundant (low)
ignition/direct/scheduler.py:119-136 (head), verbatim:
for parameter in parameters:
try:
default = wire_fp32(parameter.get("default_value"))
except ValueError:
raise ValueError("core parameter defaults must be finite FP32 values") from None
range_ = parameter.get("range")
if range_ is None:
normalized_range = None
elif not isinstance(range_, dict) or set(range_) != {"min", "max"}:
raise ValueError("core parameter ranges must be finite and contain their default")
else:
try:
minimum, maximum = wire_fp32(range_["min"]), wire_fp32(range_["max"])
except ValueError:
raise ValueError("core parameter ranges must be finite and contain their default") from None
The helper this PR promotes already takes the label for this purpose — ignition/preparation/contract.py:15-28 raises f"{label} must be a finite FP32 number" / f"{label} is outside the finite FP32 range" — and its own other callers use it that way (ignition/preparation/contract.py:140,145,146: wire_fp32(default, f"core parameter {name!r} default")). So the two wrappers here re-raise a generic string with from None, discarding the label (a bad range["min"] reports only "ranges must be finite and contain their default", with no indication which bound or parameter).
Simplification: pass label=f"core parameter {name!r} default" at :122 and f"... minimum" / f"... maximum" at :132, and delete both try/except blocks — two fewer branches and consistent with contract.py. Caveat for whoever applies it: the helper's type gate rejects np.float32/np.int64/bool (tests/direct/test_scheduler.py:1011-1013, :998-1025), so the removal must not widen acceptance; and the error-family assertions at tests/direct/test_scheduler.py:836-843, 849-856 match failure, not message text. Marked low value: acceptable to leave if the current message strings are treated as part of the surface.
3. Material conventions
No structural AGENTS.md violation beyond §2.1 (prose placement). Checked and clean: no new module, no new dependency edge (ignition.direct.scheduler already imported from ignition.preparation — scheduler.py:43-44), no new feature flag or config knob, no fallback branch added to admission (refresh_admission_plan at helios/src/scheduler.rs:1610-1618 is untouched).
4. Candidates checked and deliberately NOT flagged
plan_admission's new doc comment (helios/src/scheduler.rs:1544-1545 "Rejects cores that declarecore_parameters" and :1551-1552 "Rejects cores that declare core parameters") partially repeats itself acrossadmit/plan_admission, but both are one accurate line about a non-obvious rejection; keep.- The 12 mechanical
core_parameters: vec![]test-literal additions (e.g. helios/src/server/runtime.rs:3177, 3431, 3976; helios/src/scheduler/*) are forced bySchedulerCapabilitieshaving noDefaultimpl — that is an API-surface question for the Correctness & Contracts lens, not removable code here. helios/src/scheduler/tests.rs:2630-2646(duplicate declarations rejected at construction) vshelios/src/model/tests.rs:138-142(parameterless admission rejected,free_slot_count() == 4) test different stages; not duplicates.scheduler_capabilities(helios/src/model.rs:340, +1 line) is the single existing constructor path; no wrapper was added.ignition/direct/scheduler.py:878-882_cache_key(self, request)is a genuine dead-parameter deletion, not churn — thetokens=Nonepath had no callers in the diff.
Open questions / could not verify
- Whether
docs/TODO.txt:15-16's promise ("close when the qualification notes in docs/api.md and docs/direct-execution.md are updated") was intended to require the inventories added here, or whether one sentence apiece suffices — the PR does not say, and no maintainer comment exists (zero engagement on #621). - Whether
samples()is public API by design (it ispub, used by five in-crate call sites,helios/src/execution/transport.rs:1537 (not opened),1552among them) — if so, §1.1 is strictly a deletion; if it were ever to be renamed, the naming question belongs to its own PR, not this one. - Nothing in the diff shows how CI will exercise
ignition/direct/scheduler.py's changed import path under the CPU workflow added by #608; irrelevant to this lens but noted for the process reviewer.