Skip to content

Find an example: search the design's inputs for an untried case or a slipped mistake - #20

Merged
dtt-github merged 1 commit into
mainfrom
feature/coverage-search
Nov 6, 2026
Merged

dtt-github merged 1 commit into
mainfrom
feature/coverage-search

Conversation

@dtt-github

Copy link
Copy Markdown
Owner

What

Health's coverage gaps ("Never tried: …") and planted mistakes that slipped through ("If count + 1 were count - 1 …") get a Find an example button (the old button is now Add in words). The simulator searches the design's inputs:

  • tries the existing examples' inputs, as they are and with changes, then fresh sequences of values the design uses (0, 1, all ones, the numbers in its code, the examples' values), held for 1 to 250 cycles;
  • keeps the first sequence that reaches the case, or makes the mistaken copy differ at an output;
  • cuts it to the shortest prefix, undoes input changes it doesn't need, halves holds it doesn't need;
  • ends with checks of the outputs holding what the design did (for a mistake, the outputs that tell the two apart), and verifies: passes on the design, fails with the mistake planted.

The draft opens in Examples, unsaved, titled "Tries …" / "Notices if …", for a person to check (a wrong check there = a bug found). Deterministic (seeded), no AI, no cost. If nothing is found, it says why.

Files

  • crates/wafer-api/src/search.rs (new): the search, with tests.
  • design.rs, lib.rs: POST /projects/{id}/spec/find-example (editor, 20 s budget + shrinking).
  • mistakes.rs: planted() plants one reported mistake; coverage.rs: text_of(); spec.rs: half_ps crate-visible.
  • Web: api.ts (findExample, FindTarget), Design.tsx (FindExample button, adds the draft and selects it), styles.css.
  • Docs: docs/user-guide/design-view.md (Health), docs/api.md; CHANGELOG.

Checked

  • Tests: gaps in the up/down counter with one example are each found, are no longer gaps afterwards, and the search is repeatable; a slipped count + 1 → count - 1 is caught by the found example; stale targets are refused in words.
  • One-off probe over all 15 starters with only their first example: 18/18 untried cases found (each under 0.2 s), 33/34 slipped mistakes found; the miss (tx <= 1 left out in uart_tx) changes nothing visible.
  • Browser, local: on a weak counter project, Find an example for a gap and for a slipped mistake each opened a draft; saved and run: 3 of 3 passing.
  • cargo fmt --check, clippy -D warnings, cargo test --workspace, web typecheck and build.

🤖 Generated with Claude Code

…slipped mistake

Health's coverage gaps and slipped planted mistakes get a "Find an example"
button. The simulator tries the examples' inputs (as they are and changed)
and fresh sequences of values the design uses, keeps the first that reaches
the case (or makes the mistaken copy differ at an output), cuts it to the
shortest, undoes input changes it doesn't need, and ends with checks of
what the design did. The draft opens in Examples, unsaved, for a person to
check. Deterministic; no AI, no cost.

POST /projects/{id}/spec/find-example.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dtt-github
dtt-github merged commit a0210cc into main Nov 6, 2026
2 checks passed
@dtt-github
dtt-github deleted the feature/coverage-search branch November 6, 2026 15:07
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.

1 participant