fix: step commands see shadow DOM and custom controls; refs no longer go stale - #46
Merged
Merged
Conversation
The release job ran pnpm test against whatever Chrome the runner had preinstalled, and failed once in the browser suite's setup hook. Use the same setup-chrome step and REINS_TEST_CHROME env as ci.yml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
reins snapshot walked document.querySelectorAll only, so controls in web components (MDN's search button, openlibrary's Sort by menu) never got a ref. It now reuses reins do's page helpers, moved to page-dom.ts: it walks open shadow roots and names elements through aria-labelledby, labels, shadow roots and slots. Refs resolve through open shadow roots for click, type, fill, hover, select, scroll, text, wait and upload. --selector stays light-DOM CSS. "element has zero size" on the wizard's Team card and the settings switches came from stale refs: a snapshot never cleared the previous one's data-reins-ref tags, so an element hidden since (the wizard step or tab panel just left) kept e8 while the new snapshot gave e8 to the switch, and querySelector found the hidden one first. Each snapshot now clears the old tags before tagging. actionPoint also presses a stand-in for a target with no box: a 0x0 or display:none native radio/checkbox is pressed through its visible label or the custom radio/switch/checkbox/option it sits in, and a display:contents element through its first rendered child. Disabled, covered and moving checks apply to the element pressed, and disabled to the original too. The hit test now walks the flat tree (assignedSlot), so a caption slotted through two shadow roots counts as inside its button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ep-command fixes
.backdrop { display: flex } overrode the hidden attribute, so the New
project modal was already open on load in every benchmark run. The
report and page now say the snapshot and stale-ref bugs behind some
step-by-step failures were fixed after the benchmark.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The
reins dobenchmark showed Claude, driving reins step by step, failing tasks because of the step commands themselves, not because of its reasoning:reins snapshotdidn't look inside shadow DOM, so MDN's search and Open Library's sort menu were invisible.What
reins snapshotnever cleared the previous snapshot'sdata-reins-reftags. After a wizard step or tab panel changed, a now-hidden element kept its olde8. The new snapshot gavee8to a visible element too, andquerySelectorreturned the hidden one first. Each snapshot now clears the old tags before tagging.reins snapshotlists elements inside open shadow roots and names them the wayreins dodoes: througharia-labelledby, labels, slots and composed text. The helpers moved fromjev-snapshot.tsinto a sharedpage-dom.ts, so both snapshots use one implementation.--refreaches shadow elements in click, type, fill, hover, select, scroll, text, wait and upload.--selectorstays light-DOM CSS, and that's documented. Closed shadow roots stay invisible.<label>or itsrole=radio/switch/checkbox/optionancestor. Adisplay: contentswrapper is clicked through its first child that has a box. The disabled, covered and moving checks apply to the element actually clicked. Hit testing now follows slotted content to its slot.REINS_TEST_CHROMEthe same way ci.yml does. The release run on feat(extension): jev_observe / jev_act for reins do (2/3) #42 failed on the browser suite's setup without this.wizard.html,.backdrop { display: flex }overrodehidden, so the modal was open on load in every run. That's fixed. The benchmark report and the/docs/benchmarkspage now note which step-by-step failures these fixes address.@karnstack/reinsand@reins/extension, written without em dashes so the website's changelog prose check passes.Behaviour change to know about: the snapshot now filters with
checkVisibilityinstead ofoffsetParent. It now includes fixed-position elements and dropsvisibility: hiddenones, so ref numbers can shift on some pages. Switches, labelled inputs and selects now get their real names instead of their text content.Testing
pnpm build,pnpm lintandpnpm typecheckare clean. Tests pass: protocol 95, CLI 509, extension 325.role=switch, a stale ref, anddisplay: contents. The 5 cases for stale refs, 0×0 anddisplay: contentsfail on the old code.button "Search the site"from insidemdn-search-button's shadow root. Clicking it by ref opened search, and typing by ref returned results.🤖 Generated with Claude Code