Skip to content

test(mothership): keep the preview turn-budget test fast under load - #8458

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/preview-adapter-test-flake
Sep 30, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/preview-adapter-test-flake

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

"bounds all preview content in a turn of four long patches, and still completes each" in file-preview-adapter.test.ts timed out under CPU load. It passes alone, but hit 3 failures in 10 runs with extra CPU-bound processes, at 11–15 s against the 10 s test timeout.

The pacing was already deterministic: the test uses fake timers, and the adapter's only clock is Date.now(). The cost was CPU. The test sent 2,400 deltas against a file of about 300 KB, and the adapter rebuilds the preview text and persists the session on every delta, so the test took about 2.4 s of CPU on an idle machine.

The test now streams four 30 s patches at a 500 ms tick: 240 deltas, about 265 ms idle. That still exceeds the per-turn preview budget, and the assertion is unchanged. With the adapter's turn-budget check removed, the test still fails.

Testing

  • 50 of 50 runs pass under the same CPU load. The slowest took 2.4 s.
  • bun run lint, bun run type-check and bun run check:audits pass.

…r CPU load

The four-patch turn-budget test drove 2,400 deltas over a ~300 KB base, about
2.4 s of CPU on an idle machine and 11-15 s at load 150, past the 10 s test
timeout. Pacing already runs on fake timers; the flake was CPU time, not wall
clock. Four 30 s patches at a 500 ms tick still stream ~25 MB uncapped against
the 8 MiB budget, so the test still fails when the cap is removed.
@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 30, 2026 9:08am UTC

Request Review

@greptile-apps

greptile-apps Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Low risk] Adjusts test parameters to improve performance under load.

The PR appears safe to merge.

Summary

The PR reduces the delta count in the four-patch preview-budget test to make it faster under CPU load while retaining its budget and completion assertions.

Reviews (1) · Last reviewed commit: "fix(tests): keep the preview turn-budget..."

@cubic-dev-ai cubic-dev-ai 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 issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit e0c90b3 into staging Sep 30, 2026
32 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/preview-adapter-test-flake branch September 30, 2026 18:28

This branch was previously deployed

1 inactive deployment
Preview — 08626273 Deployed Sep 30, 2026 by vercel[bot]
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