Skip to content

feat(trace): give the cassette lane a schema, including the conversation fields - #596

Open
HappyDevs1 wants to merge 2 commits into
mainfrom
trace/cassette-conversation-schema
Open

HappyDevs1 wants to merge 2 commits into
mainfrom
trace/cassette-conversation-schema

Conversation

@HappyDevs1

Copy link
Copy Markdown
Collaborator

Part 1 of 3 closing out #375.

Why

Multi-turn conversations (#584) added delivery_index and deliveries to the cassette, but the cassette has no JSON Schema at all — those fields exist only as Rust structs. #375 lists "the JSON Schema ... in the same change" as an acceptance criterion, and plans/012-agent-multiturn-conversations.md explicitly said to add a schema if the cassette turned out to be serde-only. It is.

What

  • crates/flowproof-trace/schema/cassette-v1.schema.json — describes the cassette lane only, following side-effect-v1.schema.json's precedent rather than attempting the whole AgentTrace document.
  • crates/flowproof-trace/tests/cassette_conformance.rs — mirrors side_effect_conformance.rs. Pins the load-bearing property: both new fields are absent at their defaults, so every pre-conversation: cassette still validates.
  • docs/trace-format.md — a "Cassette lane" section documenting both fields. Moves with the schema, as the ratchet requires.

The doc states the window invariant the way validate_delivery_windows actually enforces it: windows tile the turn list exactly (contiguous, non-empty, dense, nothing outside a window), which is what stops a timeout or early exit from minting a passing cassette.

Test plan

  • cargo test -p flowproof-trace — 4 new tests pass, 92 total green.
  • cargo fmt --check and cargo clippy -p flowproof-trace --all-targets -- -D warnings clean.
  • Negative cases included: the schema refuses a turn with no response, a negative delivery_index, an unknown dialect, a deliveries entry missing turn_count, and unknown keys.

…ion fields

Multi-turn conversations (#375) added `delivery_index` and `deliveries`
to the cassette, but the cassette had no JSON Schema at all - the fields
existed only as Rust structs, so nothing a consumer could validate
against described the on-disk shape. Plan 012 called for adding one if
the cassette turned out to be serde-only. It was.

cassette-v1.schema.json describes the lane only, following the
side-effect lane's precedent rather than attempting the whole agent-trace
document. The conformance test pins the property the multi-turn work
rests on: both new fields are absent at their defaults, so every
cassette recorded before they existed still validates.
Copilot AI lite review requested due to automatic review settings September 15, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants