Skip to content

test(storage): cover restore test-stream route gate cases - #574

Merged
Wibias merged 2 commits into
lidge-jun:devfrom
Wibias:fix/571-test-stream-coverage
Jul 27, 2026
Merged

test(storage): cover restore test-stream route gate cases#574
Wibias merged 2 commits into
lidge-jun:devfrom
Wibias:fix/571-test-stream-coverage

Conversation

@Wibias

@Wibias Wibias commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Follow-up for merged #571 / CodeRabbit review:

Added coverage

  1. Env unset + hooks enabled → JSON 404 { error: "not_available" } (already present; kept)
  2. Env=1 but stream hook null → JSON 404 (new)
  3. Env=1 + enableTestStream200 text/plain with chunked body (new)

Test plan

  • bun test tests/storage-restore-job-responsive.test.ts --test-name-pattern test-stream
  • bun run typecheck
  • CI green

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling when restore test streaming is unavailable, returning a clear not-available response.
    • Verified that enabled restore test streaming responds successfully with the expected stream content.
    • Confirmed health and streaming endpoints remain responsive during blocked restore processing.

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.
@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Jul 27, 2026
@Wibias

Wibias commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up for CodeRabbit on merged #571: adds the null-hook JSON 404 and enabled-stream path coverage.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Wibias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 17 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ebba8dcc-83a7-410a-bb17-eac2f8f5fa49

📥 Commits

Reviewing files that changed from the base of the PR and between 092f199 and ca9240f.

📒 Files selected for processing (1)
  • tests/storage-restore-job-responsive.test.ts
📝 Walkthrough

Walkthrough

Adds regression coverage for the restore test-stream endpoint’s unavailable response and validates successful plain-text streaming when the cleanup test hook is enabled.

Changes

Restore test-stream coverage

Layer / File(s) Summary
Endpoint availability and streaming assertions
tests/storage-restore-job-responsive.test.ts
Adds assertions for HTTP 404 JSON { error: "not_available" } without enableTestStream, and HTTP 200 text/plain output containing chunk-0 and chunk-7 when enabled.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: bug

Suggested reviewers: ingwannu, lidge-jun

🚥 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 accurately summarizes the new storage test coverage for restore test-stream route gate cases.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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/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

📥 Commits

Reviewing files that changed from the base of the PR and between c573bd9 and 092f199.

📒 Files selected for processing (1)
  • tests/storage-restore-job-responsive.test.ts

Comment thread 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.
@Wibias
Wibias merged commit 0539705 into lidge-jun:dev Jul 27, 2026
9 checks passed
@Wibias
Wibias deleted the fix/571-test-stream-coverage branch July 28, 2026 00:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant