fix: activate submit controls through native Puppeteer clicks - #380
Merged
Merged
Conversation
Co-authored-by: WillBooster (Codex CLI) <agent@willbooster.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
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>
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.
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.