The browser page becomes a playground: one refund you can break six ways, on the released wheel - #107
Merged
Merged
Conversation
…ays, on the released wheel `/try-it` was a button and a transcript: real Python, the real wheel, and nothing for the reader to do but watch. Now it is one protected refund under one policy, with an amount, a payment id, a *lose the reply* switch, a *Refund* button and an *Approve* button that is the human. Every line in the box is `ctrlrun`'s own: the page's Python is a module over the public API — `Control`, `InMemoryStateStore`, `LocalApprovalProvider`, `Policy.from_yaml`, `@protect`, `context`, `with_approval` — defining one `step(request_json) -> result_json`, and the JavaScript owns the DOM and nothing else. An approval is `grant_approval` on the store, the write `ctrlrun approve` makes; there is no auto-approve and no dry run, and a test asserts the module has one way to grant. The module is a JSON array in `try-it.js`, beside the demo's, read out by the same regex the Node harness uses. That shape is the point: `tests/test_docs_travelling.py` now runs the page's Python natively through the six steps the page tells the reader to try — allowed; `ApprovalRequired` then `ApprovalMismatch` then executed on the same approval; `consumed`; `ActionDenied` with no request; `AMBIGUOUS` then a refused retry with one remote call; `DuplicateEffect` — and asserts each outcome on every commit, with no Node and no network. That is the check this page lacked when a syntax error shipped past two green harnesses. Mutation: reporting the refused retry as `executed` fails the sequence test and the outcome-vocabulary test. `verify-browser-demo.mjs` drives the same sequence under Pyodide 314.0.6 on the released 0.5.0 wheel, then the five scenarios, and writes `browser-demo.verified.json`; the page's quoted date and versions are held to that record rather than typed. `verify-browser-wiring.mjs` clicks every control under jsdom with Pyodide stubbed and checks which request each builds, when *Approve* appears, and that letters in the amount field are refused on the page rather than sent as €0. Both ran today, every check true. The page: the policy, the panel, "Try this, in order", the demo button under it, and the transcript and verification prose folded into accordions. Home and README CTAs say what the page now lets you do. CLAIMS.md gains the section; CHANGELOG the entry. Full suite 4120 passed; lint, links, snippets, `mint validate` green.
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
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.
What changes
/try-itwas a button and a canned transcript. It is now a playground: one protected refund under one policy, with amount, payment id, lose the reply, Refund, and an Approve button that is the human. Every line printed isctrlrun's own output on the released wheel, in the tab.Control,InMemoryStateStore,LocalApprovalProvider,Policy.from_yaml,@protect,context,with_approval) definingstep(request_json) -> result_json. JS owns the DOM and nothing else. An approval isgrant_approvalon the store — the writectrlrun approvemakes. No auto-approve, no dry run;test_the_playground_has_no_way_to_grant_but_the_human_buttonasserts one grant path.tests/test_docs_travelling.pyextracts the module with the same regex the Node harness uses and runs it through the six steps the page suggests, asserting each outcome andremote_calls— no Node, no network, every commit. Mutation: reporting a refused retry asexecutedfails two tests.verify-browser-demo.mjsdrives the same sequence under real Pyodide 314.0.6 (ctrlrun 0.5.0 from PyPI), then the five scenarios, and writesdocs/assets/browser-demo.verified.json;test_the_page_quotes_the_run_the_harness_recordedholds the page's date and versions to it.verify-browser-wiring.mjsclicks every control under jsdom with Pyodide stubbed (21 checks). Both run today, all green.<Accordion>s. 830 words, under budget.mint validatepasses.Checks
.venv: 4120 passed, 45 skipped.lint.py0,links.py0 broken,snippets.py0 failed,ruff,mypy --strict src/clean.src/changes.