Repository navigation
feat(workers): report cause-agnostic failure-time page-state facts in failure JSON (#55) - #84
Merged
Merged
Conversation
… failure JSON (#55) On any failure, probe the still-live page once (computed styles and geometry are not recoverable from the saved static HTML) and attach a new additive page_state field: URL, title, open dialogs/overlays with accessible names, visible interactive elements (capped), and counts of non-excluded console errors / failed requests from earlier in the run. Strictly facts, no interpretation — that stays in the analyzer pipeline, which now receives page_state in its EvidenceBundle (groundwork for #59). Collected on both failure paths: per failed assertion in runAssertions (lazy, cached across the list), and in the engine's crash path for step failures — the field-review dialog-blocks-click case — where facts ride at the ExecutionResult top level since no failed AssertionResult exists. Facts are also persisted as <id>_page_state.json next to the console/network logs. Collection is best-effort and bounded (3s probe timeout, never throws); passing runs pay zero cost and are byte-identical. CLI maps page_state onto each failure object (including the step-failure fallback); SDK types gain the field. New e2e case: a viewport-covering dialog blocking a correct click selector must yield page_state naming the dialog.
…etric overlay path (#55 review) Review feedback on #84: - The visible-elements inventory (up to 20 entries, duplicated verbatim on every failed assertion) is token noise in the agent-facing JSON contract, and on busy pages the truncation can drop the one element that mattered. The CLI now strips visible_elements/visible_elements_truncated from failures[].page_state; the full facts still persist in the run result (.verfix/runs/<id>.json) and the <id>_page_state.json artifact. SDK type updated to the shipped shape. - Document the center-only elementsFromPoint sampling as a deliberate ceiling (ponytail): the geometric path requires >=80% viewport coverage, and anything that large necessarily covers the center — lowering the bar or multi-point sampling would false-positive on legitimate fixed sidebars. ARIA dialogs are caught by the selector query at any position. - New e2e case: a role-less full-viewport overlay (cookie wall) blocking a click must be detected via the geometric probe path — previously only the [role=dialog] selector path had end-to-end coverage.
jyotir-aditya
added a commit
that referenced
this pull request
Jul 11, 2026
* feat(workers): report cause-agnostic failure-time page-state facts in failure JSON (#55) On any failure, probe the still-live page once (computed styles and geometry are not recoverable from the saved static HTML) and attach a new additive page_state field: URL, title, open dialogs/overlays with accessible names, visible interactive elements (capped), and counts of non-excluded console errors / failed requests from earlier in the run. Strictly facts, no interpretation — that stays in the analyzer pipeline, which now receives page_state in its EvidenceBundle (groundwork for #59). Collected on both failure paths: per failed assertion in runAssertions (lazy, cached across the list), and in the engine's crash path for step failures — the field-review dialog-blocks-click case — where facts ride at the ExecutionResult top level since no failed AssertionResult exists. Facts are also persisted as <id>_page_state.json next to the console/network logs. Collection is best-effort and bounded (3s probe timeout, never throws); passing runs pay zero cost and are byte-identical. CLI maps page_state onto each failure object (including the step-failure fallback); SDK types gain the field. New e2e case: a viewport-covering dialog blocking a correct click selector must yield page_state naming the dialog. * refactor(cli): keep page_state JSON to high-signal facts; verify geometric overlay path (#55 review) Review feedback on #84: - The visible-elements inventory (up to 20 entries, duplicated verbatim on every failed assertion) is token noise in the agent-facing JSON contract, and on busy pages the truncation can drop the one element that mattered. The CLI now strips visible_elements/visible_elements_truncated from failures[].page_state; the full facts still persist in the run result (.verfix/runs/<id>.json) and the <id>_page_state.json artifact. SDK type updated to the shipped shape. - Document the center-only elementsFromPoint sampling as a deliberate ceiling (ponytail): the geometric path requires >=80% viewport coverage, and anything that large necessarily covers the center — lowering the bar or multi-point sampling would false-positive on legitimate fixed sidebars. ARIA dialogs are caught by the selector query at any position. - New e2e case: a role-less full-viewport overlay (cookie wall) blocking a click must be detected via the geometric probe path — previously only the [role=dialog] selector path had end-to-end coverage. * docs(cli): failure-diagnosis playbook in generated instructions (#61) Teach the escalation ladder for diagnosing a failure of any cause: fix_hint/findings/page_state in the JSON output first, then --timeline, then --dom (with page_state.open_dialogs for occluding overlays), then --console/--network, and only then touch project source.
Closed
7 tasks done
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.
Closes #55.
Problem
When a run fails, the JSON report says what check failed — but nothing about what was actually true on the page at failure time. The motivating field case: a correct click selector blocked by a viewport-covering dialog, reported as a plain selector/timeout failure; the agent had to script-grep the raw HTML snapshot to find the dialog.
What this adds
A new additive
page_statefield on every failure object, collected from the live page right when the failure happens (computed styles/geometry are not recoverable from the saved static HTML):dialog[open],[role=dialog|alertdialog],[aria-modal=true], plus full-viewport fixed/absolute elements stacked over the page center — each with an accessible name and viewport coverageStrictly facts, no interpretation — interpretation stays in the analyzer pipeline, whose
EvidenceBundlenow carriespage_state(groundwork for the blocking-overlay analyzer, #59).Design
runAssertionson the first failed assertion, cached for the rest of the list. Step failures (the dialog case — the flow throws before any assertion runs): probed in the engine's crash path while the page is still alive, attached at theExecutionResulttop level, and mapped onto the CLI's fallback failure object.page.evaluate, 3s timeout, never throws — facts must never make a failing run fail harder. Passing runs pay zero cost and their output is unchanged.<id>_page_state.json) next to the console/network logs soverfix showcan surface it later.VerifyFailuregains the typed field.Tests
workers/test/artifacts/page-state.test.ts(new, registered astest:page-state): probe/count merging, exclude patterns, never-throw + stall-timeout guarantees,runAssertionsattachment on failure and absence on pass.cli/test/local-run.test.ts: new e2e flow — a full-viewport dialog ("Welcome to Cleara") intercepts a correct click selector; the failure JSON must carrypage_statenaming the dialog, and the facts artifact must exist on disk.json-purity.shpass.