Skip to content

Tester: idempotent checkbox handling + read form requirements before filling#52

Merged
DavertMik merged 3 commits into
mainfrom
fix/checkbox-toggle-idempotent
Jun 5, 2026
Merged

Tester: idempotent checkbox handling + read form requirements before filling#52
DavertMik merged 3 commits into
mainfrom
fix/checkbox-toggle-idempotent

Conversation

@DavertMik

@DavertMik DavertMik commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Two related Tester prompt fixes.

1. Prevent checkbox double-toggle

Diagnosed from session HighBiologicalHarlequin622 (Langfuse trace a7676e6635d6e5c2d0ad6084012f7fc8). The Tester selected a suite checkbox successfully, then re-clicked the same control and toggled it back off — the ariaDiff is the smoking gun:

  • click @ 03:42:52checkbox [checked] + button "Select 32 tests" — selection succeeded.
  • click @ 03:43:00 (same control) → checkbox unchecked + button "Select 0 tests" — reversed.
  • It then confirmed Select 0 tests, saving an empty plan.

Root cause: the shared actionRule prompt (src/ai/rules.ts) had no notion that some controls toggle, nor that an idempotent I.checkOption exists.

  • src/ai/rules.tsI.click section: one-line steer to prefer I.checkOption/I.uncheckOption for checkboxes; new I.checkOption / I.uncheckOption command subsection (documented because actionRule is a closed command set).
  • src/ai/tools.tsform tool description lists the checkbox commands so they route through form() (the click tool rejects non-I.click).

2. Read form field requirements before filling data-changing forms

  • src/ai/rules.ts — new formRequirementsRule, injected into the Tester system message (src/ai/tester.ts). Before filling a create/update form, the Tester reads each control's requirements (required, type/format, length, placeholder/aria hints) and enters satisfying values. View-only search/filter/sort forms are exempt.
  • tests/unit/tester-form-requirements.test.ts — asserts the rule is present in the system message.

Verification

  • bun test tests/unit/ → 651 pass, 0 fail
  • bun test tests/integration/ → 62 pass, 0 fail
  • Biome format + lint clean

🤖 Generated with Claude Code

@DavertMik DavertMik force-pushed the fix/checkbox-toggle-idempotent branch 2 times, most recently from 5403173 to 961cab4 Compare June 5, 2026 23:30
Re-clicking an already-selected checkbox toggled it back off, dropping a
"Select N tests" selection to zero and saving an empty result.

Teach the shared action rules that toggle controls (checkboxes, switches,
selectable rows) are not idempotent: after a click, read the resulting
ariaDiff and stop re-clicking once the control already shows the desired
state. Document idempotent I.checkOption / I.uncheckOption and route them
through the form() tool (the click tool only accepts I.click).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@DavertMik DavertMik force-pushed the fix/checkbox-toggle-idempotent branch from 961cab4 to fe6bf38 Compare June 5, 2026 23:31
Add formRequirementsRule and inject it into the Tester system message so
the Tester reads each control's requirements (required, type/format,
length, placeholder/aria hints) before filling create/update forms;
view-only search/filter/sort forms are exempt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@DavertMik DavertMik changed the title Prevent checkbox double-toggle in Tester interactions Tester: idempotent checkbox handling + read form requirements before filling Jun 5, 2026
It only asserted the rule text appears in the system message — a
tautological wiring check coupled to exact prompt wording, no behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@DavertMik DavertMik merged commit f9861f9 into main Jun 5, 2026
2 checks passed
@DavertMik DavertMik deleted the fix/checkbox-toggle-idempotent branch June 5, 2026 23:41
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