Skip to content

fix(ci): isolate storage policy tests from Linux shards - #1204

Merged
Wibias merged 2 commits into
devfrom
agent/isolate-storage-policy-ci
Aug 7, 2026
Merged

fix(ci): isolate storage policy tests from Linux shards#1204
Wibias merged 2 commits into
devfrom
agent/isolate-storage-policy-ci

Conversation

@Wibias

@Wibias Wibias commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • exclude the five api-storage-policy* suites from the general four-way Linux bun test --isolate shards
  • run that entire storage-policy family in a dedicated Ubuntu job with a fresh Bun 1.3.14 process and a 5-minute job bound
  • make the aggregate ci check depend on the dedicated storage-policy job, so its failure can never be hidden behind a green aggregate check
  • add a structural regression test that pins the quarantine pattern, exact dedicated file set, unsharded execution, timeout, runner, and aggregate-gate dependency
  • leave the macOS full-suite control and dispatch-only Windows shards unchanged

Why

Linux shard 3 has repeatedly hit Bun 1.3.14 runtime corruption around the storage-policy boundary:

error: EEXIST: file already exists, epoll_ctl
at new WriteStream (internal:fs/streams:244:58)

After that unhandled runtime error Bun reports follow-on lifecycle errors such as Cannot call beforeEach() after the test run has completed, continues running in a corrupted state, and can then stop making progress until GitHub Actions kills the 15-minute shard.

The same dev suite can pass on another run, so this is not a deterministic product-test failure. It is an isolate/runtime race whose blast radius is currently an entire ~150-file shard.

The storage-policy tests are already structured as a coherent Bun-isolation family: the Worker-spawning cases are split one-per-file, with the non-Worker GET/PUT companion beside them. This PR keeps that family together in a clean process instead of allowing a Bun runtime failure there to poison unrelated tests.

Behavior after this change

General Linux shards run:

bun test --isolate tests --path-ignore-patterns 'tests/api-storage-policy*.test.ts' --shard=N/4

The dedicated job separately runs these exact files without sharding:

  • tests/api-storage-policy-already-running.test.ts
  • tests/api-storage-policy-mutation-busy.test.ts
  • tests/api-storage-policy-put-race.test.ts
  • tests/api-storage-policy-run.test.ts
  • tests/api-storage-policy.test.ts

If Bun still wedges on that harness, the failure is isolated to a 5-minute job instead of consuming and corrupting a general 15-minute shard.

Scope

This is intentionally separate from #1179. That PR hardens Worker reclaim and bounds the later Claude probe child process; this PR contains the remaining nondeterministic Bun isolate failure at the CI topology level rather than adding more sleeps or increasing timeouts.

Validation

  • branch rebased onto latest dev before PR creation
  • structural regression test pins the dedicated lane and aggregate gate
  • full Cross-platform CI is the runtime verification for whether shard 3 remains healthy while the storage-policy family runs independently

Summary by CodeRabbit

  • CI Improvements
    • Added a dedicated storage-policy test job with its own setup and isolated execution.
    • Updated Linux test sharding to prevent storage-policy tests from running in parallel.
    • The overall CI check now requires the dedicated storage-policy job to pass.
    • Added automated validation to ensure the workflow maintains this test isolation.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The CI workflow moves storage-policy tests out of Linux shards into a dedicated Ubuntu job. The CI gate requires this job. A workflow test validates the isolation, execution settings, test coverage, and dependency wiring.

Changes

Storage-policy CI isolation

Layer / File(s) Summary
Dedicated storage-policy workflow job
.github/workflows/ci.yml
Linux shards exclude api-storage-policy tests. The new storage-policy job sets up Bun, installs dependencies, builds the GUI, and runs five storage-policy tests without sharding.
CI gate and workflow validation
.github/workflows/ci.yml, tests/zz-ci-storage-policy-isolation.test.ts
The ci job requires storage-policy. The workflow test checks shard exclusions, job settings, test coverage, and dependency wiring.

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

Possibly related PRs

Suggested reviewers: lidge-jun, ingwannu

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: isolating storage policy tests from Linux CI shards.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/isolate-storage-policy-ci

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.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 7, 2026
@Wibias
Wibias marked this pull request as ready for review August 7, 2026 09:28

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 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 `@tests/zz-ci-storage-policy-isolation.test.ts`:
- Around line 43-46: Update the assertions around dedicatedFiles and storageRun
to extract the test-path arguments from the command, then compare that extracted
set exactly with dedicatedFiles rather than only checking containment. Preserve
the existing assertion that storageRun excludes “--shard”.
🪄 Autofix

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 48df0050-fc1b-4d48-8310-6602f506dfe7

📥 Commits

Reviewing files that changed from the base of the PR and between eeae008 and adf3072.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • tests/zz-ci-storage-policy-isolation.test.ts

Comment on lines +43 to +46
for (const file of dedicatedFiles) {
expect(storageRun).toContain(`./${file}`);
}
expect(storageRun).not.toContain("--shard");

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert the exact storage-policy file set.

Lines 43-45 only prove that the five expected files are present. The test still passes if the command adds another test file or a broad tests argument. That change breaks the exact quarantine contract without failing this regression test.

Extract the test-path arguments and compare them with dedicatedFiles.

Proposed fix
-  for (const file of dedicatedFiles) {
-    expect(storageRun).toContain(`./${file}`);
-  }
+  const testArgs = storageRun
+    .split(/\s+/)
+    .filter(argument => argument === "tests" || argument.startsWith("./tests/"));
+  expect(testArgs).toEqual(dedicatedFiles.map(file => `./${file}`));
   expect(storageRun).not.toContain("--shard");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for (const file of dedicatedFiles) {
expect(storageRun).toContain(`./${file}`);
}
expect(storageRun).not.toContain("--shard");
const testArgs = storageRun
.split(/\s+/)
.filter(argument => argument === "tests" || argument.startsWith("./tests/"));
expect(testArgs).toEqual(dedicatedFiles.map(file => `./${file}`));
expect(storageRun).not.toContain("--shard");
🤖 Prompt for 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.

In `@tests/zz-ci-storage-policy-isolation.test.ts` around lines 43 - 46, Update
the assertions around dedicatedFiles and storageRun to extract the test-path
arguments from the command, then compare that extracted set exactly with
dedicatedFiles rather than only checking containment. Preserve the existing
assertion that storageRun excludes “--shard”.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • tests/zz-ci-storage-policy-isolation.test.ts

Commit: 90f4d364ff0386d493703751b6ceeabd54ad3a54

The changes have been pushed to the agent/isolate-storage-policy-ci branch.

Time taken: 3m 20s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@Wibias
Wibias merged commit 6d8d9fc into dev Aug 7, 2026
20 checks passed
@Wibias
Wibias deleted the agent/isolate-storage-policy-ci branch August 7, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant