Skip to content

[CI] test(runtime): advance injected teardown policy clocks - #26267

Merged
nwparker merged 1 commit into
mainfrom
nwparker/structured-teardown-policy-clocks
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/structured-teardown-policy-clocks

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Four teardown policy tests currently wait for mocked sessions that never close or close later. Advance the same policy deadlines with the fake-clock pattern already used by their neighboring test, so the suite finishes sooner while checking the same results.

What Changed

Use fake Date/setTimeout/clearTimeout in four existing cases. Keep both 5ms and 40ms sweep budgets, the full canonical 2,000ms abandoned-sweep grace, the 300ms synthetic close, and every original assertion/call argument. Observe rejection immediately before advancing time, then await the original outcome. Drain and await the finite close before restoring real timers; restore warning spies on failure. All 37 other callbacks, production code, native tests and runtime routing remain unchanged.

Why

These cases use only an injected in-memory session host and empty provider; provider inventory and the local registry are disabled. Reuse the existing adjacent advanceTimersByTimeAsync pattern rather than shorten deadlines or substitute production shutdown behavior. Real provider/socket/process contract tests retain their real timing.

Linked Issue

Internal maintainer test-performance work; the PR template’s maintainer exception applies.

Visual Proof

N/A — test clock control only; no application appearance or interaction changes.

Testing

  • Local macOS tests ran with ORCA_BACKGROUND_LAUNCH=1.
  • Existing cases retained; qualification-only assertions checked the unchanged grace boundary and fake timer cleanup. Those audit assertions are removed from shipping/timings.

Whole pnpm test command measurements at frozen source 7d6d7ca6f841acf686a8dd07c1dbcc7cf40073fa, four workers, filesystem module cache disabled, stock isolation/three projects/six setups/runtime flags. Same 41 original cases in one file, measured from command launch through normal output/exit:

Pair Before After Less time
1 4.661755s 2.066286s 55.68%
2 4.922014s 2.050018s 58.35%
3 4.554691s 2.049581s 55.00%
Mean 4.712820s 2.055295s 56.39%

56.3893% less time / 2.2930× for this suite, with all three pairs improving. All six qualified samples remain included. Eight timing preflights and one correctness preflight encountered another test coordinator and launched no test child; every rejected record is retained. No launched sample failed, was retried or discarded. Coordinator census is scoped, not proof of every desktop process being idle. This subset result does not establish the overall full-suite 2× goal.

Before/after qualification passed 70 original cases across two files under both Bun and actual Node, with shuffle seeds 104729 and 130363 (eight accepted runs). All original names/statuses/file maps, source guards, resolved settings and routes match. The temporary audit verifies that the forced outcome is pending through grace−1 and completes at full grace, and that installed fake timer records are empty before clocks are restored. Audit removal mechanically yields the exact shipping source. Forever-blocked mocked promises remain intentionally unresolved; this is not physical provider-cleanup evidence.

Node typecheck, changed-code quality, formatting and diff checks pass. Shipping head 5d586b47ae80f21b921bba572f50df58171fd364 preserves all 30 qualified candidate/source guard hashes and passes normal commit hooks. Full PR CI and exact-head automated review pass, as detailed below.

Review

Independent review verified all eight qualification maps, shipping/audit removal and timing plan. Independent six-sample review also passed; full CI enrollment and exact-head review are verified below.

Agent skill upstream boundary

  • Not applicable.

Notes

The original host-fencing, SSH, folder-workspace and error-classification assertions remain. No execution-host, wire, platform or production timeout change. Test imports use existing relative paths and the same canonical grace constant.

Checklist

  • Small and focused; before/after, mechanism and alternatives explained.
  • N/A visual proof explained.
  • Self-reviewed correctness, security and performance.
  • Cross-platform and SSH impact considered.
  • Full PR CI and exact-head bot comments assessed.

Full CI and exact-head review

Run 37654893278, attempt 1, tests synthetic merge dbefda9bc15e407cbb2942bdf45d67363591db1b: landed archive-fix main 7d6d7ca6f841acf686a8dd07c1dbcc7cf40073fa plus exact head 5d586b47ae80f21b921bba572f50df58171fd364. All five full unit shards pass and all 30 indexed check contexts are terminal success or stock skip.

Actual assignments report all 11,678 physical files exactly once: 11,538 passed files and 140 stock skips; 112,610 passed cases, one expected failure and 1,052 stock skips. There are zero failed files, unhandled errors, omitted failures, duplicates or missing files. All assignments match fresh canonical discovery and the source's LPT map. All 18 stock runtime/configuration guards and two archive production/test guards match incoming main; configured routes remain 10,551 Bun, 1,126 actual-Node runtime and one Node measurement file. The one changed fixture matches the exact shipping head and its actual Bun module passes all 41 cases. Stock CI artifacts contain module states/counts and runtime markers rather than complete individual case identities; local qualification above verifies the names/statuses.

CodeRabbit's review explicitly covers the exact 5d586b47 head with zero actionable comments and zero unresolved threads. Its docstring check passes; no additional documentation warning needs disposition. Raw logs, all five assignment artifacts and independent source/count/review proofs are retained under ignored notes/bun-migration/performance/pr26267-*. Full CI is correctness evidence; the matched before/after table above remains the scoped performance evidence.

@nwparker nwparker changed the title test(runtime): advance injected teardown clocks (56.39% faster) test(runtime): advance injected teardown policy clocks Oct 7, 2026
@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: f8d88ec2-209c-447a-9e35-a937da6de7e5
📥 Commits

Reviewing files that changed from the base of the PR and between 7d6d7ca and 5d586b4.

📒 Files selected for processing (1)
  • src/main/runtime/structured-session-worktree-teardown.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 structured-session teardown tests now use fake timers to check timeout behavior. They verify agent-session failure classification, forced-removal warnings after the abandoned-sweep grace period, and timeout reporting for sessions that remain open. The tests also verify that sessions closed before the deadline remain included in the stopped-session count.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 5d586

This change only speeds up tests by using fake timers. It does not alter runtime behavior, so merge risk is minimal.

🚥 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 identifies the main change: advancing injected teardown policy clocks in runtime tests.
Description check ✅ Passed The description includes all major template sections and provides clear scope, rationale, testing evidence, review details, and compatibility notes. It is detailed and directly related to the test-onl…
✨ 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 68c493f into main Oct 7, 2026
30 checks passed
@nwparker nwparker changed the title test(runtime): advance injected teardown policy clocks [CI] test(runtime): advance injected teardown policy clocks 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