Skip to content

qualify: find the save control by role and name when it has no selector - #1564

Merged
abrichr merged 1 commit into
mainfrom
fix/fault-driver-role-name
Oct 25, 2026
Merged

abrichr merged 1 commit into
mainfrom
fix/fault-driver-role-name

Conversation

@abrichr

@abrichr abrichr commented Oct 25, 2026

Copy link
Copy Markdown
Member

Bug 18 from the second-installation work (#1548).

Problem

qualify refused Medplum's save with "save step has no structural selector". The web fault driver, and the qualification precondition in front of it, required a CSS selector for the save control. The recorder captures a selector only for a unique #id, and a React app such as Medplum seldom gives its save button one. The recorder keeps the button's ARIA role and accessible name instead, and the backend's resolver already finds an element by those.

Change

  • WebFaultDriver._save_target accepts a role and a name when the locator has no selector.
    • The role and name must find exactly one element.
    • No match, or several matches (in one frame or across frames), means there is no target, and the fault declines. It never falls through to a looser match.
    • The selector path is unchanged.
  • check_ready accepts a selector, or a role plus a name. A role alone is still refused, and the message says "structural locator".

Tests

tests/test_fault_driver_role_name.py:

  • The precondition accepts a role plus a name, and refuses a role alone.
  • In a real Chromium form, the driver finds the one "Create" button, and finds nothing with no Create button or with two.

Run locally: the qualification and fault selection (986 passed, 6 skipped), plus ruff, ruff format, mypy and strict mypy.

🤖 Generated with Claude Code

The web fault driver and the qualification precondition required a CSS selector for the save control, which the recorder captures only for a unique #id. React apps (Medplum) give a save button its role and accessible name instead. Both now take role and name when they find exactly one element; no match or several matches is no target, and the fault declines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@abrichr
abrichr enabled auto-merge October 25, 2026 14:02
@abrichr

abrichr commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

AI review (coordinator): approved. Qualification only: the web fault driver and the precondition accept a role and name locator that resolves to exactly one element (get_by_role with exact=True), and decline on none or several, so a fault is never injected against an ambiguous target. No replay or save path changes. Auto-merge stays on.

abrichr added a commit that referenced this pull request Oct 25, 2026
Create now carries a form identity (bug 17, #1543). The run gate then refused seven unarmed field clicks on Medplum's placeholder-only form (bug 21), so the teach reaches those fields by keyboard from armed clicks; all 10 clicks are armed. Certification still refuses two key steps that only move the focus and assert no postcondition (bug 22). Evidence in results/medplum-phase-a/lease-2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@abrichr
abrichr merged commit 413e647 into main Oct 25, 2026
37 checks passed
@abrichr
abrichr deleted the fix/fault-driver-role-name branch October 25, 2026 14:30
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