fix: stabilize Windows test harness - #1868
Conversation
This pull request has been ignored for the connected project Preview Branches by Supabase. |
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in:26 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. 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: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe pull request hardens filesystem cleanup across scripts and tests, improves CLS attribution runner port and lifecycle handling, prevents stale 401 responses from expiring signed-out sessions, stabilizes browser and path tests, and adds a branch reconciliation workflow. ChangesRunner and test reliability
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:91fc30bca7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Uh oh!
There was an error while loading. Please reload this page.
…ndows-test-portability # Conflicts: # docs/scripts-index.md
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/measure-cls-attribution.mjs`:
- Around line 242-252: Update the heavy-run cleanup flow around
stopOwnedProcessTree and removePathSync so process termination and path removal
execute within nested try/finally blocks, ensuring cleanup errors cannot bypass
lock release. Invoke lock.release() from the outer finally while preserving the
existing cleanup order and behavior.
- Around line 141-150: Add a request-level timeout in the polling request around
the visible .get call, destroying the request when it expires and scheduling
poll() again so an incomplete response cannot block indefinitely; ensure the
timeout is cleared when the response ends or the request errors. Add a
regression test using a server that accepts the request but never ends its
response, verifying polling resumes and the deadline/lease path completes.
In `@tests/test-runner-safety.test.ts`:
- Around line 104-112: Update the unsafeRecursiveRemoval check in the “requires
bounded retries” test so it inspects each individual rmSync call’s options
object and requires a positive maxRetries value within that same object,
regardless of option order. Prevent later calls, comments, or strings from
satisfying the guard, while preserving acceptance of valid bounded recursive
cleanup.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: db5137d6-524b-4335-9010-7927edbce7ff
📒 Files selected for processing (34)
docs/scripts-index.mdscripts/check-bundle-budget.mjsscripts/measure-cls-attribution.mjsscripts/retryable-fs.mjsscripts/run-lighthouse-budget.mjsscripts/run-playwright.mjsscripts/test-run-lock.mjssrc/components/clinical-dashboard/use-signed-image-url.tstests/adopt-visual-baselines.test.tstests/auth-signed-url-cache.dom.test.tsxtests/bundle-budget.test.tstests/check-lighthouse-budget.test.tstests/client-secret-surface.test.tstests/codex-autofix-workflow.test.tstests/codex-cloud-setup.test.tstests/compare-retrieval-eval.test.tstests/design-sync-contract.test.tstests/design-system-adoption.test.tstests/document-viewer-page-virtualization.dom.test.tsxtests/flake-ledger.test.tstests/function-grants.test.tstests/guard-push.test.tstests/installed-lock-parity.test.tstests/local-presence.test.tstests/measure-cls-attribution-contract.test.tstests/playwright-browser-preflight.test.tstests/pr-handoff-stop.test.tstests/primary-checkout-lease.test.tstests/reconciliation-evidence-pack.test.tstests/reconciliation-preflight.test.tstests/resolve-tsx-cli.test.tstests/search-results-band-adoption.test.tstests/setup-codex-worktree.test.tstests/test-runner-safety.test.ts
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/merge-main-pr-1868.yml:
- Around line 63-80: Replace the direct Path-based reconstruction in the
docs/branch-review-ledger.md conflict branch with the repository’s ledger
command, preserving the configured merge-driver process and existing rows. Keep
the validation that identifies the PR `#1868` row, but use the established ledger
workflow to resolve and stage the file instead of Path.write_text.
- Around line 106-114: Remove the automatic commit and push behavior from the
workflow step following “Remove helper, commit, and push,” including git commit
and git push to codex/windows-test-portability. Leave branch updates to an
authorized, confirmation-gated non-bot process and avoid any provider/API
mutation in this workflow.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7c911bd2-14df-4ed7-818d-36ed9b72ae87
📒 Files selected for processing (2)
.github/workflows/merge-main-pr-1868.ymldocs/branch-review-ledger.md
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull request overview
Stabilizes the repo’s Windows-heavy test/runner harness by making temporary-path cleanup tolerant of transient file handles, tightening test determinism in jsdom scheduling, and hardening runner coordination paths (Playwright/Lighthouse/CLS) to reduce flake risk.
Changes:
- Introduce a shared
removePathSynchelper with bounded retries and adopt it (or equivalentrmSyncretry options) across scripts and tests that delete ephemeral state. - Make jsdom-based tests more deterministic (animation-frame/idling control) and prevent stale/signed-out auth transitions from overwriting signed-out state.
- Harden runner/coordination tooling and related contracts (bundle-budget path normalization; CLS harness port selection and isolation checks) and update docs/ledger.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test-runner-safety.test.ts | Adds removePathSync usage and new safety assertions guarding recursive cleanup patterns. |
| tests/setup-codex-worktree.test.ts | Adds bounded rmSync retries for temp worktree fixtures. |
| tests/search-results-band-adoption.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/resolve-tsx-cli.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/reconciliation-preflight.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/reconciliation-evidence-pack.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/primary-checkout-lease.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/pr-handoff-stop.test.ts | Skips bash-hook contract test on Windows to avoid false negatives + adds bounded cleanup retries. |
| tests/playwright-browser-preflight.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/measure-cls-attribution-contract.test.ts | Extends contract coverage for managed-port selection and shared runner safety boundaries. |
| tests/local-presence.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/installed-lock-parity.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/guard-push.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/function-grants.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/flake-ledger.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/document-viewer-page-virtualization.dom.test.tsx | Makes jsdom scheduling deterministic by explicitly controlling RAF/idle flush points. |
| tests/design-system-adoption.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/design-sync-contract.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/compare-retrieval-eval.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/codex-cloud-setup.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/codex-autofix-workflow.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/client-secret-surface.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/check-lighthouse-budget.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| tests/bundle-budget.test.ts | Improves cross-platform path handling in fake FS fixtures + adds bounded rmSync retries. |
| tests/auth-signed-url-cache.dom.test.tsx | Hardens signed-url cache/auth lifecycle tests for deterministic state changes and scheduling. |
| tests/adopt-visual-baselines.test.ts | Adds bounded rmSync retries for temp fixture cleanup. |
| src/components/clinical-dashboard/use-signed-image-url.ts | Prevents 401s from sign-out/stale identities from triggering session-expired state; fixes effect deps. |
| scripts/test-run-lock.mjs | Switches ephemeral coordinator cleanup from rmSync to removePathSync for Windows-tolerant deletion. |
| scripts/run-playwright.mjs | Uses removePathSync for runner cleanup to avoid transient handle failures. |
| scripts/run-lighthouse-budget.mjs | Uses removePathSync for runner cleanup and report clearing to avoid transient handle failures. |
| scripts/retryable-fs.mjs | New helper providing bounded retry semantics for path removal on Windows/transient handles. |
| scripts/measure-cls-attribution.mjs | Hardens CLS measurement harness: managed-port selection, project identity validation, heavy-run lock usage, safer cleanup. |
| scripts/check-bundle-budget.mjs | Normalizes diagnostic paths to forward slashes for stable cross-platform output/assertions. |
| docs/scripts-index.md | Updates scripts count in the docs index to reflect new scripts additions. |
| docs/branch-review-ledger.md | Appends the completed review record for this PR work. |
| .github/workflows/build-pr-1868-review-fixes.yml | Adds a PR-specific workflow intended to apply/verify “review fixes” on a named branch. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #10239 (cancelled). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Verification
npm run verify:pr-local— PASS (runtime, lock parity, changed-file formatting, lint, typecheck, full Vitest, build, offline RAG fixtures)npm run format— PASS before commitNotes
verify:pr-localon this exact implementation commit.Summary by CodeRabbit
Bug Fixes
Reliability
Tests