Phase 1: Testing foundation (schemas, utils, turbo test:unit) - #35
Conversation
Establish turbo test tasks, CI unit-test job, shared test tooling, and initial coverage for schemas, utils, constants, and server signaling helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 22 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: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds a Bun-based unit-testing foundation across the monorepo, including Turbo and CI orchestration, package scripts, shared test setup placeholders, testing documentation, and coverage for schemas, constants, utilities, and server signaling. ChangesTesting foundation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apps/server/src/handlers/signaling.test.ts (1)
20-37: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider asserting on encoded payload content.
The tests verify that the correct number of string payloads are sent, but don't validate the payload itself. Asserting that each sent payload matches the expected
encodeHibernationRPCEvent(eventId, event)output would catch regressions in the encoding pipeline, not just the broadcast/filtering logic.♻️ Optional: strengthen payload assertions
test("sends encoded hibernation events to peers with event iterators", () => { const sent: unknown[] = []; const event: ServerEvent = { id: "worker-left", type: "peer-left", }; broadcastSignalingEvent( [ connection("controller-1", "event-controller", sent), connection("worker-1", "event-worker", sent), ], event ); expect(sent).toHaveLength(2); expect(sent.every((payload) => typeof payload === "string")).toBe(true); + // Verify each payload is the encoded hibernation RPC event for the respective peer + expect(sent[0]).toBe(encodeHibernationRPCEvent("event-controller", event)); + expect(sent[1]).toBe(encodeHibernationRPCEvent("event-worker", event)); });🤖 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 `@apps/server/src/handlers/signaling.test.ts` around lines 20 - 37, Strengthen the test for broadcastSignalingEvent by asserting each sent payload equals encodeHibernationRPCEvent(event.id, event), in addition to checking the payload count and string type. Use the existing event and sent values so the test validates encoded content for both connections.
🤖 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 @.github/workflows/ci.yml:
- Around line 43-46: Add a `needs: check-types` dependency to the `test-unit`
job so it runs only after the type-check job succeeds, preserving the intended
CI order.
- Line 49: Update the actions/checkout@v4 step in the test job to set
persist-credentials: false, preventing the GitHub token from being stored in git
configuration while running PR-controlled tests.
In `@shared/utils/src/conversations/turn-waiters.test.ts`:
- Around line 10-18: Await every expect(...).resolves or expect(...).rejects
matcher promise in all five tests in the turn waiter test suite, including the
turn interrupted case, by making the tests async and awaiting each assertion so
no matcher runs after test completion.
---
Nitpick comments:
In `@apps/server/src/handlers/signaling.test.ts`:
- Around line 20-37: Strengthen the test for broadcastSignalingEvent by
asserting each sent payload equals encodeHibernationRPCEvent(event.id, event),
in addition to checking the payload count and string type. Use the existing
event and sent values so the test validates encoded content for both
connections.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 09fb1464-f920-4c24-bbdc-976d050a8d6f
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (22)
.github/workflows/ci.ymlapps/server/package.jsonapps/server/src/handlers/signaling.test.tsdocs/testing.mdpackage.jsonshared/constants/package.jsonshared/constants/src/operation-keys.test.tsshared/constants/tsconfig.jsonshared/schemas/package.jsonshared/schemas/src/rtc/chat.test.tsshared/schemas/src/rtc/threads.test.tsshared/schemas/src/signaling.test.tsshared/schemas/tsconfig.jsonshared/utils/package.jsonshared/utils/src/conversations/turn-waiters.test.tsshared/utils/src/fold.test.tsshared/utils/src/path.test.tsshared/utils/tsconfig.jsontooling/test/mocks/README.mdtooling/test/setup/bun.setup.tstooling/test/setup/vitest.shared.tsturbo.json
Run unit tests after typecheck with non-persisted checkout credentials, await async test assertions, add identity helper coverage, and assert encoded signaling payloads. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed CodeRabbit review feedback in fbebe25:
Skipped the docstring-coverage bot warning (not applicable to test-only additions). |
Implements #30
Summary
test:unit,test:integration,test:e2e)tooling/testsetup placeholders@cyrus/schemas,@cyrus/utils,@cyrus/constants, and server signaling broadcast helperstest-unitjob on pull requestsTest plan
bun test:unitbun check:typesbun checkCloses #30
Part of #29