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

Raw Markdown for agents: https://autobot.eidonix.com/p/1df41929-57df-4a6f-83e4-85136f996dc9.md

#1 [high] GraphKind::samples()/is_text_forward() double name (subsumes the whole manifest.rs change)

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 shows samples()'s own body was exactly this 7-kind matches! on main (only Resume moved position). So samples() and the new pub(crate) is_text_forward() are the same predicate under two names, one of which is a one-line forwarder.

Consequence: the deleted free function is_text_forward_graph (helios/src/model/contract.rs, -14 lines) can simply be replaced at its two call sites by the pre-existing public method:

#2 [high] Test-inventory/qualification prose added to design docs where TODO.txt is the home

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:86-89 (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.

Problem: these are inventories of checks in an API reference and an execution guide. AGENTS.md:57-60: "Record unresolved defects, unrun checks, and pending measurements in docs/TODO.txt, not in design documents." The same fact is already recorded once, with its close criterion, at docs/TODO.txt:10-16 ("Close when those GPU runs pass and the qualification notes in docs/api.md and docs/direct-execution.md are updated"), and the new api.md/direct-execution.md sentences are unverifiable from those documents (no suite paths, no commands). AGENTS.md:118-120 also warns against "exhaustive inventories of ... tests" in supporting detail. Concrete simplification: one sentence in each doc, no 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)." Same for direct-execution.md. Keeps the qualification distinction repo-prose:30-34 requires, drops the duplicate inventory. Also docs/prefix-cache-offload.md:773-785: the rewritten "Admission in two steps" bullet grew 9 -> 13 lines and leaves an over-long line at :781 ("pages and snapshots as if its prefix depth were c, and the scheduler creates or joins"). It can be three sentences: declaring cores must call plan_admission_with_core_parameters; plan_admission/admit are the declaration-free forms and reject a declaring core; both return history + GPU lookup in an AdmissionPlan without reserving.

#3 [high] Research summary

Lens: Subtraction, Simplicity & Conventions. The diff is mostly lean — the core change (declarations move into SchedulerCapabilities, so helios/src/server/runtime.rs loses 36 lines of threaded core_parameter_defs plumbing, +8) is a genuine simplification, and ignition/direct/scheduler.py legitimately deletes its private _wire_fp32/_FP32_MAX copy and the dead tokens=None parameter of _cache_key. Three removable/reducible items remain, saved with verbatim quotes in scratchpad notes 1-2 and summarised here.

  1. GraphKind::is_text_forward() is a second name for the existing samples() — the whole manifest.rs hunk can go. helios/src/execution/manifest.rs:89-104 adds a pub(crate) is_text_forward() whose body is byte-for-byte what samples() had on main, and reduces samples() to self.is_text_forward(). The free function deleted from helios/src/model/contract.rs could instead be replaced at its two call sites by the pre-existing public method (descriptor.kind.is_text_forward() at contract.rs:652 → .samples(); graph.kind.is_text_forward() at helios/src/model/packing.rs:140 → .samples()), leaving manifest.rs untouched. Existing samples() callers (execution/transport.rs:1537 (not opened),1552, manifest.rs:944, model/testing.rs:171 (not opened), server/runtime.rs:2949) already read it as "text-forward/sampling graph", so nothing drifts. The relocation is not needed by the admission fix — it is churn of the kind AGENTS.md:188-193 rules out, and it is the file most likely to conflict with the ten commits that landed after the base.

  2. The new doc paragraphs are check inventories in documents that should not hold them. docs/api.md:768-771 and docs/direct-execution.md:86-89 add "CPU tests cover the wire contract, request decoding, prefix-cache identity, and packing paths, and Kani harnesses cover declaration validation and resolution … remain pending qualification." AGENTS.md:57-60 puts unrun checks and pending measurements in docs/TODO.txt, not design documents, and the same fact plus its close criterion already lives at docs/TODO.txt:10-16 (which itself says to close when "the qualification notes in docs/api.md and docs/direct-execution.md are updated"). Both new passages are also unverifiable from the documents that hold them (no suite paths, no commands). Replace each with one sentence: CPU-tested, GPU not qualified, pointing at docs/TODO.txt. Same section: the docs/prefix-cache-offload.md:773-785 rewrite grew the bullet from 9 to 13 lines and left an over-long line at :781; three sentences carry it (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 and GPU lookup in an AdmissionPlan without reserving).

  3. Minor: the error normalisation in Layout.__post_init__ is now redundant with the helper's own message. wire_fp32(value, label="value") at ignition/preparation/contract.py:15-28 already produces f"{label} must be a finite FP32 number" / f"{label} is outside the finite FP32 range", yet ignition/direct/scheduler.py:120-136 still wraps each call in try/except ValueError to re-raise the generic "core parameter defaults must be finite FP32 values" / "core parameter ranges must be finite and contain their default" with from None, discarding the label (so a bad range["min"] reports only the generic text). Since the parameterless call at scheduler.py:122 passes label="value", the three call sites (:122, :132) can pass label=f"core parameter {name!r} default"/"minimum"/"maximum" and drop the surrounding try/except — same error family the tests already match on, fewer branches. Low value; fine to leave if the messages are considered part of the surface.

Read past the two-digit-line level: plan_admission's new "Rejects cores that declare core_parameters" comment (helios/src/scheduler.rs:1551-1552) duplicates admit's at :1544-1545, but both are accurate and short, so not worth a change. The 12 mechanical core_parameters: vec![] additions in test literals are forced by SchedulerCapabilities having no Default (a breaking-API question for the Correctness/API lens, not a subtraction here). The new negative test at helios/src/scheduler/tests.rs:2630-2646 and the rejection assertions at helios/src/model/tests.rs:138-142 cover different stages (construction vs admission), so they are not duplicates.

#4 [medium] Minor: redundant try/except around wire_fp32 in direct Layout; overall lean verdict

(3) Redundant error normalisation now that wire_fp32 takes a label. ignition/preparation/contract.py:15-28 produces f"{label} must be a finite FP32 number" and f"{label} is outside the finite FP32 range". ignition/direct/scheduler.py:120-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 two try/except blocks discard the specific label and re-raise a generic message; passing label=f"core parameter {name!r} default" / "minimum" / "maximum" at :122 and :132 and deleting both wrappers keeps the same error family (tests at tests/direct/test_scheduler.py:836-843 and 849-856 assert failure, not message text) with two fewer branches. Marked low value: acceptable to leave if the existing message strings are treated as part of the surface. Caveat for whoever applies it: the helper's type gate rejects np.float32/np.int64 (tests/direct/test_scheduler.py:1011-1013), so the wrapper removal must not change acceptance.

Verdict to preserve: the diff is otherwise lean. The core change is a net deletion (helios/src/server/runtime.rs -36/+8 by removing the threaded core_parameter_defs parameter from begin_pool_lookup, admit_with_checkpoint_accounting, admit_with_host_store and four callers), and ignition/direct/scheduler.py legitimately removes its private _wire_fp32/_FP32_MAX duplicate plus the dead tokens=None parameter of _cache_key (now :878-882).

Candidates checked and NOT worth flagging: