Skip to content

test: target writer timeouts and diagnose Bun startup stalls - #23267

Merged
OrcaWin merged 6 commits into
mainfrom
ci/fix-persistence-failure-evidence
Sep 26, 2026
Merged

OrcaWin merged 6 commits into
mainfrom
ci/fix-persistence-failure-evidence

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​111 $\color{#cf222e}{\Huge{\mathbf{−}}}$​12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​7 $\color{#cf222e}{\Huge{\mathbf{−}}}$​3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4

ELI5

A persistence test could time out while its worker was starting, before reaching the write failure it meant to test. It now waits for startup and then advances only the write timer. A separate Bun launcher test now preserves startup evidence when its existing deadline expires.

What Changed

The writer test uses its existing five-second startup budget and fake timers only after the real worker is ready. It still checks the exact timeout code, indeterminate write outcome, real worker exit, and unchanged database contents.

The launcher fixture records bounded Node/Bun startup phases and child/stream state. On the original five-second readiness failure it prints that evidence, then rethrows the original assertion. Production behavior and timeouts are unchanged.

Why

The macOS failure in #23077 occurred during initialization under a 150 ms fault timer. A controlled 250 ms startup delay reproduces it and passes with the correction. The Windows ARM failure observed on #23256 supplied only an empty output buffer; its cause remains unresolved. Recording phases makes the next failure actionable without increasing deadlines or treating a later pass as proof of a fix.

Linked Issue

None. Investigated from CI failures in #23077 and #23256.

Visual Proof

N/A — test fixtures only; no application UI changes.

Shared hourly CI prerequisite

The branch also carries the shared hourly-build fixture correction from #23274. Historical package-version inputs are explicit, with exact version/build-number assertions retained and a newer-package control. Default build commands still read package.json; the dedicated no-module-mocking lint rule stays enabled.

Testing

  • All 20 focused tests pass under Node and Bun 1.4.2 on macOS with ORCA_BACKGROUND_LAUNCH=1.
  • Controlled delayed-worker reproduction: original fixture fails during initialization; corrected mismatch, timeout, and exit cases pass.
  • Node typecheck, all changed-code quality gates, lint, formatting, and generated launcher syntax/phase-output checks pass.
  • Hosted persistence matrix, including Windows ARM, will validate this branch.

Review

Test-only changes. Real worker/process exit and database assertions remain in place; timers are restored in finally. Phase files are per-test and per-runtime, printed only on failure before cleanup. The diagnostics do not establish the cause of the historical launcher failure.

Agent skill upstream boundary

  • Not applicable; no agent skill source changed.

Notes

No production, SSH, provider, path-selection, or workspace behavior changes.

Checklist

  • Focused change with mechanism and rationale explained.
  • Visual proof is not applicable.
  • Self-reviewed; cross-platform child launch still uses the existing wrapper.
  • Focused tests and lint pass; CI covers the platform matrix.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: e2e23e43-178d-4281-80c1-ec68449b1432

📥 Commits

Reviewing files that changed from the base of the PR and between 0d7659d and b9b07ab.

📒 Files selected for processing (2)
  • src/main/orcad/orcad-bun-launcher.integration.test.ts
  • src/main/persistence/profile-state/profile-state-writer-worker.test.ts

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


📝 Walkthrough

Walkthrough

The Bun launcher integration test now records runtime phase files and captures process and stream diagnostics. The startup-verdict test logs those diagnostics if its wait for Bun boot output fails. The profile-state writer worker test uses fake timers to verify timeout failure after advancing time by 5,000 ms.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b9b07

No actionable issue is established before merge. The hosted persistence matrix, including Windows ARM, remains pending.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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 both primary changes: targeting writer timeout behavior and diagnosing Bun startup stalls.
Description check ✅ Passed The description is detailed and aligned with the changes. It explains the problem, mechanism, rationale, testing, limitations, and cross-platform considerations. The linked issue field states None, al…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Persistence writer timeout test — profile-state-writer-worker.test.ts no longer builds the timeout fault-mode client with a 150 ms timeout (which let worker startup race the fault timer, the #23077 flake). It uses the default startup budget, then fakes only setTimeout/clearTimeout after client.ready and advances 5000 ms, newly asserting the exact profile-state-writer-timeout code alongside the indeterminate outcome, real worker exit, and unchanged DB contents.
  • Bun launcher startup diagnostics — orcad-bun-launcher.integration.test.ts prepends an esbuild banner that appends per-runtime phase traces, records timestamped child/stream events in launch(), and exposes a diagnostics() snapshot logged only when the 5 s readiness wait fails before rethrowing the original error.

Both changes are failure-path/test-only. The timeout test can genuinely fail (exact code + awaited rejection), timers are restored in finally, and the diagnostics cannot alter a pass/fail verdict.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the new commits add a test seam to a build script and make the hourly-version tests hermetic. One scope/description note below.

Reviewed changes

  • getHourlyBuildIdentity test seam — config/scripts/hourly-build-version.mjs now accepts an optional packageVersion (destructured with the other inputs) and falls back to readFileSync('package.json') only when it is absent. The CLI caller passes no override, so production behavior is unchanged, and this matches resolveDevChannelBaseVersion(packageVersion, …), which already takes the version as an argument.
  • Hermetic hourly-version tests — the historical getHourlyBuildIdentity case is pinned to packageVersion: '1.4.201' instead of the checked-in package.json version, and a new case asserts a package version above every published tag stays the hourly base floor (1.4.214-hourly.*, build number 1). Both assertions fail without the production seam, so they are real coverage.

ℹ️ PR description and scope no longer match the diff

Technical details
# PR description understates scope

## Affected sites
- `config/scripts/hourly-build-version.mjs:82` — a build script gained an optional `packageVersion` parameter, but the PR body still says "Test-only changes" and "No production … changes".
- `8b735bf5` → `bfce71d` — the hourly build version commits are unrelated to the writer-timeout / Bun-starter CI repairs named in the title and body.

## Required outcome
- The description reflects that the branch now modifies a build script (a behavior-preserving test seam) and touches an unrelated hourly-version area.

## Open questions for the human (optional)
- Should the hourly-version commits ship with this writer/Bun PR, or be split into their own?

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@OrcaWin
OrcaWin merged commit 10cfe92 into main Sep 26, 2026
39 checks passed
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