#1 [high] Should fix: new TML 30-digit test duplicates the existing kind-parameterized test instead of joining it
helios/src/grammar/strict.rs:3723-3817 qwen_and_glm_strict_parsers_preserve_30_digit_integers is already parameterized over the tool syntax: it loops for (kind, wire) in [ (QwenCoder, ..), (GlmArgumentTags, ..) ] and builds big_schema, validate_strict_tool_schema, OutputConfig, ToolGrammarPlan, the compiler assertion and the raw_args.matches(big).count() == 5 assertion once for every dialect.
The PR adds helios/src/grammar/strict.rs:3819-3922 tml_strict_parser_preserves_30_digit_integers, which re-creates the same big/big_schema (lines 3827-3847), the same validator, the same syn/cfg/env/plan setup, and the same count==5 assertion, ~100 new lines, instead of adding a third row to the existing loop. The only genuinely new wire-specific needs are the invoke/end control-token ids (TML fences a call with <|content_invoke_tool_json|>/<|end_message|> rather than tags) and the fact that this test feeds grammar.advance with real control-token ids instead of the module's accepts_bytes + byte_tokenizer_with path used by the neighbouring strict_wire_grammars_reject_schema_violations_during_generation (strict.rs:4167-4333, whose Case struct carries controls: &'static [&'static str] and an encode() helper that does exactly this marker-to-control-token substitution, lines 4290-4306).
Fix: extend the for (kind, wire) table at 3748 with a TmlJson row (wire = format!("audit<|content_invoke_tool_json|>{{\"name\":\"audit\",\"args\":{{...}}}}<|end_message|>")), select the TML control markers for that row, and assert accepts_bytes(...) the same way, which also gains the negative case the new test lacks. That removes ~90 duplicated lines (repository rule: "Reject unsupported abstractions and churn ... Refactoring must directly support the requested behavior", AGENTS.md:188-193; and the "duplicate kernels/mechanisms" preference in spirit).
Note the new test also drops the negative assertion the sibling has (it never checks that a schema-violating payload is rejected for TML; only tests/server/protocol/tests.rs:2163 covers that).
#2 [high] Should fix: new Inkling2 server test bypasses the module's own request fixtures and its parametrized two-effort sweep
tests/server/test_inkling2.py:29-68 defines a module service fixture that (a) is parametrized params=[None, "none"] so every test runs at default effort and zero effort, (b) wraps urllib.request.urlopen in try/except urllib.error.HTTPError and turns it into pytest.fail(f"HTTP {code}: ..."), (c) asserts usage.completion_tokens == len(token_ids), (d) sends seed=1234, return_token_ids=True, and (e) applies the fixture's reasoning_effort choice. Every other test in the file (e.g. :106-118 test_tml_tool_call_and_result) goes through it.
The new test_strict_tml_tool_calls_and_truncation (tests/server/test_inkling2.py:121-209) departs from that precedent: it re-reads /v1/models itself (:122-123), and makes four of its six requests with raw urllib.request.Request + urlopen (:155-169, :176-192, :194-209) with no HTTPError handling, no seed, and reasoning_effort/reasoning.effort hardcoded to "none". Because it hardcodes zero effort, the fixture's default-effort parameter is never exercised for the strict path, even though the PR body claims "default effort and zero effort" coverage; because it bypasses the error wrapper, an HTTP 500 (exactly the failure this PR fixes) surfaces as an unhandled HTTPError rather than the file's diagnostic pytest.fail with the response body — which is the information a reviewer needs when the regression reappears.
Fix: factor the /v1/responses POST out of the fixture (or add a second small helper next to ask), and route all six requests through the fixture so effort is parametrized and errors carry the body. The buffered/streamed strict assertions at :136-152 already use service and should stay as the template.
#3 [high] Should fix: PR claims the docs/TODO.txt TMLv0 strict-qualification item is satisfied but leaves it open
docs/TODO.txt:5-8 holds the open item this PR claims to close:
[ ] 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)"), yet pr_files shows only helios/src/output/tml.rs, helios/src/grammar/strict.rs and tests/server/test_inkling2.py changed — the TODO entry is untouched.
AGENTS.md:512-517: "Use docs/TODO.txt for miscellaneous follow-up items. Keep entries brief and link to detailed design or performance notes when needed. Update or remove entries as work is completed." AGENTS.md:55-60 likewise requires unresolved defects/checks to be recorded there rather than in design docs.
Fix: remove the entry in the same PR, or narrow it to whatever remains unqualified (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.
Related, lower priority: docs/api.md:588-605 documents the strict TMLv0 acceptance contract and docs/api.md:624-628 the buffering/truncation behaviour, but neither states that argument text is preserved verbatim (order, >64-bit integers) rather than re-serialized. The claim in the PR body ("key order and exact JSON argument text verbatim") is user-visible in tool_calls[].function.arguments, so one sentence there would fit the file's existing level of detail. This is optional; the code change alone does not contradict any documented statement.
#5 [high] Research summary
Reviewed PR #575 through the conventions-and-duplication lens. All three changed files were read in context (helios/src/output/tml.rs, helios/src/grammar/strict.rs, tests/server/test_inkling2.py), together with the project rules (charter, AGENTS.md, docs/design-review.md) and the closest precedents in the same layer (dsml.rs, chatml.rs, argument_tags.rs, gemma_call.rs, recipient.rs, xtml.rs, tagged.rs, frontend/mod.rs, server/output.rs, docs/api.md, docs/TODO.txt).
Three findings recorded in the scratchpad (two "should fix", plus one verification note):
-
Should fix — duplicated test fixture. The new
tml_strict_parser_preserves_30_digit_integers(strict.rs:3819-3922) re-creates thebig/big_schema, validator, config, plan and count==5 assertions of the existing, already dialect-parameterizedqwen_and_glm_strict_parsers_preserve_30_digit_integers(strict.rs:3723-3817) instead of adding a third row to that loop; the neighbouringstrict_wire_grammars_reject_schema_violations_during_generation(strict.rs:4167-4333) already provides the exactCase{controls}/encode()machinery this test hand-writes. It also drops the negative assertion the sibling dialect test has. -
Should fix — server test bypasses the module's own fixture.
test_strict_tml_tool_calls_and_truncation(test_inkling2.py:121-209) re-reads/v1/modelsand issues four of six requests with rawurllibinstead of the module'sservicefixture (:29-68), which is effort-parametrized, wraps HTTPError into a diagnosticpytest.fail, and pinsseed. Consequently the strict path never runs at default effort (contradicting the PR's "default effort and zero effort" claim) and a reappearing HTTP 500 would surface as an unhandled exception without the response body. -
Should fix — the tracking item the PR claims to close is untouched. docs/TODO.txt:5-8 is the TMLv0 strict-qualification entry; the PR claims qualification but does not modify it, against AGENTS.md:514 ("Update or remove entries as work is completed").
The new RawCall<'a>/&RawValue wrapper itself follows the repo's existing precedent (frontend/mod.rs:250-259 RawSegment) and duplicates no existing helper — tagged.rs's RawArguments/container_parameter serve tag dialects that must synthesize the argument object, which TMLv0 does not. The unchanged tool["function"]["name"] lookup matches recipient.rs:152/:257. No behavioural regression found in the parser path.
#6 [high] Summary: PR #575 conventions/duplication review — 3 findings, no parser defects
PR #575 "Preserve raw JSON tool arguments in TmlOutput for strict TMLv0 calls" (3 files, +237/−10: helios/src/output/tml.rs, helios/src/grammar/strict.rs, tests/server/test_inkling2.py). Lens: conventions and duplication. Rules consulted: charter (read_charter), AGENTS.md (lines 88-140 required PR description; 155-207 contribution scope/rejection criteria, esp. 188-193 "Reject unsupported abstractions and churn"; 485-510 validation; 512-517 task tracking), docs/design-review.md (principles 12, 15, 16), .agents/skills/repo-prose/SKILL.md referenced by AGENTS.md:43-50.
FINDINGS, in report order (all "should fix"; no blocking finding):
-
Duplicated test fixture — helios/src/grammar/strict.rs:3819-3922 (new
tml_strict_parser_preserves_30_digit_integers) vs strict.rs:3723-3817 (qwen_and_glm_strict_parsers_preserve_30_digit_integers, already loopsfor (kind, wire) in [(QwenCoder,..),(GlmArgumentTags,..)]). ~90 duplicated lines: identicalbig/big_schema(3827-3847), validator, syn/cfg/env/plan, andraw_args.matches(big).count()==5(3917-3921 vs 3811-3815). Wire-specific machinery already exists in strict.rs:4167-4333 (Case{controls},encode()at 4290-4306). Fix: add a TmlJson row to the 3748 table + select CONTROL_MARKERS, asserting viaaccepts_bytes. Also note the new test has no negative case (only server/protocol/tests.rs:2163 covers TML rejection). Citation: AGENTS.md:188-193. -
Server test departs from the module's fixture — tests/server/test_inkling2.py:121-209 vs the
servicefixture at :29-68 (effort-parametrizedparams=[None,"none"], HTTPError→pytest.failwrapper at :60-61,seed=1234,return_token_ids=True). New test re-reads /v1/models at :122-123 and hand-rolls foururllib.request.Requestcalls at :155-169, :176-192, :194-209 with no HTTPError handling and hardcodedreasoning_effort/reasoning.effort= "none" (:162, :183, :201). Consequence: the fixture's default-effort parameter never runs for the strict path (PR body claims "default effort and zero effort"), and a reappearing HTTP 500 surfaces as an unhandled exception without the body. Fix: add a /v1/responses helper besideaskand route all six requests through the fixture. -
Tracking item not updated — docs/TODO.txt:5-8 asks for exactly this qualification ("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");
pr_filesshows docs/TODO.txt untouched. Citation AGENTS.md:514 ("Update or remove entries as work is completed"). Secondary/optional in the same note: docs/api.md:588-605 and :624-628 document the strict TMLv0 contract and its buffering but not verbatim argument preservation (order, >64-bit integers), which is the user-visible claim of the PR.
VERIFIED CLEAN (say so plainly in the report):
RawCall<'a>(tml.rs:330-338) with#[serde(deny_unknown_fields)]+#[serde(borrow)] args: &'a RawValuematches the repo's only other such struct, frontend/mod.rs:250-259RawSegment<'a>(alsodeny_unknown_fields+ borrowed&RawValue). Precedent, not invention.- No existing helper duplicated:
RawArguments/strict_nonstring_raw/container_parameterin tagged.rs:806-904 exist because tag dialects must synthesize the argument object from<arg_key>/<parameter>tags; TMLv0 receives the object as JSON text, so sharing would force TML through tag parsing. - The
tools.iter().any(|tool| tool["function"]["name"] == parsed.name)check (tml.rs:341-345) is unchanged from pre-PR and identical to recipient.rs:152/:257; tml.rs is the outlier vs chatml.rs:100-103 / argument_tags.rs:41-44 / gemma_call.rs:128-132, but it was already — not attributable to this PR. - Behaviour note (not a defect): the object check became textual (
args.trim().starts_with('{'), tml.rs:339-340) so leading/trailing whitespace inside the raw value is trimmed; downstream re-parsing at server/output.rs:113-121 and protocol/encode.rs:294-300 still enforcesis_object(). Order and interior spacing now preserved, which is the intent; no documented behaviour contradicts it.
#4 [medium] Verified: the raw-value wrapper follows the frontend RawSegment precedent, and no existing helper is duplicated
Checked the new RawCall<'a> struct in helios/src/output/tml.rs:330-338 against the nearest precedents and it follows them:
#[derive(Deserialize)] #[serde(deny_unknown_fields)] struct RawCall<'a> { name: String, #[serde(borrow)] args: &'a RawValue }mirrors helios/src/frontend/mod.rs:250-259struct RawSegment<'a> { #[serde(borrow)] text: &'a RawValue, allow_special: bool, image_index: Option<usize> }, which is the repo's existing idiom for "validate the wrapper's keys, keep one field's bytes exactly". Only two#[serde(borrow)]uses exist in helios/src and this is the second, so it is a precedent, not an invention.- The tool registry lookup
self.tools.iter().any(|tool| tool["function"]["name"] == parsed.name)(tml.rs:341-345) is unchanged from the pre-PR code and matches helios/src/output/recipient.rs:152 and :257 verbatim; the sibling dialects use thefilter_map(|t| t.get("function")).find(...)form (chatml.rs:100-103, argument_tags.rs:41-44, gemma_call.rs:128-132, minimax_xml.rs:166). tml.rs is the outlier here but it was already, so the PR does not add a new divergence — not a finding against this PR. - The
argsobject check changed fromobject.get("args")?.is_object()toparsed.args.get().trim().starts_with('{')(tml.rs:339-340). That is the only way to keep the bytes raw, so it is not duplication oftagged.rs'scontainer_parameter/strict_nonstring_raw(tagged.rs:846-904) orRawArguments(tagged.rs:806-844): those exist because tag dialects must synthesize the argument object from<arg_key>/<parameter>tags, whereas TMLv0 receives the whole object as JSON text. No shared helper could serve both without forcing TML through tag parsing.
One behavioural note worth knowing (not a defect): because the check is now textual, args with leading whitespace inside the raw value (e.g. "args": {"a":1}) is accepted and the emitted ToolArguments text is trimmed at both ends; the old path would have emitted {"a":1}. Helios then re-parses the text for is_object() at helios/src/server/output.rs:113-121 and at encode.rs:294-300, so both accept it. Order and interior spacing inside the object are now preserved verbatim, which is the intent.