fix(evoting): stop false "failed to create session" error after a successful vote#1067
fix(evoting): stop false "failed to create session" error after a successful vote#1067Bekiboo wants to merge 3 commits into
Conversation
|
Warning Review limit reached
Next review available in: 40 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 (2)
📝 WalkthroughWalkthroughThe SigningController now replays terminal signing session status on SSE (re)connect. pollApi adds a getSigningSession method to fetch current session status. The signing-interface component adds idempotent completion handling (finishAsSigned, reconcileSession) triggered by SSE messages, errors, and tab visibility/focus changes. ChangesSigning session reconciliation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant SigningInterface
participant SigningController
participant pollApi
User->>SigningInterface: initiate signing
SigningInterface->>SigningController: open SSE connection
SigningController->>SigningController: getSession(sessionId)
SigningController-->>SigningInterface: replay status if terminal
alt SSE delivers signed event
SigningController-->>SigningInterface: signed message
SigningInterface->>SigningInterface: finishAsSigned(voteId)
else SSE error occurs
SigningInterface->>pollApi: getSigningSession(sessionId)
pollApi-->>SigningInterface: status, voteId
SigningInterface->>SigningInterface: reconcileSession updates UI
else tab regains visibility/focus
SigningInterface->>pollApi: getSigningSession(sessionId)
pollApi-->>SigningInterface: status, voteId
SigningInterface->>SigningInterface: reconcileSession updates UI
end
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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: 2
🤖 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 `@platforms/evoting/api/src/controllers/SigningController.ts`:
- Around line 93-115: The SSE reconnect flow in SigningController’s
subscribe/replay path can leak a subscription if the client disconnects while
awaiting getSession(). Move the req.on("close") cleanup registration to
immediately after subscribeToSession() in SigningController so the unsubscribe
handler is attached before any await, and keep the replay logic for
completed/security_violation/expired states unchanged.
In `@platforms/evoting/client/src/lib/pollApi.ts`:
- Around line 308-312: The getSigningSession wrapper currently advertises a
nullable return type but never actually returns null. Update getSigningSession
to either catch the 404/not-found response from apiClient.get and return null
explicitly, or remove null from the return type if callers should always receive
a session object. Make the behavior and signature consistent so callers of
getSigningSession do not depend on an unreachable null path.
🪄 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: 1b8d9cf8-a538-40fd-b2c3-7bbc70053c4c
📒 Files selected for processing (3)
platforms/evoting/api/src/controllers/SigningController.tsplatforms/evoting/client/src/components/signing-interface.tsxplatforms/evoting/client/src/lib/pollApi.ts
Description of change
The eVoting "Sign your vote" screen showed "Failed to create signing session" (with a "Try Again" prompt) even when the vote had actually been signed and recorded — specifically on mobile, when the eID Wallet was closed and biometric verification was required.
Root cause: the "signed" result reaches the web page only as a one-shot SSE push. Opening the eID Wallet backgrounds the browser, which suspends the SSE stream, so the completion event is lost; on return, the SSE
onerrorwas mislabeled as a session-creation failure.Issue Number
Closes #1059
Type of change
How the change has been tested
tsc --noEmitclean on bothevoting/apiandevoting/client.Change checklist
Design notes
completed/security_violation/expired) on every (re)connect, so a reconnecting client immediately catches a completion it missed. Idempotent on the client.Summary by CodeRabbit
New Features
Bug Fixes