Tighten TUI API connection state - #341
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 50 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 (1)
📝 WalkthroughWalkthroughTuiApiRuntime's connection state model is replaced with a multi-phase state machine (ready, refreshing, stale, reconnecting, repairing, repaired, failed, disposed), adding a new connection snapshot interface and recovery lifecycle methods. Tests are updated to match new states, and documentation reflects the new terminology. ChangesConnection state machine expansion
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Scheduler
participant TuiApiRuntime
participant Host
Scheduler->>TuiApiRuntime: beginRecovery()
TuiApiRuntime->>TuiApiRuntime: refreshRuntimeGuard()
TuiApiRuntime->>TuiApiRuntime: refreshCriticalResources()
alt success
TuiApiRuntime->>TuiApiRuntime: finishRecovery()
else error
TuiApiRuntime->>TuiApiRuntime: markRecoveryFailed(error)
end
TuiApiRuntime->>Host: onConnectionStateChange updates tuiApiConnectionSnapshot
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/multiplexer/tui-api-runtime.test.ts (1)
478-512: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winStrengthen the new success-path recovery test.
toContainchecks don't verify ordering or that the mockedrefreshRuntimeGuard/getFromProjectServicewere actually invoked. As written, this test would still pass even if"repaired"appeared before"repairing", or if the recovery path never called the mocks the way intended. The sibling recovery test (lines 432-445) assertstoHaveBeenCalledTimesfor exactly this reason — consider mirroring that here, plus asserting relative ordering (e.g.states.indexOf("repairing")).toBeLessThan(states.indexOf("repaired"))ortoEqualon the full sequence).Suggested strengthening
expect(states).toContain("repairing"); expect(states).toContain("repaired"); expect(runtime.getConnectionState()).toBe("ready"); + expect(states.indexOf("repairing")).toBeLessThan(states.indexOf("repaired")); + expect(host.refreshRuntimeGuard).toHaveBeenCalledTimes(1); + expect(host.getFromProjectService).toHaveBeenCalledTimes(2);🤖 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 `@src/multiplexer/tui-api-runtime.test.ts` around lines 478 - 512, The success-path recovery test in TuiApiRuntime is too weak because it only checks for presence of states, not ordering or that the recovery mocks were exercised. Strengthen the test by asserting the expected call counts on refreshRuntimeGuard and getFromProjectService, then verify the connection-state sequence in order around scheduleTuiApiRecovery and refreshJson. Use the existing states array to assert that "repairing" occurs before "repaired" and that the final state is "ready", matching the stricter sibling recovery test pattern.
🤖 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.
Nitpick comments:
In `@src/multiplexer/tui-api-runtime.test.ts`:
- Around line 478-512: The success-path recovery test in TuiApiRuntime is too
weak because it only checks for presence of states, not ordering or that the
recovery mocks were exercised. Strengthen the test by asserting the expected
call counts on refreshRuntimeGuard and getFromProjectService, then verify the
connection-state sequence in order around scheduleTuiApiRecovery and
refreshJson. Use the existing states array to assert that "repairing" occurs
before "repaired" and that the final state is "ready", matching the stricter
sibling recovery test pattern.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: dd7f80e1-350d-4c65-a562-bb068c6694e2
📒 Files selected for processing (4)
docs/core-sidecar-north-star.mddocs/north-star-completion-tracker.mdsrc/multiplexer/tui-api-runtime.test.tssrc/multiplexer/tui-api-runtime.ts
Summary
Verification
Summary by CodeRabbit
New Features
Bug Fixes