blastproof 0.32.0 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,13 +11,7 @@
11
11
  [![GitHub Marketplace](https://img.shields.io/badge/Marketplace-blastproof%20e2e%20AI%20testing-blue?logo=github)](https://github.com/marketplace/actions/blastproof-e2e-ai-testing)
12
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
13
13
 
14
- **Open-source AI testing agent for pull requests.** Write end-to-end tests as plain English. An agent drives a real browser to run them, selects only the ones your diff can affect, and scores the result before merge.
15
-
16
- ```
17
- git diff → impact mapping → test generation → agentic execution → report + score
18
- ```
19
-
20
- 100% local. MIT. Bring your own LLM key.
14
+ **Open-source AI testing agent for pull requests.** Write end-to-end tests in plain English. An agent runs them in a real browser, picks only the ones your diff can affect, and scores the result before merge.
21
15
 
22
16
  <img src="https://raw.githubusercontent.com/hamc/blastproof/main/.github/dogfood.gif" width="100%"
23
17
  alt="A terminal running blastproof against this repo's demo app. It passes four steps, then fails
@@ -26,172 +20,57 @@ git diff → impact mapping → test generation → agentic execution → report
26
20
 
27
21
  ▶ **[Watch the introduction](https://www.youtube.com/shorts/miqN5FzMF_k)** — what it does, in a minute.
28
22
 
29
- **Documentation:** [Configuration](./docs/configuration.md) · [Testing behind a login](./docs/auth.md) · [Running in CI](./docs/ci.md) · [Contributing](./CONTRIBUTING.md) · [Architecture](./AGENTS.md)
23
+ ## Why blastproof
30
24
 
31
- ## Set it up with your coding agent
25
+ - **Your tests live in your repository.** Plain-English YAML, reviewed in pull requests like code. No selectors to maintain: the agent reads the page the way a screen reader does.
26
+ - **It runs where your code runs.** On your machine or in your CI. No account, no subscription, no dashboard to sign in to. The only thing that leaves your network is the model call, to the provider you choose — or none, with a local model through Ollama. MIT licensed.
27
+ - **It costs cents, and you can cap it.** This repository's own 10-test suite takes about 110 model calls and 240k tokens per run on `claude-haiku-4.5`: about **$0.35 a run**, or 3–4 cents a test, at list prices. With `--impacted`, a pull request runs only the tests its diff can affect. A [budget](./docs/configuration.md#budget--bounding-what-a-run-spends) caps calls, tokens and time, and `--dry-run` costs nothing.
28
+ - **How often it is wrong is measured, not promised.** On this repository's benchmark, a seeded bug that should fail a test and a correct app that should pass it, both reference models got every verdict right in the latest measurement: 0 wrong in 89 runs on `claude-haiku-4.5` and 0 in 90 on `gpt-6-luna`. The demo app flatters, and the [method and its limits](./docs/reliability.md) are public.
32
29
 
33
- Most of what the setup asks — which stack, which port, which journeys matter — is a question your coding agent can already answer by looking at your project. So let it answer them:
30
+ **It fits best** when you cannot send your application to a hosted service, when you want tests as code rather than in someone else's UI, or when you already have an LLM key. **It does not fit yet** if your markup is not accessible, if your key journeys need drag and drop, file upload or several tabs, or if you are on Windows, which is untested. [Does this fit your application?](./docs/writing-tests.md#does-this-fit-your-application) has the details.
31
+
32
+ ## Quick start
33
+
34
+ The fastest path is your coding agent, which can answer most setup questions by looking at your project:
34
35
 
35
36
  ```bash
36
37
  npx skills add hamc/blastproof
37
38
  ```
38
39
 
39
- Then tell your agent: **"set up e2e tests"**. The skill installs for whichever agents you have — Claude Code, Cursor, Codex and others — and walks the whole path: check whether your markup is reachable at all, pick a provider, scaffold, generate drafts from your *running* app, curate them, run them, and write down the accessibility constraints that keep the suite alive as the project grows.
40
-
41
- Two things it deliberately will not do, so their absence does not read as a defect: it does not configure [authentication](./docs/auth.md), and it does not wire up [CI](./docs/ci.md). Both are worth doing after you have seen a green run on your own machine.
40
+ Then tell your agent: **"set up e2e tests"**. The skill works with Claude Code, Cursor, Codex and others, and walks the whole path from checking your markup to a first green run. It leaves [authentication](./docs/auth.md) and [CI](./docs/ci.md) for after that run. It lives in [`skills/blastproof/`](./skills/blastproof/).
42
41
 
43
- The skill lives in [`skills/blastproof/`](./skills/blastproof/) and is worth reading even if you never install it. [`references/authoring.md`](./skills/blastproof/references/authoring.md) sets out what separates a test that detects something from one that reports Score 100 and detects nothing — including two drafts this tool generated that passed unedited and were worth nothing.
44
-
45
- ## Quick start
42
+ By hand:
46
43
 
47
44
  ```bash
48
- npm install -g blastproof # Node.js >= 20.19
45
+ npm install -g blastproof # Node.js >= 20.19
49
46
  cd your-project
50
- blastproof init # scaffolds .blastproof/
51
- ```
52
-
53
- Point `base_url` at your running app in `.blastproof/config.yaml`, then check the setup — this needs **no API key and no browser**:
54
-
55
- ```bash
56
- blastproof run --dry-run
57
- ```
47
+ blastproof init # scaffolds .blastproof/; set base_url in its config.yaml
48
+ blastproof run --dry-run # checks the setup: no browser, no key
58
49
 
59
- To actually execute tests you need a browser and a model:
60
-
61
- ```bash
62
- npx playwright install --with-deps chromium # NEEDS SUDO — see below
63
- export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY, or local Ollama
50
+ npx playwright install --with-deps chromium # needs sudo; without it: npx playwright install chromium
51
+ export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY, or a local Ollama
64
52
  blastproof run
65
53
  ```
66
54
 
67
- **No sudo?** `--with-deps` installs system libraries as root. Without it, run `npx playwright install chromium` and obtain `libnspr4`, `libnss3`, `libnssutil3` and `libasound2` however you can. Note that a useful half of blastproof needs neither browser nor key — see [Without a browser or a key](#without-a-browser-or-a-key).
68
-
69
- Before `run`, `plan` or `test` do anything, they check what they are about to spend — the browser can launch, the model provider is reachable, `base_url` responds — and report every unmet one together, so a stopped app or a missing browser is never a wall you hit one crash at a time. A missing system library names the exact install command and says it needs root; nothing is installed on your behalf. Silent when everything is fine, and skipped entirely by `--dry-run`, which needs none of it.
70
-
71
- Provider options, budgets and browser tuning: [Configuration](./docs/configuration.md).
72
-
73
- ## Does this fit your application?
74
-
75
- Three questions. The first one decides most cases.
76
-
77
- ### 1. Is your markup accessible?
78
-
79
- **A hard requirement, not a preference.** blastproof finds elements the way a screen reader does — by role, by label, by visible text. That is what removes selectors and survives redesigns. The cost is that there is deliberately no CSS or XPath fallback, so anything the accessibility tree cannot describe cannot be driven at all.
80
-
81
- The agent acts on the element it read, not on a search for its name. Each element in the snapshot it reads carries a ref, and an action names that ref: two controls called `Delete` are two different targets, and `Add` is never mistaken for `Add New`. If the role and name the agent gives do not match the element the ref points at, the action is refused rather than performed. A ref is valid only for the snapshot it came from, so nothing like a selector is ever stored.
82
-
83
- | works | cannot be driven |
84
- | --- | --- |
85
- | `<button>Add to cart</button>` | a `<div>` with a click handler |
86
- | `<label for="email">` + `<input>` | an input with no label |
87
- | `<button aria-label="Delete note">` | an icon-only button with no name |
88
- | `<select>` with `<option>`s | an ARIA-less custom dropdown |
89
-
90
- **An editable data grid needs one cell per step.** On a budgeting app's transaction register, a new row shows only the cell that has focus. The date input appears as `textbox [active]: 10/12/2026`, with no name. The empty payee and notes cells are plain `div`s, and the accessibility tree drops them. Each cell becomes a named input only once it is focused. A step asking for four values at once shows the agent one textbox, and it typed the payee into the date. Written one cell per step in keyboard order, the same journey passed:
91
-
92
- ```yaml
93
- - click "Add New" and verify a new transaction row is open with its date field focused
94
- - press Tab to move to the payee field, type Fast Internet, and choose "Fast Internet" from the suggestions
95
- - press Tab three times to move to the payment field, type 12.34, and click "Add"
96
- ```
97
-
98
- That test failed 3 runs of 3 written as one step, and passed 3 of 3 written this way, on 0.26.0 with `claude-haiku-5.5`. On the app's side, a label on each cell's input makes the one-step version readable too. If your core journey is a row editor, spend one test on it before adopting ([#67](https://github.com/hamc/blastproof/issues/67)).
99
-
100
- **Run an accessibility checker on your app before installing anything.** The result predicts how well this will work better than anything else you could measure — and the fixes it suggests are worth making regardless of whether you adopt this tool.
101
-
102
- ### 2. Does your journey need anything on this list?
103
-
104
- Not supported yet:
105
-
106
- - **scroll-to, drag and drop, file upload**
107
- - **multiple tabs**, and native `alert` / `confirm` dialogs
108
-
109
- **Windows is untested.** Development and CI run on Linux and macOS. Nothing is known to be broken and reports are welcome ([#8](https://github.com/hamc/blastproof/issues/8)).
110
-
111
- If a critical journey needs one of these, that journey stays with your existing test suite. The two can coexist — nothing here replaces what you already have.
112
-
113
- ### 3. Can you point it at data you can throw away?
114
-
115
- **Use a seeded database, a staging environment you can reset, or a throwaway account. Do not gate on a run against production data.**
116
-
117
- Within a step, an action that commits — a click, or pressing Enter — is not performed twice: the runner refuses the repeat and tells the agent it already did that. This closes the case that used to produce duplicate records, where a submit answered by a redirect came back to a reset form and the agent, seeing no evidence of its own work, refilled it and submitted again. One repeat goes through: the same control pressed again right after itself, with nothing else done in between, when the page changed after the last press — a tour's "Next", a wizard, "load more".
118
-
119
- It is **not** a guarantee of zero duplicate writes. An agent that reaches the same effect by a genuinely different route — another control that does the same thing — is not caught.
120
-
121
- ## How it works
122
-
123
- <img src="https://raw.githubusercontent.com/hamc/blastproof/main/.github/coverage-flow.svg" width="100%"
124
- alt="How a diff becomes a merge decision. In CI, unattended: changed files are matched against the routes: and ignore: globs; matched files contribute affected routes, files matching neither are reported as unclassified and fail the run only under --fail-on-unmapped. Tests declaring an affected route are executed and produce a weighted score, which --min-score gates on. An affected route no test declares is reported as a coverage gap and never fails the run. Separately and manually, outside CI: blastproof plan loads such a route in Chromium, makes one model call, and produces a YAML draft you review, edit and run before committing it.">
125
-
126
- **The boundary in the middle is the point.** Everything above it runs unattended on every pull request and ends in an exit code. Everything below it is something you choose to run, on your machine, and review before it lands.
127
-
128
- A route no test covers is *reported*, never failed — blocking on it would punish you for an incomplete map instead of teaching you to complete it. Turning that report into a test is the manual half, and the draft it produces is not trusted until a person has read it.
55
+ Before a run spends anything, it checks that the browser launches, the model provider answers and your app responds, and reports every problem at once with the command that fixes it. Providers, budgets and browser options: [Configuration](./docs/configuration.md).
129
56
 
130
57
  ## Writing tests
131
58
 
132
- Tests live in `.blastproof/tests/` as plain-English YAML — no selectors:
133
-
134
59
  ```yaml
135
60
  summary: Checkout with discount
136
61
  priority: P0
137
- tags: [checkout, discount]
138
62
  routes: ["/cart", "/checkout"]
139
63
  steps:
140
- - add item to cart
141
- - apply promo code SAVE20
142
- - verify a 20% discount is applied
143
- - complete checkout
64
+ - add the Mechanical Keyboard to the cart
65
+ - apply promo code SAVE20 and verify the total shows a 20% discount
66
+ - complete checkout and verify the confirmation shows an order number
144
67
  ```
145
68
 
146
- `priority` is P0–P2 (default P1). `tags`, `setup` steps, `auth` and `device` are optional — `auth: false` runs the test signed out, which a login test needs, and a selection in which *every* test declares it skips the login altogether. `device: Pixel 7` runs the test as a phone from [Playwright's device list](docs/configuration.md#device), so a responsive app's mobile interface can be tested beside its desktop one. `routes` declares the URLs a test covers, which is what `--impacted` selects on; write route strings consistently, since they compare by exact equality (`/cart` ≠ `/cart/`). `run` warns to stderr — non-fatal — when a test declares a route no `routes:` mapping declares, since that route contributes nothing to `--impacted` selection.
147
-
148
- ### Say what each step should produce
149
-
150
- This is the one rule that decides whether a suite works. An outside evaluation took the **same application, same suite, same version from Score 64 to Score 100 by rewriting two steps** — nothing else changed:
151
-
152
- ```yaml
153
- # Fragile: a bare action. Nothing says what should be true afterwards.
154
- - submit the add-task form
155
- - verify the new task "Fix the flaky test" appears in the task list
156
-
157
- # Robust: the step carries its own outcome.
158
- - submit the add-task form and verify the task "Fix the flaky test" appears
159
- in the task list with priority High and status Open
160
- ```
161
-
162
- The bare version fails on a shape that is everywhere: the form POSTs, the server redirects back to the same page, and the form comes back empty. The agent is asked whether "submit the add-task form" happened, and is looking at a page that is indistinguishable from one where nothing did. A step that names the outcome gives it something to check that survives the action.
163
-
164
- Write steps that end in an observable result — text on the page, a count, a state change — and this class of failure does not arise.
165
-
166
- **Inline error messages should be plain visible text.** `role="alert"` is read correctly from the accessibility tree and needs no special handling, but note that an alert your page has cleared shows up as an empty element: if a verdict says an alert exists whose content is missing, the message was emptied, not hidden.
167
-
168
- ### A step that enters a value writes the value
169
-
170
- ```yaml
171
- - fill the note field with Order not received # runs
172
- - fill the note field # cannot run
173
- ```
174
-
175
- The agent is **forbidden from inventing values** — one it types must come from the step, from the page, or from an `{{env.*}}` placeholder — and the runner enforces it rather than asking. A `fill` or `select` whose value appears in none of those is refused: it is not typed, the agent is told which sources it may draw from, and the step fails on the retry budget if it keeps insisting.
176
-
177
- The rule used to live only in the prompt, and a prompt instructs rather than enforces. Run against a real model, `fill the note field` did not fail — the agent made a value up, filled it, and the step **passed**, producing "This is a test note." on two runs and "This is a new note" on a third. A test going green over a value nobody wrote, differing between runs, is worse than a failure.
69
+ **Say what each step should produce.** A step that only names an action (`submit the form`) asks the judge whether something happened while it looks at a page that may have reset. A step that names its result (`submit the form and verify the task appears in the list`) gives it something to check. An outside evaluation took the same suite from Score 64 to Score 100 by rewriting two steps this way. The runner now judges an action step on a check that directly follows it, but a step that names its own result does not depend on that.
178
70
 
179
- A placeholder counts as a source **only when the step names that variable**. `fill the password field with {{env.TEST_PASSWORD}}` works; `fill the password field` does not become valid because the agent supplies `{{env.SOMETHING}}` itself. An agent cannot know the name of a variable nobody showed it, so one it produces is a guess — and a guessed variable would put a live credential into a field your test never pointed one at, in output that cannot redact a secret it was never told about.
71
+ **A step that enters a value writes the value.** The agent is forbidden from inventing values: what it types must come from the step, the page or an `{{env.*}}` placeholder, and the runner refuses anything else rather than asking nicely. `run` warns about such steps before it starts; that check reads English only.
180
72
 
181
- Two limits worth knowing. A value the page shows in one format and the field wants in another — `1234` in the step, `1,234.00` in the box — is refused, and the fix is to write the value the way it is typed. And a very short value (`3`) appears somewhere in almost any page, so it will pass; this closes fabricated content, not every fabricated character.
182
-
183
- `run` also warns about it first — the same rule caught earlier, from the test file, on every path, before launching a browser or asking for a key:
184
-
185
- ```
186
- Authoring (a step enters a value but names none):
187
- Add a note (.blastproof/tests/notes.yaml) step 2:
188
- fill the note field
189
- → fill the note field with <value>
190
- ```
191
-
192
- Non-fatal by default — `--fail-on-authoring` turns it into exit 1 for teams enforcing it in CI. Taking the value from the page is fine and is not flagged: `fill the recipient field with the address shown on the confirmation page`.
193
-
194
- **The warning reads English only.** A suite written in another language runs exactly as well but is not inspected, and prints no warning saying so — silence from this check means "nothing found in English", never "this suite is clean". The runner's refusal has no such limit: it compares text rather than parsing grammar, so a suite in any language is still held to the rule at run time.
73
+ The full guide, including the accessibility requirement and what is not supported yet: [Writing tests](./docs/writing-tests.md).
195
74
 
196
75
  ## Commands
197
76
 
@@ -199,142 +78,24 @@ Non-fatal by default — `--fail-on-authoring` turns it into exit 1 for teams en
199
78
  blastproof init # scaffold .blastproof/
200
79
  blastproof run # run every test
201
80
  blastproof run --impacted --base main # run only what the diff can affect
202
- blastproof plan --base main # draft tests for uncovered routes
203
- blastproof test --base main # run what covers the diff, then draft the gaps
204
- ```
205
-
206
- Common flags — `blastproof <command> --help` has the full list:
207
-
208
- | flag | |
209
- | --- | --- |
210
- | `--dry-run` | Print the selection (or, for `plan`, the routes it would draft) and exit. No browser, no API key |
211
- | `--tag` · `--priority` · `--query` | Select a subset of tests |
212
- | `--url <url>` | Override `base_url` for this run (e.g. a PR preview) |
213
- | `--min-score <n>` | Gate on a weighted score instead of all-must-pass |
214
- | `--fail-on-unmapped` | Fail when a changed file matches no `routes:` or `ignore:` glob |
215
- | `--fail-on-authoring` | Fail when a step enters a value but names none (warns by default) |
216
- | `--junit [path]` · `--html [path]` | Write reports |
217
- | `--concurrency <n>` | Run tests at once — [when that is safe](./docs/configuration.md#concurrency--running-tests-at-once) |
218
- | `--write` | `plan` only — persist drafts instead of previewing |
219
- | `--max-llm-calls` · `--max-tokens` · `--max-duration` | [Bound what a run may spend](./docs/configuration.md#budget--bounding-what-a-run-spends) |
220
-
221
- Exit codes: **0** pass, **1** the gate failed or the run stopped (its budget, or the model provider refusing a call: `Run incomplete:`), **2** usage or config error.
222
-
223
- **Generated drafts are never executed and never affect the score.** An unreviewed model-written test in the merge path fails in two directions: a hallucinated expectation blocks a correct PR, and a credulous one waves a broken change through while looking like coverage. `plan` makes the gap visible with a draft to review; it does not make an uncovered route safe.
224
-
225
- ## Impact mapping
226
-
227
- `--impacted` runs only the tests whose `routes:` intersect the routes your diff can affect, mapped from changed files by globs you maintain in `.blastproof/config.yaml`:
228
-
229
- ```yaml
230
- routes:
231
- "src/cart/**": ["/cart", "/checkout"]
232
- ignore:
233
- - "**/*.md"
81
+ blastproof plan --base main # draft tests for routes no test covers
82
+ blastproof test --base main # both: run what covers the diff, then draft the gaps
234
83
  ```
235
84
 
236
- The key is the file glob and the value is the routes it can affect — the opposite way round from a test file's own `routes:`, which is a plain list of the routes that test covers. Inverted, the map matches nothing at all and every run reports a diff that affected no page, so `blastproof` refuses a map written that way rather than running green against it.
237
-
238
- Every changed file lands in one of three buckets: it matches `routes:` and contributes them, matches `ignore:` and is knowingly irrelevant, or **matches neither — nobody has said what it affects**. `--fail-on-unmapped` blocks on that third case, naming the files and both ways to resolve them.
239
-
240
- **The diff is `git diff <base>...HEAD`, so it compares commits.** Work you have not committed — edited, staged or untracked — is not in it. That is the right comparison in CI, where everything is committed by the time the workflow runs, and the wrong one on the machine you are writing the change on: a run against a dirty working tree selects from your last commit, not from your editor.
241
-
242
- It says so rather than leaving you to notice. Any working-tree change the diff excluded is named on stderr, with the routes it maps to, on `run --impacted` and `plan --base` alike — non-fatal, and it changes no exit code and nothing about what is selected. Files your `ignore:` globs already cover stay silent, and so do files already in the diff, whose routes are selected either way.
243
-
244
- **Nothing is ignored by default**, on purpose: a default that guesses on your behalf would hide the first files worth thinking about. The flag is additive — a run can meet `--min-score` and still be blocked here, because "the tests I ran passed" and "something changed that nobody classified" are different claims.
245
-
246
- Its limit is worth knowing: it catches files that are *unclassified*, not *misclassified*. A shared module mapped to one route when it can break five still slips through. Impact by import graph is the fix, and blastproof does not do it yet.
247
-
248
- ## Score and merge gating
249
-
250
- Each run scores the percentage of executed test **weight** that passed, weighing 3 at P0, 2 at P1, 1 at P2 — so a failing checkout costs three times a failing tooltip.
251
-
252
- ```bash
253
- blastproof run # any failure exits 1 (strict, the default)
254
- blastproof run --min-score 80 # one failing P2 is tolerated
255
- ```
256
-
257
- `--min-score` **replaces** the all-must-pass rule rather than adding to it. Only executed tests count: filtered and unrouted tests are neither numerator nor denominator, and a run that executed nothing scores 100, so a docs-only PR is never blocked. JUnit carries the score as a `<property name="score">`, and unrouted tests appear as `<skipped/>` so the coverage gap shows up in CI rather than vanishing. The warnings the run prints (uncommitted work, route drift, a step that names no value) are in both reports too: JUnit counts them in `<property name="warnings">` with their text in `<system-err>`, and the HTML report shows them right after the score.
258
-
259
- **The verdict behind that number is pinned, and that is not the same as reproducible.** The model call that decides whether a step passed runs at temperature 0, so the same page and the same expectation are not re-sampled into a different answer — a gate that flips on identical input teaches people to re-run until green, which is worse than no gate. What pinning does not survive: provider-side batching, floating point, and a gateway routing two calls to different providers or quantizations. Expect far less variance, not a guarantee of the same output twice.
260
-
261
- The calls that *choose* an action, and the one that drafts a test, are deliberately left free — that latitude is what re-resolves a control after a redesign instead of failing on it.
262
-
263
- Wiring this into a pipeline, with the gating patterns worth knowing: [Running in CI](./docs/ci.md). The Action is listed on the GitHub Marketplace as [blastproof e2e AI testing](https://github.com/marketplace/actions/blastproof-e2e-ai-testing).
264
-
265
- ## Without a browser or a key
85
+ Exit codes: **0** pass, **1** the gate failed or the run stopped, **2** usage or config error. Flags, impact mapping, the score and the half that needs no browser or key: [Running, selecting and gating](./docs/running.md). Drafts from `plan` are never run or scored until you review and commit them.
266
86
 
267
- Half of blastproof is deterministic and free. These need no model, no browser and no network:
87
+ ## Learn more
268
88
 
269
- ```bash
270
- blastproof run --dry-run # what would run
271
- blastproof run --impacted --dry-run # + which routes the diff touches
272
- blastproof run --impacted --fail-on-unmapped --dry-run # + gate on unclassified files
273
- blastproof plan --base main --dry-run # affected routes no test covers, no key needed
274
- ```
275
-
276
- They report affected routes, files nobody has classified, and affected routes no test covers — a coverage-gap report with an exit code, useful even on a repo whose suite is Playwright or Cypress.
277
-
278
- ## Trust boundaries
279
-
280
- The application under test is not trusted input: its page content reaches the model, so a page that controls its own accessible text can try to influence the agent. Two things constrain that.
281
-
282
- **The agent cannot leave your application.** The boundary is `base_url`'s origin plus whatever `allowed_origins:` declares, and it constrains where the page **is**, not only where an action asked to go. A `navigate` outside it is refused before the request; a page that ends up outside it any other way — a redirect, a link to another host, a script setting the location — fails the step, and its content is never sent to the model. Enforced by comparison, not by asking the model nicely.
283
-
284
- If your application legitimately spans hosts (an identity provider, a hosted payment step), declare them. A suite that was quietly walking onto a foreign page will now fail and name the origin to add.
285
-
286
- **Frames follow the same boundary.** The agent sees and acts inside an `iframe` on your application's origin, or on one `allowed_origins:` declares. A frame from any other origin shows up as the frame and one line saying its content is not shown and why, and the run prints one warning per origin left out. A hosted payment form is the usual case: declare its origin, and the agent can fill it. Providers' hosted card fields are often nested several frames deep and sandboxed; nesting is covered, but no provider's widget has been measured here, so spend one test on yours before relying on it ([#21](https://github.com/hamc/blastproof/issues/21)).
287
-
288
- **Your secrets stay out of prompts.** `{{env.*}}` placeholders survive intact and are substituted at the moment of typing. Every value your tests or auth recipe reference is redacted from everything else crossing into a prompt — page snapshots included — in literal and percent-encoded form, and replaced with a label naming its variable: `[redacted TEST_PASSWORD]`. The label carries the name and nothing derived from the value, so it tells a reader, and the model, *which* secret was there without telling anyone what it was. Redaction matches a known value case-insensitively and tolerantly of whitespace, so a page that uppercases what you typed is still covered. It does not chase a value your application re-encodes, hashes or truncates — no list of transforms can be complete, and one that pretends to be would make you careless. When a redaction is found only by that wider comparison, the run prints one warning naming the variable, because the same page could just as easily have returned a form nothing here can recognise. Treat all of it as a strong default rather than a guarantee against a hostile app.
289
-
290
- **Redaction covers text, not pixels.** A failure screenshot shows whatever was on screen, including a value typed from `{{env.*}}` or echoed back by the page. So when anything in a run references `{{env.*}}`, the HTML report does not embed screenshots: each failure links to its PNG under `.blastproof/reports/` instead. That keeps `report.html` safe to attach to a pull request. The PNGs themselves are not masked, so do not upload `.blastproof/reports/` anywhere you would not put the secret ([#110](https://github.com/hamc/blastproof/issues/110)).
291
-
292
- **A redacted value is asserted on by identity.** A step that verifies text equal to an `{{env.*}}` value reaches the judge through the mask, like the page does, so both sides read `[redacted NAME]`. The same label on both sides is a match; different labels are not. Until 0.21.0 every secret was redacted to the same `***`, and a step verifying one secret passed against a page showing another — measured, 3 times out of 3 ([#87](https://github.com/hamc/blastproof/issues/87)). What the judge still cannot check is anything *about* the value beyond which variable it is: its length, its format, a prefix. Assert on those with a value that is not in `{{env.*}}`.
293
-
294
- The system prompt also tells the model that page content is data, never instruction. That raises the cost of casual injection and is **not** a boundary — the origin constraint is. Do not point blastproof at an application you would not run locally.
295
-
296
- ## blastproof tests itself
297
-
298
- The **Dogfood** badge is blastproof running against the demo app in this repo — real Chromium, real model, scored and gated, with public logs. It catches real regressions rather than diffing strings: change the demo discount from 20% to 5% while the page still claims *"20% off"* and it fails the step — that is the run in the GIF at the top of this page, verbatim.
299
-
300
- No selector was updated to catch that. The agent read the value, did the arithmetic, and disagreed with the page.
301
-
302
- Try it yourself:
303
-
304
- ```bash
305
- git clone https://github.com/hamc/blastproof && cd blastproof
306
- npm install && npm run build
307
- node examples/demo-app/serve.mjs 4173 &
308
- export ANTHROPIC_API_KEY=...
309
- node dist/cli.js run
310
- ```
311
-
312
- ### How often a verdict is wrong
313
-
314
- A merge gate is judged by two numbers. A **false PASS** is a test that passes on an app with the bug it exists to catch. A **false FAIL** is a test that fails on a correct app. `npm run eval:reliability` measures both. It runs the suite above on the demo app as it is, and each test on **mutants**: copies of the app with one bug seeded. A *literal* mutant changes the value a step quotes. A *subtle* one reproduces the shape of a wrong verdict this project has already had, such as the right value in the wrong place, or a success message with no success behind it.
315
-
316
- | | `claude-haiku-4.5` | `gpt-6-luna` |
317
- | --- | --- | --- |
318
- | false FAIL, correct app (40 test runs) | 0 (≤ 8.8%) | 0 (≤ 8.8%) |
319
- | false PASS, literal bugs (30) | 0 (≤ 11.4%) | 0 (≤ 11.4%) |
320
- | false PASS, subtle bugs (20) | 0 of 19 (≤ 16.8%) | 0 (≤ 16.1%) |
321
-
322
- The bounds are 95% upper bounds: zero errors in 40 runs means "below about 9%", not "never". The first run of this table found a false PASS on Haiku, 2 subtle runs in 20. The confirmation showed order `#BP-1002`, another paragraph mentioned `#BP-1001` as a previous order, and a step checking for `#BP-1001` *in the confirmation* passed. That was fixed in the judge ([#147](https://github.com/hamc/blastproof/issues/147)). On 0.26.0, Haiku had one false FAIL in 40, in the notes test: the note was listed and counted, but the model had typed it into the empty field again, and the judge read the filled field as a form not yet submitted. One subtle run on Haiku ended incomplete, and is left out of its count.
323
-
324
- The demo app is small and well labelled, so these numbers flatter. Expect a real application to do worse. The point of this table is that it can be reproduced, and that every change claiming better verdicts has to move it.
325
-
326
- The same benchmark over seven more models, and why it chose the OpenAI and Ollama defaults, is in [Choosing a model](./docs/configuration.md#choosing-a-model).
327
-
328
- Measured 2026-10-13 on 0.27.0, 5 samples, through OpenRouter. To reproduce:
329
-
330
- ```bash
331
- npm run build
332
- EVAL_MODELS=anthropic/claude-haiku-4.5,openai/gpt-6-luna npm run eval:reliability
333
- ```
89
+ - [Writing tests](./docs/writing-tests.md) — the rules that decide whether a suite works, and whether your app fits
90
+ - [Running, selecting and gating](./docs/running.md) — commands, `--impacted`, the score, and the free deterministic half
91
+ - [Configuration](./docs/configuration.md) — providers, models, budgets, browser, concurrency
92
+ - [Testing behind a login](./docs/auth.md) · [Running in CI](./docs/ci.md) — the GitHub Action is on the [Marketplace](https://github.com/marketplace/actions/blastproof-e2e-ai-testing)
93
+ - [Trust boundaries](./docs/trust-boundaries.md) — what the agent may reach, and how secrets stay out of prompts
94
+ - [How often a verdict is wrong](./docs/reliability.md) — the benchmark, and how to reproduce it
334
95
 
335
96
  ## Development
336
97
 
337
- Built with AI assistance using spec-driven development: every change began as a written proposal with its design rationale, and those documents are kept rather than discarded. `openspec/` holds the reasoning behind each decision, including the alternatives that were rejected and why — start at [`AGENTS.md`](./AGENTS.md) for architecture, conventions and the contribution workflow. Open work lives in [issues](https://github.com/hamc/blastproof/issues).
98
+ Built with AI assistance using spec-driven development: every change began as a written proposal with its design rationale, and `openspec/` keeps them, with the alternatives that were rejected and why. Start at [`AGENTS.md`](./AGENTS.md) and [`CONTRIBUTING.md`](./CONTRIBUTING.md). Open work lives in [issues](https://github.com/hamc/blastproof/issues).
338
99
 
339
100
  ```bash
340
101
  npm install && npm run build && npm test
package/dist/cli.js CHANGED
@@ -218,6 +218,59 @@ import path11 from "path";
218
218
  import { readFile, writeFile as writeFile2, mkdir as mkdir3 } from "fs/promises";
219
219
  import path3 from "path";
220
220
 
221
+ // src/runner/authoring.ts
222
+ var VALUE_VERBS = ["fill", "enter", "type", "input", "set"];
223
+ var LEADING_VALUE_VERB = new RegExp(`^\\s*(?:${VALUE_VERBS.join("|")})\\b`, "i");
224
+ var CONNECTOR_WORDS = ["with", "to", "as", "using", "into", "from", "in"];
225
+ var CONNECTOR_WORD = new RegExp(`\\b(?:${CONNECTOR_WORDS.join("|")})\\b`, "i");
226
+ var CONNECTOR_SYMBOL = /["'`:=]|\{\{env\./i;
227
+ var PHRASAL_IN = new RegExp(`^(\\s*(?:${VALUE_VERBS.join("|")}))\\s+in\\b`, "i");
228
+ function namesAValue(step) {
229
+ const withoutPhrasal = step.replace(PHRASAL_IN, "$1");
230
+ return CONNECTOR_WORD.test(withoutPhrasal) || CONNECTOR_SYMBOL.test(withoutPhrasal);
231
+ }
232
+ function namesNoValue(step) {
233
+ return LEADING_VALUE_VERB.test(step) && !namesAValue(step);
234
+ }
235
+ var CHECK_VERB = String.raw`(?:verify|check|confirm|ensure|assert|expect|validate|make\s+sure|see\s+that)\b`;
236
+ var LEADING_CHECK_VERB = new RegExp(String.raw`^\s*(?:(?:then|and)\s+)?` + CHECK_VERB, "i");
237
+ var CHECK_CLAUSE = new RegExp(String.raw`(?:\band\b|\bthen\b|[,;])\s+` + CHECK_VERB, "i");
238
+ function isVerificationStep(step) {
239
+ return LEADING_CHECK_VERB.test(step);
240
+ }
241
+ function hasVerificationClause(step) {
242
+ const unquoted = step.replace(/"[^"]*"|“[^”]*”/g, '""');
243
+ return !isVerificationStep(step) && CHECK_CLAUSE.test(unquoted);
244
+ }
245
+ function withNextCheck(step, next) {
246
+ if (next === void 0 || isVerificationStep(step) || hasVerificationClause(step) || !isVerificationStep(next)) {
247
+ return step;
248
+ }
249
+ const check = next.trim().replace(/^(?:and|then)\s+/i, "");
250
+ const lower = /^.[A-Z]/.test(check) ? check : `${check.charAt(0).toLowerCase()}${check.slice(1)}`;
251
+ return `${step.replace(/[\s.,;:!]+$/, "")} and ${lower}`;
252
+ }
253
+ function entersNamedValue(step) {
254
+ return LEADING_VALUE_VERB.test(step) && namesAValue(step);
255
+ }
256
+ function detectMissingValues(tests) {
257
+ const findings = [];
258
+ for (const test of tests) {
259
+ for (const origin of ["setup", "steps"]) {
260
+ const steps = origin === "setup" ? test.setup ?? [] : test.steps;
261
+ steps.forEach((step, position) => {
262
+ if (namesNoValue(step)) {
263
+ findings.push({ test, origin, index: position + 1, step });
264
+ }
265
+ });
266
+ }
267
+ }
268
+ return { findings };
269
+ }
270
+ function suggestValueClause(step) {
271
+ return `${step.trimEnd()} with <value>`;
272
+ }
273
+
221
274
  // src/runner/budget.ts
222
275
  function describeLimit(limit, observed, configured) {
223
276
  switch (limit) {
@@ -373,8 +426,12 @@ function estimateMaxModelCalls(tests, maxIterationsPerStep, maxRetriesPerStep, j
373
426
  (sum, test) => sum + (test.setup?.length ?? 0) + test.steps.length,
374
427
  0
375
428
  );
429
+ const judgedOnNext = tests.reduce(
430
+ (sum, test) => sum + [test.setup ?? [], test.steps].flatMap((list) => list.filter((step, i) => withNextCheck(step, list[i + 1]) !== step)).length,
431
+ 0
432
+ );
376
433
  const bundled = (2 * judgeCalls - 1) * Math.min(maxIterationsPerStep, maxRetriesPerStep);
377
- return totalSteps * (maxIterationsPerStep + maxRetriesPerStep + bundled);
434
+ return totalSteps * (maxIterationsPerStep + maxRetriesPerStep + bundled) + judgedOnNext * judgeCalls;
378
435
  }
379
436
 
380
437
  // src/runner/env.ts
@@ -499,51 +556,6 @@ var SecretsMask = class {
499
556
  import { mkdir as mkdir2 } from "fs/promises";
500
557
  import path2 from "path";
501
558
 
502
- // src/runner/authoring.ts
503
- var VALUE_VERBS = ["fill", "enter", "type", "input", "set"];
504
- var LEADING_VALUE_VERB = new RegExp(`^\\s*(?:${VALUE_VERBS.join("|")})\\b`, "i");
505
- var CONNECTOR_WORDS = ["with", "to", "as", "using", "into", "from", "in"];
506
- var CONNECTOR_WORD = new RegExp(`\\b(?:${CONNECTOR_WORDS.join("|")})\\b`, "i");
507
- var CONNECTOR_SYMBOL = /["'`:=]|\{\{env\./i;
508
- var PHRASAL_IN = new RegExp(`^(\\s*(?:${VALUE_VERBS.join("|")}))\\s+in\\b`, "i");
509
- function namesAValue(step) {
510
- const withoutPhrasal = step.replace(PHRASAL_IN, "$1");
511
- return CONNECTOR_WORD.test(withoutPhrasal) || CONNECTOR_SYMBOL.test(withoutPhrasal);
512
- }
513
- function namesNoValue(step) {
514
- return LEADING_VALUE_VERB.test(step) && !namesAValue(step);
515
- }
516
- var CHECK_VERB = String.raw`(?:verify|check|confirm|ensure|assert|expect|validate|make\s+sure|see\s+that)\b`;
517
- var LEADING_CHECK_VERB = new RegExp(String.raw`^\s*(?:(?:then|and)\s+)?` + CHECK_VERB, "i");
518
- var CHECK_CLAUSE = new RegExp(String.raw`(?:\band\b|\bthen\b|[,;])\s+` + CHECK_VERB, "i");
519
- function isVerificationStep(step) {
520
- return LEADING_CHECK_VERB.test(step);
521
- }
522
- function hasVerificationClause(step) {
523
- const unquoted = step.replace(/"[^"]*"|“[^”]*”/g, '""');
524
- return !isVerificationStep(step) && CHECK_CLAUSE.test(unquoted);
525
- }
526
- function entersNamedValue(step) {
527
- return LEADING_VALUE_VERB.test(step) && namesAValue(step);
528
- }
529
- function detectMissingValues(tests) {
530
- const findings = [];
531
- for (const test of tests) {
532
- for (const origin of ["setup", "steps"]) {
533
- const steps = origin === "setup" ? test.setup ?? [] : test.steps;
534
- steps.forEach((step, position) => {
535
- if (namesNoValue(step)) {
536
- findings.push({ test, origin, index: position + 1, step });
537
- }
538
- });
539
- }
540
- }
541
- return { findings };
542
- }
543
- function suggestValueClause(step) {
544
- return `${step.trimEnd()} with <value>`;
545
- }
546
-
547
559
  // src/runner/recovery.ts
548
560
  var COMMIT_ACTIONS = /* @__PURE__ */ new Set(["click", "press"]);
549
561
  var COMMIT_KEYS = /* @__PURE__ */ new Set(["Enter", "NumpadEnter", " ", "Space", "Spacebar"]);
@@ -614,11 +626,19 @@ var StepRecovery = class {
614
626
  * a step instead of closing it.
615
627
  */
616
628
  checksAfterActing;
617
- constructor(step) {
629
+ /**
630
+ * `step` is the step as written: the first source a typed value may come
631
+ * from, and the one that names which `{{env.*}}` variables may be typed.
632
+ * `judged` is the sentence the judge reads, which decides how
633
+ * the step closes. They differ only for an action step joined with the check
634
+ * after it (design an-action-step-takes-the-next-check, D4): a value only
635
+ * that check names is one the page should show, not one to type.
636
+ */
637
+ constructor(step, judged = step) {
618
638
  this.step = step;
619
639
  this.readable = [normalise(step)];
620
- this.verifies = isVerificationStep(step);
621
- this.checksAfterActing = hasVerificationClause(step);
640
+ this.verifies = isVerificationStep(judged);
641
+ this.checksAfterActing = judged !== step || hasVerificationClause(judged);
622
642
  }
623
643
  /**
624
644
  * Records a snapshot the model was shown, as a source it may quote from.
@@ -861,16 +881,18 @@ async function executeTest(page, test, options) {
861
881
  await page.goto(new URL(baseUrl).toString());
862
882
  const usedEarlier = /* @__PURE__ */ new Set();
863
883
  for (let index = 0; index < allSteps.length; index++) {
864
- const { step, setup } = allSteps[index];
884
+ const { step: written, setup } = allSteps[index];
885
+ const following = allSteps[index + 1];
886
+ const step = withNextCheck(written, following?.setup === setup ? following.step : void 0);
865
887
  const stepStartedAt = Date.now();
866
- onEvent({ type: "step-start", index, total: allSteps.length, step: mask(step), setup });
888
+ onEvent({ type: "step-start", index, total: allSteps.length, step: mask(written), setup });
867
889
  let iterations = 0;
868
890
  let failedAttempts = 0;
869
891
  let lastResult;
870
892
  let stepFailedReason;
871
893
  let lastSnapshot;
872
894
  let lookedAgain = false;
873
- const recovery = new StepRecovery(step);
895
+ const recovery = new StepRecovery(written, step);
874
896
  const agentRecord = [];
875
897
  let pageActedOn;
876
898
  try {
@@ -902,7 +924,9 @@ async function executeTest(page, test, options) {
902
924
  let action;
903
925
  try {
904
926
  action = await brain.nextAction({
905
- step,
927
+ // As written, never joined (design an-action-step-takes-the-next-check,
928
+ // D2): a model told the check acts to make it true (#139).
929
+ step: written,
906
930
  isSetup: setup,
907
931
  snapshot: maskedSnap,
908
932
  lastResult: lastResult === void 0 ? void 0 : mask(lastResult),
@@ -1052,8 +1076,36 @@ async function executeTest(page, test, options) {
1052
1076
  } catch (error) {
1053
1077
  if (error instanceof RunStoppedError) throw error;
1054
1078
  stepFailedReason = mask(error instanceof Error ? error.message : String(error));
1079
+ if (step !== written && error instanceof StepFailure && recovery.acted) {
1080
+ const check = following.step;
1081
+ try {
1082
+ await waitForSettled(page);
1083
+ if (isOriginAllowed(page.url(), boundary)) {
1084
+ const snap = await takeSnapshot(page);
1085
+ lastSnapshot = snap;
1086
+ const pageSnap = withoutRefs(mask(snap));
1087
+ recovery.observe(pageSnap);
1088
+ const judgment = await brain.judge(mask(step), mask(check), pageSnap, recovery.stepHistory(), [
1089
+ ...usedEarlier
1090
+ ]);
1091
+ const asked = {
1092
+ action: "assert",
1093
+ expectation: check,
1094
+ reasoning: "judged on the check that follows before failing"
1095
+ };
1096
+ if (judgment.pass) {
1097
+ emitAction(index, asked, `ok: the check after this step holds: ${judgment.reason}`);
1098
+ stepFailedReason = void 0;
1099
+ } else {
1100
+ emitAction(index, asked, `the check after this step does not hold either: ${judgment.reason}`);
1101
+ }
1102
+ }
1103
+ } catch (judgeError) {
1104
+ if (judgeError instanceof RunStoppedError) throw judgeError;
1105
+ }
1106
+ }
1055
1107
  const cutAt = lastSnapshot === void 0 ? void 0 : snapshotCutAt(lastSnapshot);
1056
- if (cutAt !== void 0) {
1108
+ if (stepFailedReason !== void 0 && cutAt !== void 0) {
1057
1109
  stepFailedReason += ` (The page's snapshot was cut at max_snapshot_lines (${cutAt}); what the step looks for may be in the part left out.)`;
1058
1110
  }
1059
1111
  }
@@ -1062,7 +1114,7 @@ async function executeTest(page, test, options) {
1062
1114
  }
1063
1115
  const status = stepFailedReason ? "failed" : "passed";
1064
1116
  stepResults.push({
1065
- step: mask(step),
1117
+ step: mask(written),
1066
1118
  // results are a report channel — never store substituted secrets
1067
1119
  setup,
1068
1120
  status,
@@ -1073,7 +1125,7 @@ async function executeTest(page, test, options) {
1073
1125
  });
1074
1126
  onEvent({ type: "step-end", index, status, reason: stepFailedReason });
1075
1127
  if (stepFailedReason) {
1076
- failure = { step: mask(step), reason: stepFailedReason };
1128
+ failure = { step: mask(written), reason: stepFailedReason };
1077
1129
  break;
1078
1130
  }
1079
1131
  }
@@ -4023,7 +4075,7 @@ function parsePositiveNumber(flag) {
4023
4075
  };
4024
4076
  }
4025
4077
  var program = new Command();
4026
- program.name("blastproof").description("Open-source AI testing agent: plain-English YAML tests executed agentically on a real browser.").version("0.32.0");
4078
+ program.name("blastproof").description("Open-source AI testing agent: plain-English YAML tests executed agentically on a real browser.").version("0.33.0");
4027
4079
  program.command("init").description("Scaffold .blastproof/ (config, tests, sample tests) in the current directory").action(async () => {
4028
4080
  try {
4029
4081
  const result = await initProject(process.cwd());