Skip to content

[CI] test(startup): advance mocked display readiness polling - #26283

Merged
nwparker merged 1 commit into
mainfrom
nwparker/xvfb-readiness-policy-clock
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/xvfb-readiness-policy-clock

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The display-readiness test stops physically waiting five seconds for its mocked Xvfb process. Its full33-case suite takes 74.63% less command time while checking the same readiness failure and DISPLAY behavior.

What Changed

Only the stale-socket rebind failure case replaces its polling sleep with advancing a fake Date clock by the requested duration. The original5,000ms deadline and50ms polling interval stay in production; asynchronous timers and production code remain unchanged. The clock and Atomics spy restore in finally. All original33 expanded cases and71 assertion expressions remain.

Why

Spawn, filesystem access, Electron and process probes are already mocked in this case, so real sleeping does not test Xvfb startup latency. Advancing the existing policy clock preserves the complete budget instead of reducing the timeout. Tests elsewhere that prove actual blocked-thread latency retain their real waits.

Linked Issue

Internal maintainer performance work; no pre-existing issue. No needless issue opened, per repository template.

Visual Proof

N/A — test clocks only; no application interaction or display activation.

Testing

  • Local macOS runs used ORCA_BACKGROUND_LAUNCH=1; no native Xvfb/Electron window launched.
  • All33 original cases passed before/after under stock Bun and actual Node, shuffle seeds104729/130363: eight accepted reports with exact case/status/source/command/settings/routes and natural-close/scoped-census evidence.
  • Separate inline audit verified the full5,000ms deadline through100 unchanged50ms polls. Removing only that timestamp and three audit checks recovers the exact shipping source; no audit assertions ship or enter timing.
  • Node typecheck, changed-code quality, formatting, diff checks and normal commit hooks passed.
  • Full current-head CI and automated comments pending; required before merge.

Before/after measurements

Whole pnpm test command from launch through natural exit, frozen source 7d6d7ca6f841acf686a8dd07c1dbcc7cf40073fa, one file and the same33 cases, four workers, filesystem module cache disabled, stock isolation/runtime flags/six setups. First three alternating pairs; all six qualified samples are retained.

Pair Before After
1 6.786598750s 1.700411625s
2 6.730058791s 1.724724708s
3 6.751843125s 1.717504167s
Mean 6.756166889s 1.714213500s

74.6274% less time / 3.9413× for this suite, with all three pairs improving. One additional before2 sample of6.686781458s passed every case/source/settings gate but overlapped external test coordinators; it remains recorded and excluded by the declared noise guard. One external preflight launched no test child. Root also initially selected the baseline arm with the candidate applied; the source guard rejected that orchestration before any test launch. That separate stopped schedule/log and corrected phase setup are retained. No qualified sample was discarded; no launched test/source/settings failure retried.

This is a subset result, not the full-suite2× goal. Coordinator census is scoped and does not prove every desktop process is idle. The artificial clock does not establish real process startup latency.

Review

Independent checks verified source/formatting/assertion preservation, mocked native boundaries, all eight raw maps, exact audit removal and all six whole-command walls including rejected attempts. Shipping head 2e14a53759541691bfbffae4e1c16be5ff54a7a4 rebases onto 80d45095d2ffbac477716e13711f6bfea2ed0551; all16 named candidate guards and two ignored controller/reporter guards match the measured epoch. No timing was repeated after rebase or represented as latest-main timing. Full CI must validate the new integration.

Agent skill upstream boundary

  • Not applicable; no upstream agent-skill source copied.

Notes

No production timeout, SSH execution, workspace ownership, platform, mobile or wire change. Raw evidence is retained under ignored notes/bun-migration/performance/xvfb-policy-clock-7d-formatted-* and virtual-display-readiness-policy-clock-7d6-formatted/.

Checklist

  • Focused; before/after, mechanism and alternatives explained.
  • N/A visual proof explained.
  • Correctness/performance/source limits reviewed.
  • Cross-platform/SSH considered; no production behavior change.
  • Full CI and review disposition pending before merge.

Full integration and current review before merge

First full integration run passed on exact synthetic source bcce34bed50e0d197a4b4a06c1eb408cd32d63ba, whose parents are 80d45095d2ffbac477716e13711f6bfea2ed0551 and shipping head 2e14a53759541691bfbffae4e1c16be5ff54a7a4. Only the reviewed fixture differs from the base; its shipping bytes and all twenty stock/archive guards match. All five assignments enroll every current physical file once: 11,681 files, 11,541 passed and 140 stock-skipped files; 112,645 passed cases, one expected failure and 1,052 stock skips. Zero failed files, omitted outcomes or unhandled errors. Actual log routes are 10,554 Bun files, 1,126 protected actual-Node runtime files and one actual-Node measurement file. Three upstream test additions relative to the earlier 11,678-file runs are included, with none removed. These full-run artifacts provide per-module counts/states/routes rather than complete named case identities. The changed fixture ran all 33 cases under Bun (46ms reported test time; this is not the whole-command benchmark).

All thirty current check contexts are successful or expected skips. CodeRabbit explicitly reviewed exact shipping head 2e14a53759541691bfbffae4e1c16be5ff54a7a4 with zero actionable comments and zero review threads; its documentation check passed. The six local whole-command wall samples and all rejected attempts above remain the performance evidence: 6.756166889→1.714213500 seconds, 74.63% less time (3.941×) for the same 33-case command. This is a fixture subset improvement, not proof of twofold full-suite improvement or physical startup performance.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 380a4f22-e437-474f-a8ca-7ed21c97bd55
📥 Commits

Reviewing files that changed from the base of the PR and between 80d4509 and 2e14a53.

📒 Files selected for processing (1)
  • src/main/startup/ensure-virtual-display.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The rebind-failure test now uses fake timers and advances the system date from its mocked Atomics.wait call. A finally block restores the spy and real timers. The expectations for startup failure and an unset DISPLAY remain unchanged.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2e14a

This change shortens the test’s polling delay without changing production behavior or the failure coverage. No merge-blocking risk is identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the test change: advancing mocked display-readiness polling instead of waiting physically.
Description check ✅ Passed The description is detailed and covers the change, rationale, testing, performance evidence, visual proof, scope, and compatibility considerations. The missing issue is explained under the maintainer …
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 7f43d9b into main Oct 7, 2026
30 checks passed
@nwparker nwparker changed the title test(startup): advance mocked display readiness polling [CI] test(startup): advance mocked display readiness polling Oct 9, 2026
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