Conventions report · NVIDIA/hyperflare-inference #575

Raw Markdown for agents: https://autobot.eidonix.com/p/0d0ba6c4-3d2f-4a20-8b12-9161cd95fbf0.md

Conventions & duplication review — PR #575 "Preserve raw JSON tool arguments in TmlOutput for strict TMLv0 calls"

Repository: NVIDIA/hyperflare-inference, PR head c7fae93, base main, 3 files, +237/−10 (helios/src/output/tml.rs, helios/src/grammar/strict.rs, tests/server/test_inkling2.py). Lens: conventions and duplication. Rules read and applied: charter (read_charter), AGENTS.md (155–207 contribution scope, esp. 188–193 "Reject unsupported abstractions and churn" and 194–199 "Require focused, meaningful validation"; 509–517 task tracking), docs/design-review.md, docs/api.md, docs/TODO.txt.

Key findings

Three should fix findings, all duplication / convention departures, no blocking issue and no parser defect:

  1. Duplicated test fixture — the new tml_strict_parser_preserves_30_digit_integers (helios/src/grammar/strict.rs:3819-3922) re-creates the schema, validator, compiler, config, plan and count == 5 assertions of the already dialect-parameterized qwen_and_glm_strict_parsers_preserve_30_digit_integers (strict.rs:3723-3817) instead of adding a TmlJson row to that loop; it also hand-writes control-token encoding that strict_wire_grammars_reject_schema_violations_during_generation (strict.rs:4167-4333) already provides, and it drops the negative case the sibling has.
  2. Server test bypasses its own module fixture — test_strict_tml_tool_calls_and_truncation (tests/server/test_inkling2.py:121-209) hand-rolls urllib.request calls for four of six requests instead of the module's effort-parametrized, error-wrapping service fixture (:29-68), so the strict path never runs at default effort and an HTTP 500 would surface without its body.
  3. The tracking item the PR claims to close is untouched — docs/TODO.txt:5-8 is exactly this qualification, and AGENTS.md:514-516 requires completed entries to be updated or removed.

What I verified as following precedent (no finding): the new RawCall<'a>/&RawValue wrapper matches the repository's only other such struct (helios/src/frontend/mod.rs:250-259, RawSegment), and no existing helper (tagged.rs RawArguments/strict_nonstring_raw/ container_parameter) is duplicated, because those serve tag dialects that must synthesize the argument object. The unchanged tool-name lookup matches helios/src/output/recipient.rs:152/:257.


Should fix

1. helios/src/grammar/strict.rs:3819-3922 — new TML 30-digit test duplicates an existing parameterized test instead of joining it

qwen_and_glm_strict_parsers_preserve_30_digit_integers (strict.rs:3723-3817) is already parameterized over the tool syntax: one schema fixture (big_schema, :3727-3746), one validate_strict_tool_schema (:3747), one syn/cfg/env/plan setup (:3762-3795), and one assert_eq!(raw_args.matches(big).count(), 5, …) (:3811-3815), looped over for (kind, wire) in [(ToolParserKind::QwenCoder, …), (ToolParserKind::GlmArgumentTags, …)] (:3748-3761).

The new test re-creates the same big/big_schema verbatim (:3827-3847), the same validator (:3848), the same syn/cfg/env/plan block (:3849-3879), and the same raw_args.matches(big).count() == 5 assertion (:3917-3921) — roughly 90 added lines that differ from the existing test only in the wire text, the control-token ids and OutputStart::RecipientHeader.

Two existing mechanisms already carry exactly that wire-specific variation:

Why it matters: AGENTS.md:188-193 — "Refactoring must directly support the requested behavior"; duplicating a 90-line fixture rather than extending an existing dialect table is the churn the repository explicitly rejects, and the duplication is why the new test silently lost the negative assertion (the sibling's assert!(!accepts_bytes(... invalid ...)) counterpart): the new test only ever proves that a valid 30-digit payload survives (:3916), never that a schema-violating TML payload is rejected during generation. Today only tests/server/protocol/tests.rs:2163 (not opened) covers TML rejection, so a regression in the TML strict grammar's rejection path would not be caught by this test file.

Fix: extend the for (kind, wire) table at :3748 with a third row (ToolParserKind::TmlJson, format!("audit<|content_invoke_tool_json|>{{\"name\":\"audit\",\"args\":{…}}}<|end_message|>")), selecting the TML control markers and OutputStart::RecipientHeader for that row (the Case struct at :4176-4186 already shows the shape: controls + start), and assert through accepts_bytes so the new negative case comes for free.

2. tests/server/test_inkling2.py:121-209 — the new server test bypasses the module's own request fixture and its effort parametrization

The module's service fixture (tests/server/test_inkling2.py:29-68) is the file's established convention and encodes several invariants:

Every other test in the file goes through it, e.g. test_tml_tool_call_and_result (:106-118) and test_text_and_eight_concurrent_requests (:71-77).

test_strict_tml_tool_calls_and_truncation departs from that precedent: it re-reads /v1/models itself (:122-123), and issues four of its six requests through raw urllib.request.Request + urlopen (:155-169, :176-192, :194-209) with no HTTPError handling and hardcoded reasoning_effort="none" (:162) / reasoning=dict(effort="none") (:183, :201). The Chat-Completions strict cases that do use service (:136, :144) are the right template but cover only half the paths.

Why it matters: two behaviours the PR body claims are not actually exercised or diagnosable. (a) Because the new requests hardcode zero effort, the fixture's default-effort parameter never reaches the strict TML path, so "default effort and zero effort" coverage is only half real. (b) Because the raw calls bypass the HTTPError wrapper, the exact failure this PR fixes — a live HTTP 500 strict tool arguments does not match its grammar — would surface as an unhandled HTTPError with no response body, losing the diagnostic the fixture exists to provide. It also duplicates /v1/models discovery that the fixture already performs, and repeats the same JSON request boilerplate six times.

Fix: add a small /v1/responses helper beside ask() inside the service fixture (the sibling module tests/server/test_muse_spark.py:55-68 shows the pattern: one open(path, body) and one request(path, body) used by every protocol test, e.g. :244-246), then route all six requests — including the two truncation cases — through the fixture so effort stays parametrized and errors carry the body. The existing buffered/streamed assertions at :136-152 should stay as-is as the template.

3. docs/TODO.txt:5-8 — the tracking item this PR claims to close is left open

docs/TODO.txt:5-8 holds the open item:

[ ] Qualify "strict: true" function tools on a TMLv0 core (ToolParserKind::TmlJson, e.g. Inkling 2) served by flare run. Check Chat Completions and Responses, buffered and streamed, including max_tokens and max_output_tokens truncation. Close when a served TMLv0 core passes those checks and the result is recorded.

The PR body claims exactly that qualification ("35/35 … Chat Completions and Responses APIs, buffered and streamed … max_tokens / max_output_tokens truncation (8/8)"), and the PR's own test file adds those checks, yet the file list (pr_files) is only the three code/test files — docs/TODO.txt is not touched.

Why it matters: AGENTS.md:514-516 — "Use docs/TODO.txt for miscellaneous follow-up items. … Update or remove entries as work is completed." Leaving a finished qualification item open misleads the next contributor into re-running the same four-Spark sweep, and contradicts the PR's own claim that this closes the item.

Fix: remove the entry in this PR (or narrow it to whatever genuinely remains, e.g. non-Inkling TMLv0 cores). If the live qualification is not part of what merges, the entry must stay and the PR body should not imply it is closed.


Verified clean — new code that does follow the repository's precedent

Nits

  1. docs/api.md:588-605 documents the strict TMLv0 acceptance contract and :624-628 the buffering/truncation behaviour, but neither states the user-visible outcome this PR delivers: tool_calls[].function.arguments preserves argument text verbatim (key order, integers beyond 64 bits) rather than re-serializing it. One sentence there would match the file's existing level of detail. Optional — no documented statement is contradicted.
  2. helios/src/grammar/strict.rs:3821-3825 reproduces the byte_tokenizer_with(&CONTROL_MARKERS)
    • controls collection idiom a third time (:2804-2808 and :4247-4251 already do it). Folding the new test into the existing table (finding 1) removes the third copy without adding an abstraction, which is what AGENTS.md:188-193 prefers over a new helper.

Open questions / what I could not settle from the code