Skip to content

test(cli): stop the chDB streak test leaking exit code 78 - #3271

Merged
Makisuo merged 1 commit into
mainfrom
fix/cli-test-exit-code-leak
Dec 4, 2026
Merged

Makisuo merged 1 commit into
mainfrom
fix/cli-test-exit-code-leak

Conversation

@Makisuo

@Makisuo Makisuo commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

The apps/cli test job sometimes fails with every test passing and script "test" exited with code 78 (seen on #3268 and #3270).

Cause: test/in-memory-store.test.ts ("keeps the failure streak across runs") saves process.exitCode, runs a chDB refusal that sets 78, then writes the saved value back. When the saved value was undefined, that write is a no-op in Bun, so the 78 stays. Whether the saved value is undefined depends on whether an earlier file in the run set the exit code, so the failure is flaky. expected-outcomes.test.ts already guards against the same trap with ?? 0. This applies the same fix.

Evidence:

  • bun test test/in-memory-store.test.ts alone: before, 13 pass, 0 fail, exit code 78. After, exit code 0.
  • Whole CLI suite locally: the only failures need the effect-sdk build or libchdb, which this worktree doesn't have and CI builds.

🤖 Generated with Claude Code


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Tests
    • Improved CLI test cleanup so test runs handle unset exit statuses consistently across runtimes, reducing the chance that one test affects the results of another.
  • User impact
    • No user-visible behavior changes.

…streak test

Assigning undefined back to process.exitCode is a no-op in Bun, so the 78
a chDB refusal sets leaked out whenever this file ran before any other set
the exit code: the CLI suite failed with every test passing.
@maple-review-bot

maple-review-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Maple review

🟢 Confidence 10/10 · safe to merge. One-line test fix that matches the existing ?? 0 pattern in expected-outcomes.test.ts:38; nothing in production code changes.
no findings · tests not needed · risk low

The streak test now restores process.exitCode to 0 instead of assigning undefined, so the 78 a chDB refusal sets can no longer leak into the CLI test job. Correct and safe to merge.

08f1732 · What was checked, coverage and telemetry details are on the Maple / review check. Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.

@coderabbitai

coderabbitai Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The inMemoryStartFailuresKey test now restores process.exitCode to its saved value, or to 0 when that value is undefined. A comment documents the Bun behavior behind the fallback.

Changes: Test Exit-Code Restoration

Layer / File(s) Summary
Restore the test exit code
apps/cli/test/in-memory-store.test.ts
The test defaults an undefined saved process.exitCode to 0. A comment explains the Bun behavior.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Possibly related PRs

Suggested reviewers: jeremyfunk

Merge Risk: Minimal · up to 08f17

This is a test-only change that keeps a leaked exit code 78 from failing the CLI test job. It does not change production behavior, and the merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: a test fix that stops the chDB streak test from leaking exit code 78. The raw summary confirms the change restores process.exitCode with a ?? 0 fallback in apps/cli/test/…
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.
Full details: Title check

Explanation

The title names the change: a test fix that stops the chDB streak test from leaking exit code 78. The raw summary confirms the change restores process.exitCode with a ?? 0 fallback in apps/cli/test/in-memory-store.test.ts, and the objectives describe the same leak. The title is specific and matches the main change. It uses the conventional test(cli): prefix and stays under one line.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f8491e36-e7a7-4c62-8894-08cb08b0a33d
Commits

Reviewing files that changed from the base of the PR and between 01fb8ce and 08f1732.

Files selected for processing: 1

  • apps/cli/test/in-memory-store.test.ts

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

@Makisuo
Makisuo merged commit 21cd826 into main Dec 4, 2026
29 checks passed
@Makisuo
Makisuo deleted the fix/cli-test-exit-code-leak branch December 4, 2026 16:18
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