Skip to content

feat(grammar): a count could be asserted but never used - #328

Merged
AminChirazi merged 1 commit into
relanded/1-capture-interpolationfrom
relanded/2-count-capture
Aug 1, 2026
Merged

feat(grammar): a count could be asserted but never used#328
AminChirazi merged 1 commit into
relanded/1-capture-interpolationfrom
relanded/2-count-capture

Conversation

@AminChirazi

Copy link
Copy Markdown
Contributor

Re-landed onto main. The original stack (#317/#319/#321/#322/#326) merged into each other's branches rather than up to main, so only #316 actually landed. These five commits are the unchanged remainder, rebased onto current main. Same content, same tests — only the base changed.\n\nStacked on the PR above. Re-land of #319. Moves obstacles 41032 and 24499.

appears 5 times works when you know the answer; when the app decides it, there was nothing to write.

- Remember how many "css:.order-row" appear as rows
- Type ${captured.rows} into the "Rowcount" field
- assert: the "Total" shows ${captured.rows} + 1

A new param key on capture, not a new action. The computed comparison's numeric normalisation is reused rather than re-parsed. No adapter changed — counting rides the ordinal each already implements.

Zero fails, naming appears 0 times: a selector typo matches nothing and so does an empty table, and 0 is a plausible number to type into an app.

Red path: a_count_of_zero_fails_instead_of_remembering_zero. Proved in a browser by mutating the page from 4 rows to 6 and replaying the same trace — the capture re-read 6, only the literal assertion failed.

The one question: still a recording — a count is a reading, taken at execution time.

🤖 Generated with Claude Code

`the "css:.row" appears 5 times` has always worked, and it is the right step
when you know the answer. When the app decides the answer — a table built
from whatever the backend returned — there was nothing to write. The number
existed, the grammar could compare it to a literal, and no literal was
available.

`Remember how many "<target>" appear as <name>` reads it into the same
flow-scoped name a text capture uses, so everything captures already do
keeps working, including `shows ${captured.rows} + 1`. The computed
comparison's numeric normalisation is reused as it stands rather than
re-parsed, which is what lets the two compose without either knowing about
the other.

Counting rides the ordinal every adapter already implements, so it means on
each adapter what `the 2nd "Row"` means there; no adapter changed to gain
it. The number is read at execution time on record and on every replay, so
only the reference enters the trace.

Zero fails. A selector typo matches nothing and so does an empty table, and
`0` is a confident, plausible number to type into an application. The step
refuses and names the one that means zero.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@AminChirazi
AminChirazi force-pushed the relanded/1-capture-interpolation branch from c30a790 to 3985e33 Compare August 1, 2026 09:59
@AminChirazi
AminChirazi force-pushed the relanded/2-count-capture branch from 545335d to 6b1ca15 Compare August 1, 2026 10:00
@AminChirazi
AminChirazi merged commit 59dd3f5 into relanded/1-capture-interpolation Aug 1, 2026
9 checks passed
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