Repository navigation
Conversation
A driver can hand over the HTTP requests it made, with their responses (Driver::take_exchanges, Bindings::on_exchanges). The runner marks each with what it was for (setting up, the action, or a check), redacts it and keeps it in the results. The manual shows a step's action request as a curl command with the response it got, where a screenshot would be; the test page also has the requests that set up and checked it. Redaction keeps a short list of headers, turns API keys into $API_KEY (or a name per key), replaces secret-looking query, form and JSON fields, and swaps a loopback origin for $BASE_URL. A JSON body that doesn't parse isn't shown. The invoices example runs a suite against a stand-in API over HTTP, with admin and member keys and an exception only a member meets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Expectation could already drive an API, but its manual had nothing to show for a step except a missing screenshot. Now a driver can hand over the HTTP requests it made, and the manual shows each step's request as a
curlcommand with the response it got, where a screenshot would be.Driver::take_exchanges/Bindings::on_exchangeshand overExchanges (request and response). The runner asks after arranging the start, after each action and after each step's checks, and marks each onesetup,actionorcheck. Requests from looking at where the last test ended (A test starts where the last one ended when its Givens hold there #85) are dropped unless the test continues from there.RunOptions::redactiondecides what is kept, before anything is saved: a short list of headers; API keys as$API_KEYor a name per key ($MEMBER_API_KEY); secret-looking query, form and JSON fields, and any listed infields, readREDACTED; a loopback origin becomes$BASE_URL(orbase_url). JSON bodies are pretty-printed with numbers as written; one that doesn't parse isn't shown. Bodies are capped at 16 KiB.crates/harness/examples/invoices: a suite run against a std-only stand-in invoices API over HTTP, with admin and member keys and an exception only a member meets (403 Forbidden).--buglets members void, to show a failure. The site build publishes its manual.book/src/api.md, plus updates to the driver docs, README andllms.txt.Tests:
crates/story/src/exchange.rscovers redaction, curl and JSON; there's a results round trip; andcrates/harness/tests/exchanges.rsruns the example end to end. It checks the roles, that no key, email, loopback address or dropped header appears anywhere in the published docs or results, the pages, a rebuild from saved results, and a failing run.Not in this PR:
Givenoverrides a Background state, "Before you begin" lists both. This already happens in the existing docs code; the example sidesteps it with a setup phrase.The example's features and stories are marked
Approval: proposed.🤖 Generated with Claude Code