fix(api): start lifecycle subscriptions from live events - #3134
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughLifecycle subscriptions now start from the event sequence captured during setup. Earlier retained events are not replayed. Tests cover setup-time and later events. Socket API documentation describes the new subscription and snapshot bootstrap behavior. ChangesSubscription Event Boundary
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
Greptile SummaryThe PR changes lifecycle subscriptions to begin at a shared request-time event sequence rather than replaying retained history, while preserving events emitted during setup and subsequent live delivery.
Confidence Score: 5/5The PR appears safe to merge, with lifecycle history exclusion and setup-window continuity aligned with the EventHub sequence semantics. The shared watermark excludes events at or before request handling while strict greater-than polling retains every event published after that boundary; the changed wait call does not alter its supported state-aware branch.
|
| Filename | Overview |
|---|---|
| src/api/server.rs | Captures one event sequence at lifecycle subscription request handling and shares it across subscription construction. |
| src/api/subscriptions.rs | Initializes lifecycle event subscriptions from the supplied sequence boundary and adds coverage proving retained history is skipped while setup and live events are delivered. |
| src/api/wait.rs | Updates the subscription constructor call; the supported event-wait branch retains its existing state-aware sequence and snapshot behavior. |
| tests/api_ping.rs | Extends integration coverage to ensure a new lifecycle stream does not replay the root pane creation event. |
| docs/next/website/src/content/docs/socket-api.mdx | Documents live-only lifecycle subscriptions and the subscribe-buffer-snapshot bootstrap ordering. |
Sequence Diagram
sequenceDiagram
participant C as Client
participant S as API server
participant H as EventHub
participant A as Application
C->>S: events.subscribe
S->>H: current_sequence()
H-->>S: request boundary N
A->>H: publish setup event N+1
S-->>C: subscription_started
S->>H: events_after(N)
H-->>S: event N+1
S-->>C: setup event
A->>H: publish live event N+2
S->>H: events_after(N+1)
H-->>S: event N+2
S-->>C: live event
Reviews (1): Last reviewed commit: "fix(api): start lifecycle subscriptions ..." | Re-trigger Greptile
Summary
Testing
just checkRefs #1270