test(ui): contain deferred jsdom timers in harnesses - #3751
Conversation
jsdom 28 schedules a selection update on a node timer after focus. Synchronous Popover conformance cleanup could leave that timer alive across the BDD group boundary, making Deno leak sanitization fail nondeterministically. Drain one macrotask after each shared conformance case so the harness owns the deferred work. Constraint: Production Popover behavior and leak sanitization must remain unchanged Rejected: Disable timer leak sanitization | hides real test leaks Rejected: Make every conformance case async | broadens a one-hook harness fix Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep the drain inside the jsdom Popover harness unless jsdom removes the deferred selection timer Tested: Deno 2.7.7 trace-leaks single and four repeated runs; Popover plus Floating pair 34 steps; Bun targeted; fmt, lint, check, diff-check Not-tested: Hosted CI before push
React 19 can leave one scheduler setImmediate timer pending after the jsdom Field root is unmounted. Drain one macrotask after each behaviour case so Deno leak sanitization observes the completed scheduler cleanup inside the owning BDD group. Constraint: Production Field behavior and leak sanitization must remain unchanged Rejected: Disable timer leak sanitization | hides real resource leaks Rejected: Change shared BDD teardown globally | exceeds the two proven jsdom harness failures Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep this drain local to the Field jsdom harness unless a shared React harness boundary is introduced with broad evidence Tested: Exact-main trace-leaks red; ten repeated Deno 2.7.7 trace-leaks green; Popover plus Field plus Floating 42 steps; Bun two files; fmt, lint, check, diff-check Not-tested: Hosted CI before push
|
Warning Review limit reached
Next review available in: 11 minutes Limit details: You’ve used all 3 included reviews currently available under your plan. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Comment |
📦 Client bundle boundary
A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in |
Bring the merged jsdom and React scheduler harness drains into the tenant-error branch so its full leak-sanitized gate can complete without bypasses. Preserve the existing tenant classification hardening, scanner reconciliation, and linear member-name scan. Constraint: PR #3723 must integrate current main non-destructively after #3751 merged Rejected: Rebase or force-push the branch | would rewrite reviewed history Confidence: high Scope-risk: moderate Reversibility: clean Directive: Preserve both the mainline Popover and Field drains and the branch source scanner regressions in future conflict resolution Tested: Pre-merge synthetic merge-tree completed without conflicts Not-tested: Post-merge focused and full pinned gates pending
Summary
Why
Deno leak sanitization could observe timers that jsdom 28 or React 19 scheduled during synchronous test cleanup after the owning BDD group had already finished. This made the full pre-push suite fail nondeterministically while validating #3723.
The drains stay local to the two independently reproduced jsdom harnesses. This PR does not weaken leak detection or alter runtime code.
Red evidence
Green evidence
Scope
Test harness only. Unblocks renewed validation of #3723 after this baseline fix is reviewed and merged.