Prefer YAML structures for JSON expectations#23
Merged
Conversation
Avoid making scenario authors embed JSON strings when typed YAML values already deserialize to the JSON comparison model. This keeps examples readable, reduces escaping, and locks the behavior with a focused parser test.
PR #23 documents nested YAML maps/lists as the preferred form for expect_json equals, but left the Unreleased changelog entry and the SCHEMA.md reference untouched. Without them, the scenario-format reference would contradict the README and the release notes would silently omit a documented-behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR #23 rewrote the JSON payload to use single quotes, which made the literal JSON appear verbatim in the PTY echo of the typed command. The expect guard matched the echoed "status" before bash ran, so expect_json raced against a half-emitted buffer and intermittently read [1,2,3] as the tail block (path 'result' does not exist). Gate on JSON_READY_42, produced by $((40+2)) so it appears only in real output, never in echo. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
expect_jsonequalstaking nested YAML map/list values that deserialize to typed JSON comparison values (the form was already accepted; this makes it the documented one).CHANGELOG.md(Unreleased) andSCHEMA.mdso the scenario-format reference and release notes stay in sync with the README.Test plan
cargo testcargo run -- run e2e/scenarios/positive/expect-json.yaml