Skip to content

E.0: enum-state shared wire samples + 8455db9a baseline; add A7 (phase 1E) - #24

Open
cunninghamcard-bit wants to merge 2 commits into
exp/restartfrom
exp/e0-enum-state-samples
Open

cunninghamcard-bit wants to merge 2 commits into
exp/restartfrom
exp/e0-enum-state-samples

Conversation

@cunninghamcard-bit

@cunninghamcard-bit cunninghamcard-bit commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Phase 1E unit E.0 (A7; D2/D25/D26). Branches from exp/restart@8455db9a and is independent of the 1R stack (#19–#23): it touches no code those PRs change. Test and fixture additions only; no library code changed.

Added

  • docs/amendments/A7-enum-state-modeling.md: a verbatim copy of the plan's A7 (cmp identical), including the D25/D26 decisions and the 2026-10-11 corrections.
  • fixtures/v4/enum-state/*.jsonl shared samples. Each line is one compact JSON value, with keys in the Rust serialization order so the comparison can be byte for byte.
    • tool_call (15 rows): dynamic absent/false/true × providerExecuted absent/true/false; invalid:false with and without dynamic; Dynamic+invalid:true+error (also with providerExecuted/providerMetadata); and providerMetadata.
    • tool_call_rejected (3 rows, D26): invalid:true without dynamic, with dynamic:false, and without error. They are accepted at 8455db9; E.2's try_from must reject them.
    • tool_result (8 rows): dynamic absent/false/true; isError and preliminary true/false; and providerMetadata.
    • raw_tool_call (18 rows): the RFC-0042:84-91 rows 1–6 as provider input text, reused from 1.3's tool-input-vectors.json (on exp/u1.3-tool-input-vectors, not on 8455db9). Includes "" and {"a":, plus dynamic × providerExecuted three-state.
    • stream_tool_input_start / text_stream_tool_input_start (10 rows each): dynamic × providerExecuted three-state, plus title.
  • normalized/ is generated per the A7 D25 table:
    • ToolCall: dynamic:false and invalid:false are dropped.
    • ToolInputStart: dynamic is always written as a boolean.
    • providerExecuted passes through everywhere.
    • RawToolCall is identity.
    • ToolResult is identity for now. At 8455db9 ToolResult has no providerExecuted field, so the client-vs-provider split in A7's E.3 correction can't be read from it. E.3 must decide that and update normalized/tool_result.jsonl.
  • baseline/ holds the round-trip output recorded at 8455db9 (AIMUX_BLESS_ENUM_STATE=1).
  • gen_samples.py documents how the samples and normalized/ were produced.
  • aimux-core/tests/enum_state_wire_test.rs (7 tests): serialize(deserialize(line)) is compared byte for byte with baseline/, and normalized/ is checked to be a round-trip fixed point. baseline_equals_samples shows that at 8455db9 every sample round-trips unchanged. Later units point the comparison at normalized/ where D25 changes the output.

Results vs R.0 (local linux x64; the 7 new test names appear in the log)

R.0 (8455db9) E.0 (3a63e66)
cargo test --workspace 2871 / 0 / 7 2878 / 0 / 7
fmt --check / clippy -D warnings — ok / ok
gen_ts_types.py --check / bindings/node/src/types diff — n/a (no type change) / empty
hand-written bindings diff — empty
untagged/flatten/new tag in new code — none

The Python and Node bindings were not re-run because no library code changed. Go/Java/Kotlin/Swift/Flutter were not run.

Update (684c8b9): review fixes

  • Core-side RFC-0042:84-93 samples. tool_call.jsonl adds the parsed values:

    • string "Tokyo"
    • string "{\"x\":1}", which stays a string and is not turned into an object
    • 123, true, null
    • last-wins {"a":2} and 100.0
    • empty text and {"a": as invalid dynamic calls with an error, never {}
  • Comparison rules. Provider raw text (raw_tool_call.jsonl) is compared byte for byte. tool_call_semantic.jsonl holds the non-canonical spellings ({"a":1,"a":2} and 1e2) and is compared by JSON semantics with normalized/tool_call_semantic.jsonl (new test tool_call_semantic_samples_match_by_json_value). The baseline was re-blessed at 8455db9 code: existing lines are unchanged and the new lines are appended.

  • check_normalized now asserts the line counts are equal before zipping.

  • Bless mode (AIMUX_BLESS_ENUM_STATE=1) skips baseline_equals_samples, because the other tests are rewriting the baseline at that moment.

  • Deferred to E.3a:

    • the tool_result D25 normalization: dynamic is always written as a boolean for client-executed results and passed through for provider-executed ones;
    • providerExecuted ToolResult samples, including a provider-executed result without dynamic.

    At 8455db9 ToolResult has no providerExecuted field, so normalized/tool_result.jsonl stays identity here.

  • enum_state_wire_test: 8 tests pass. The full workspace wasn't re-run for this fix (expected 2879 / 0 / 7 = 2878 + 1).

fixtures/v4/enum-state/: JSONL samples for ToolCall, ToolResult, RawToolCall
and StreamPart/TextStreamPart tool-input-start (absent / explicit false /
true, providerExecuted true/false/absent, invalid+error, D26 rejected inputs,
RFC-0042:84-91 vectors as RawToolCall input), normalized/ per A7 D25, and
baseline/ recorded at 8455db9. aimux-core/tests/enum_state_wire_test.rs
compares serialize(deserialize(line)) byte for byte with the baseline and
checks normalized/ is a round-trip fixed point. A7 copied verbatim into
docs/amendments/.
tool_call.jsonl gains the RFC-0042:84-93 core values (string "Tokyo", string
"{\"x\":1}" kept a string, number, bool, null, last-wins {"a":2}, 100.0)
and empty text / {"a": as invalid dynamic calls with an error (never {}).
tool_call_semantic.jsonl holds the non-canonical spellings (duplicate key,
1e2), compared by JSON semantics. check_normalized asserts line counts before
zipping; baseline_equals_samples is skipped in bless mode. Baseline re-blessed
at 8455db9 (existing lines unchanged; new lines appended).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant