test(storage): cover restore test-stream route gate cases - #574
Conversation
Address CodeRabbit on lidge-jun#571: assert JSON 404 when the stream hook is null under OPENCODEX_CLEANUP_TEST_HOOKS=1, and that the enabled stream path returns the text/plain chunked response.
|
Follow-up for CodeRabbit on merged #571: adds the null-hook JSON 404 and enabled-stream path coverage. |
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds regression coverage for the restore test-stream endpoint’s unavailable response and validates successful plain-text streaming when the cleanup test hook is enabled. ChangesRestore test-stream coverage
Estimated code review effort: 1 (Trivial) | ~5 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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/storage-restore-job-responsive.test.ts`:
- Around line 88-101: Update both restore test cases around
setRestoreTrashJobTestHooks and OPENCODEX_CLEANUP_TEST_HOOKS to save each test’s
prior environment value, then restore it and call
setRestoreTrashJobTestHooks(null) in a nested finally alongside server shutdown.
Ensure cleanup runs on every path so module-level hooks, including
enableTestStream, cannot leak into later tests.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e3551c7f-8e5a-44a2-a2df-bc71846bc024
📒 Files selected for processing (1)
tests/storage-restore-job-responsive.test.ts
Reset OPENCODEX_CLEANUP_TEST_HOOKS and restore-job hooks in a nested finally so enableTestStream cannot leak across cases in the responsive suite.
Summary
Follow-up for merged #571 / CodeRabbit review:
renameAtomicFile) were already merged inba53cc0e/ squashc573bd9d.GET /api/storage/trash/restore/test-stream.Added coverage
{ error: "not_available" }(already present; kept)1but stream hook null → JSON 404 (new)1+enableTestStream→200 text/plainwith chunked body (new)Test plan
bun test tests/storage-restore-job-responsive.test.ts --test-name-pattern test-streambun run typecheckSummary by CodeRabbit