Skip to content

fix: activate submit controls through native Puppeteer clicks - #380

Merged
exKAZUu merged 7 commits into
mainfrom
fix/native-submit-control-click
Sep 12, 2026
Merged

exKAZUu merged 7 commits into
mainfrom
fix/native-submit-control-click

Conversation

@exKAZUu

@exKAZUu exKAZUu commented Sep 12, 2026

Copy link
Copy Markdown
Member

Requirements

  • required: Complete the direct native Puppeteer migration and preserve existing course grading behavior.

  • required: Keep reusable browser logic in exercode-problem-utils, independently of the core and LLM packages.

  • required: Complete review-booster, complete-pr and release in order.

  • required: Observe actual form submission cancellation, including delegated handlers and early window capture handlers that stop immediate propagation.

  • chosen: Use Puppeteer's native ElementHandle.click after a visibility check, with a temporary submit capture observer spanning the pointer action. JavaScript activation plus a visibility-only guard was rejected because it still bypasses pointer hit testing and would activate controls with pointer-events:none. Return false for controls that fail Puppeteer's visibility check or native clickability calculation so course graders can report their normal verdict; transparent but pointer-reachable controls retain native activation.

  • chosen: Serialize submit checks per page to preserve independent pointer actions and cancellation results when callers overlap operations. Return false for native unclickable/detached-control errors and preserve cancellation across navigation-invalidated observer handles, while propagating unrelated browser failures.

  • chosen: Read the final submit event state after the native click without a navigation-prevention listener. Such a listener can run before a learner handler installed during pointer activation and misclassify a canceled submission. All five current TODO callers return WRONG_ANSWER immediately on false and the shared preset stops; preserving the document after an uncanceled submission is therefore unnecessary. A native uncanceled submission may navigate.

  • chosen: Preserve the form association captured when the check starts, matching the previous helper and the five fixed-form TODO callers; following a form owner reassigned during activation would expand that contract.

  • chosen: A temporary CDP binding transfers the observed event state during beforeunload, retaining a true verdict when canceled submission handlers explicitly redirect. Direct binding notifications preserve the result without a further evaluation in the departing document.

Why

The five TODO graders can accept a solution whose add button is hidden: programmatic activation still submits its form. The original browser pointer click could not activate that control. Reproduction against browser 2.1.1 failed all five hidden-button checks while the existing 30 TODO cases passed.

Customer Summary

Form graders use native pointer activation and continue to recognize submissions canceled by the learner's handlers.

Technical Summary

The shared clickAndDetectCanceledSubmit helper retains its submit observer in a disposable browser handle across the native pointer click, then reads cancellation and removes temporary listeners. The document-start observer still covers earlier window capture handlers. Checks on one page are serialized to keep pointer actions independent. The helper does not prevent submission navigation, so handlers installed during pointer activation can determine the final cancellation state. Unreachable controls return false. A temporary CDP binding preserves cancellation before document unload, so an explicit redirect after preventDefault still returns true when the original observer handle is invalidated; unrelated browser failures still propagate. No Puppeteer or DOM methods are wrapped.

Testing

The browser interaction regression failed before the change and all 16 interaction cases passed after building it. It checks that hidden and pointer-events:none controls produce no action, while a visible enabled control receives a trusted click and cancels submission. The same regression also confirms that a control without an associated form is not activated. Off-screen activation, concurrent checks, and HTTP submissions that replace the document are also covered. Existing constraint-validation, delegated-handler, early-capture and sequential cancellation cases remain covered. The final navigation-binding revision passed bun run verify-full in 1m 36s, including 192 unit tests and 116 E2E tests. HTTP coverage includes a canceled submission that explicitly redirects and retains its true cancellation verdict. A real mousedown-installed window submit listener reproduced the wrong false result before the change and now passes. A timed DOM-removal probe reproduced detached-node click errors before the change and returned false afterward; missing selectors still throw their existing diagnostic.

CI exposed a diagnostic fixture whose 100 ms selector timeout also constrained page navigation. The short timeout now applies only to the missing-element wait, retaining the plain-diagnostic assertion while allowing normal navigation. The focused CLI regression and full verification passed.

Notes

All seven review-booster reviewers completed the final revision. Gemini Code Assist reported its daily quota limit and did not provide a separate review. CI run 34711091748 passed.

Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

exKAZUu and others added 6 commits September 13, 2026 01:37
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
@exKAZUu exKAZUu self-assigned this Sep 12, 2026
@exKAZUu
exKAZUu merged commit ad498a9 into main Sep 12, 2026
5 checks passed
@exKAZUu
exKAZUu deleted the fix/native-submit-control-click branch September 12, 2026 18:59
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