#1 [high] PR 704 audit: docs/api.md claims verified against helios grammar admission
PR 704 (docs/api.md only per pr_files, +17/-0). Head 77941c4.
VERIFIED TRUE (all citations at head):
- 42-keyword parity: grammar.rs:913 traversal arm ($defs, definitions, properties, patternProperties), :924 (anyOf, oneOf, allOf, prefixItems), :935 (items-as-array), :940 (items, additionalItems, additionalProperties), :943-948 leaf arm (12 + 30 = 42). Recount: 12 metadata + 29 structural/constraint + leaf arm also has const,enum,type,minItems,maxItems,required,minProperties,maxProperties,minLength,maxLength,pattern,format,minimum,maximum,exclusiveMinimum,exclusiveMaximum,multipleOf = 17 -> 11+17=28? reconciled as: structural set incl. additionalItems = 29, metadata = 13, total 42. Zero missing/extra/dupes.
- $ref same-document: grammar.rs:902-912
reference.starts_with('#'), else "must reference the same document". - Bounds: MAX_GRAMMAR_BYTES=262_144, MAX_SCHEMA_NODES=8_192, MAX_SCHEMA_DEPTH=64 (grammar.rs:23-25); byte check grammar.rs:209 (>262_144 fails); node/depth grammar.rs:884 (
depth > 64 || *nodes > 8192). Exact boundaries match doc wording ("exceeding"). - 4 surfaces: decode.rs:466-506 Responses text.format; decode.rs:560-579 Messages output_config.format / Chat+Completions response_format. phase_tests.rs:8874-8903 proves 400 invalid_grammar on all four.
- error.type stays invalid_request_error on 400: protocol/mod.rs:34-43 (
_ => invalid_request_error) + server.rs:733-741 (Admission non-Cap/Unavail -> BAD_REQUEST); error.code only overwritten for non-Messages (protocol/mod.rs:53-59) — doc correctly excludes Messages. - uniqueItems/nullable/x-guidance rejection: test grammar.rs:1619-1643.
NON-FINDINGS checked: validate_schema_nodes boolean short-circuit (grammar.rs:890) not a hole; no structured-output path bypasses validator (request.rs:286-299, request.rs:284, strict.rs:1515-1529 all validated); serde_json 128-depth parse limit means to_string() at :209 cannot stack-overflow before depth gate; no hot path (blocking prep pool only).
PRECISION NOTES (not code bugs): accepted keyword != compiles — format:"not-a-format", minLength:-1, minimum>maximum, ambiguous oneOf all still 400 (grammar.rs:1623-1630); byte bound is on compact re-serialization schema.to_string(), not caller wire bytes.
SCOPE DISCREPANCY: pr_diff(full) contains AGENTS.md, docs/TODO.txt, docs/cli-design.md, docs/core-design.md, docs/model-preparation.md, docs/scheduling-runtime-design.md, flare-cli/src/cli.rs (new debian man-page test), flare-cli/src/orbit/agent.rs. pr_files says 1 file. search_history failed: "Could not read c513e46a... Failed to traverse parents of commit ef38cb9395" (shallow clone). Not audited (out of declared scope); fixture packaging/debian/flare.1 + .SH COMMANDS at :12 exists.
#2 [high] Exact keyword recount (corrected): 29 structural + 13 metadata = 42
Corrected enumeration at head 77941c4 (supersedes the muddled recount in entry 1).
grammar.rs:902 $ref (1)
grammar.rs:913 $defs, definitions, properties, patternProperties (4)
grammar.rs:924 anyOf, oneOf, allOf, prefixItems (4)
grammar.rs:935 items array-form (1)
grammar.rs:940 items, additionalItems, additionalProperties (3)
grammar.rs:943-948 leaf arm (30): $anchor $schema $id id $comment title description default readOnly writeOnly examples contentMediaType contentEncoding const enum type minItems maxItems required minProperties maxProperties minLength maxLength pattern format minimum maximum exclusiveMinimum exclusiveMaximum multipleOf
Unique total = 1+4+4+3+30 = 42.
Doc structural/constraint list (docs/api.md:931-936) = 29: $ref $defs definitions type const enum anyOf oneOf allOf properties patternProperties additionalProperties required minProperties maxProperties items prefixItems additionalItems minItems maxItems minLength maxLength pattern format minimum maximum exclusiveMinimum exclusiveMaximum multipleOf. Doc metadata list (docs/api.md:936-939) = 13: $anchor $schema $id id $comment title description default readOnly writeOnly examples contentMediaType contentEncoding. 29 + 13 = 42, exact 1:1 with code, zero missing, zero extra, zero duplicates. PR's parity validation claim is CORRECT.
#3 [high] Final verdict: clean, no code findings; protocol trace summary
VERDICT: no Blocker/Major/Minor code defect found. docs/api.md hunk is prose; every factual claim traces 1:1 to helios code at 77941c4 (keyword parity 42/42, $ref '#' guard grammar.rs:905, bounds grammar.rs:23-25/209/884, four protocol surfaces decode.rs:466-506/560-579, 400+invalid_request_error+typed code protocol/mod.rs:33-59 + server.rs:733-755, error.code correctly omitted for Messages).
Where the 4-part protocol was applied and found sound:
- callee/enum resolution: Protocol::error/Protocol::failure (mod.rs:33-59) vs status()/error_code() (server.rs:733-755) — domains consistent, no dead guard; AdmissionError::Grammar resolves to 400 via the
Error::Admission(_)arm. - order-of-operations: grammar admission runs inside spawn_blocking before SSE headers are written (http.rs:209-285, early return 288-292), so streaming requests also get HTTP 400 not a terminal SSE error — matches doc line 264-267 distinction. Mid-generation parser poisoning fail() (grammar.rs:868-874) is a separate 500 output-validation path, also documented separately at line 256.
- adversarial boundaries: depth==64 and nodes==8192 pass; 65/8193 fail (
>not>=) — doc's "exceeding ... depth 64 / 8,192 nodes" is exact. 262,144-byte boundary exact. Boolean schema short-circuit at grammar.rs:890 precedes the object cast, so no false rejection. - hot path: none touched; validation runs once per request on the blocking preparation pool, O(nodes) with the 8,192-node cap; byte check at :209 is one linear serialization per request.
Only caveats worth the report: (a) allowlisted != compiles (format:"not-a-format", minLength:-1, minimum>maximum, ambiguous oneOf still 400 per grammar.rs:1623-1630) so "accepted" can be read too strongly; (b) the 262,144-byte bound measures compact re-serialization of the decoded value, not caller wire bytes. Neither is a defect in the diff.