Skip to content

E.1: RawToolCall.input -> RawArguments(String) newtype (phase 1E; stacked on #24) - #25

Open
cunninghamcard-bit wants to merge 4 commits into
exp/restartfrom
exp/e1-raw-arguments
Open

cunninghamcard-bit wants to merge 4 commits into
exp/restartfrom
exp/e1-raw-arguments

Conversation

@cunninghamcard-bit

Copy link
Copy Markdown
Owner

Phase 1E unit E.1 (A7 table row RawToolCall; RFC-0042:80; arcships#200:2724). Stacked on #24 (E.0) because it uses E.0's samples and comparison test, so this diff includes E.0 until #24 merges. The E.1-only change is commit fb9ba56. It is independent of the 1R stack (#19–#23): no overlapping code.

Change

  • New aimux_core::tool::RawArguments(String), re-exported next to RawToolCall, with #[serde(transparent)]. RawToolCall.input is now RawArguments with #[ts(as = "String")]. It is a newtype, not an enum (docs: full-chain AI SDK alignment design and impact map arcships/aimux#200:2724).
  • API, kept close to String so call sites stay small:
    • new / as_str / into_string / push_str (for the streaming accumulators)
    • From<String> / From<&str> / From<RawArguments> for String
    • Deref<Target = str>, AsRef<str>, Display
    • PartialEq with str / &str / String / serde_json::Value. The Value impl matches String == Value, which existing tests rely on.
  • Call sites in aimux-core, aimux-provider-utils, aimux-providers and tests were converted mechanically: .into() where a String is built, and .to_string() where a String is needed (e.g. tool_input in errors). No behaviour change. 23 files, +171/−70.

Shared acceptance

  • (a) The enum-state samples (fixtures/v4/enum-state/, E.0) still match the 8455db9 baseline byte for byte; all 7 enum_state_wire_test tests pass, including raw_tool_call with the RFC-0042:84-91 vectors. git diff --stat -- fixtures/ contract-tests/fixtures/ aimux-providers/tests/cassettes/ against E.0 is empty.
  • (b) gen_ts_types.py --check: up to date. git diff --stat bindings/ is empty, and RawToolCall.ts has zero diff.
  • (c) git diff 8455db9a -- aimux-core aimux-stream aimux-provider-utils aimux-providers | grep -E '^\+.*serde\((untagged|flatten|tag *= *"(status|kind|state)")': no hits.
  • (d) Hand-written bindings (go/java/kotlin/swift/flutter, wrapper.py): no diff.
  • (f) grep -n 'pub input: String' aimux-core/src/tool.rs: no hits.

Results vs R.0 (local linux x64; clean rerun; test names confirmed in the log)

R.0 (8455db9) E.0 (3a63e66) E.1 (fb9ba56)
cargo test --workspace 2871 / 0 / 7 2878 / 0 / 7 2878 / 0 / 7
fmt --check / clippy -D warnings — ok / ok ok / ok
gen_ts_types.py --check, .ts diff — ok, empty ok, empty
Python pytest 93 pass, 5 fail — 93 pass, same 5 (same KeyErrors)
Node ava (node 22) 87 pass, 1 fail — 87 pass, same 1

Go/Java/Kotlin/Swift/Flutter were not run locally.

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/.
New aimux_core::tool::RawArguments newtype, serde(transparent) and
#[ts(as = "String")] on the field, so the wire and RawToolCall.ts are
unchanged. Not an enum (arcships#200:2724). Provides new/as_str/into_string/push_str,
From<String|&str>, Into<String>, Deref<str>, AsRef<str>, Display and
PartialEq with str/String/serde_json::Value (parity with String). Call sites
in core, provider-utils, providers and tests converted with .into() /
.to_string(); no behaviour change. Enum-state samples still match the
8455db9 baseline byte for byte.
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