Skip to content

fix(syncdeck): recover incomplete waiting room identity - #300

Merged
mrbdahlem merged 5 commits into
mainfrom
fix/syncdeck-waiting-room-reentry
Jul 16, 2026
Merged

fix(syncdeck): recover incomplete waiting room identity#300
mrbdahlem merged 5 commits into
mainfrom
fix/syncdeck-waiting-room-reentry

Conversation

@mrbdahlem

@mrbdahlem mrbdahlem commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • Bug Fixes

    • Improved session validation so saved participant details are applied only when both name and ID are present.
    • Refined waiting-room handoff behavior when browser storage is unavailable, including clearer warnings and avoiding unsupported fallback flows.
    • Ensured server-provided participant IDs and participant context are persisted appropriately during server-backed handoffs.
    • Prevented token persistence and entry participant fallback persistence when storage isn’t available.
  • Tests

    • Added tests for complete vs incomplete participant context.
    • Added tests for server-backed handoffs when storage is null.
    • Updated Playwright flow coverage to handle the waiting-room state.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

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

Next review available in: 48 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: f2687238-ecec-45e7-9f05-0f373014e070

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca5a56 and ad47335.

📒 Files selected for processing (4)
  • .agent/knowledge/testing-patterns.md
  • activities/syncdeck/client/util/SyncDeckLaunchPresentation.test.tsx
  • client/src/components/common/waitingRoomHandoffUtils.test.ts
  • client/src/components/common/waitingRoomHandoffUtils.ts
📝 Walkthrough

Walkthrough

Session participant context now requires both participant name and ID for routing checks. Waiting-room handoffs can persist server-issued participant context through dedicated storage even when token storage is unavailable, while token and fallback persistence remain storage-gated. Playwright coverage now validates the waiting-room state for anonymous participants.

Changes

Session context flow

Layer / File(s) Summary
Waiting-room handoff persistence
client/src/components/common/waitingRoomHandoffUtils.ts, client/src/components/common/waitingRoomHandoffUtils.test.ts
Handoff processing resolves participant-context storage separately, persists server-issued context without token storage, and gates token and fallback persistence on available storage.
Complete participant context validation
client/src/components/common/sessionParticipantContext.ts, client/src/components/common/sessionParticipantContext.test.ts, client/src/components/common/SessionRouter.tsx
Adds and tests a helper requiring non-null studentName and studentId, then uses it when determining whether stored context is valid for routing.
Waiting-room flow coverage
activities/postboard/playwright/flow.spec.ts
Extends the student-opening helper to verify the waiting-room UI and applies it to the anonymous participant reactions test.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Student
  participant WaitingRoomHandoff
  participant Server
  participant ParticipantContextStorage
  participant SessionRouter
  Student->>WaitingRoomHandoff: request session handoff
  WaitingRoomHandoff->>Server: request participant handoff
  Server-->>WaitingRoomHandoff: return participantId and values
  WaitingRoomHandoff->>ParticipantContextStorage: persist participant context
  SessionRouter->>ParticipantContextStorage: read stored context
  ParticipantContextStorage-->>SessionRouter: return name and ID
  SessionRouter->>Student: render routing state
Loading

Possibly related PRs

🚥 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 clearly matches the main change: tightening and recovering incomplete waiting room identity handling.
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
  • Commit unit tests in branch fix/syncdeck-waiting-room-reentry

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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@client/src/components/common/sessionParticipantContext.ts`:
- Around line 8-10: Update hasCompleteSessionParticipantContext to use optional
chaining when accessing both studentName and studentId, preserving the existing
non-null validation and boolean result for null or incomplete contexts.
🪄 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: 5ba0ff3e-879e-40c9-918d-899d8cd31c32

📥 Commits

Reviewing files that changed from the base of the PR and between 4681a3b and 92481aa.

📒 Files selected for processing (5)
  • client/src/components/common/SessionRouter.tsx
  • client/src/components/common/sessionParticipantContext.test.ts
  • client/src/components/common/sessionParticipantContext.ts
  • client/src/components/common/waitingRoomHandoffUtils.test.ts
  • client/src/components/common/waitingRoomHandoffUtils.ts

Comment thread client/src/components/common/sessionParticipantContext.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens SyncDeck waiting-room identity/session continuity by treating participant identity as valid only when both name and participant ID are present, while also making server-backed handoff persistence resilient to missing browser storage (e.g., blocked/disabled sessionStorage).

Changes:

  • Persist session participant context using server-returned participantId even when sessionStorage isn’t available, and avoid token/value persistence attempts when storage is missing.
  • Update session routing to consider stored participant context “present” only when both studentName and studentId exist (prevents incomplete identities from being treated as accepted).
  • Add/adjust unit + Playwright coverage for incomplete identity and no-sessionStorage handoff scenarios.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
client/src/components/common/waitingRoomHandoffUtils.ts Allows server-backed handoff to run without sessionStorage, persists participant context when possible, and skips token/value persistence when storage is unavailable.
client/src/components/common/waitingRoomHandoffUtils.test.ts Adds test ensuring server-issued participant ID is persisted even when storage is null.
client/src/components/common/SessionRouter.tsx Uses hasCompleteSessionParticipantContext so partial stored identities no longer count as “stored participant context”.
client/src/components/common/sessionParticipantContext.ts Adds hasCompleteSessionParticipantContext helper (requires both name + ID).
client/src/components/common/sessionParticipantContext.test.ts Adds tests for completeness checks.
activities/postboard/playwright/flow.spec.ts Updates Playwright flow to expect waiting room when student identity is incomplete (missing participant ID).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/src/components/common/waitingRoomHandoffUtils.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
client/src/components/common/waitingRoomHandoffUtils.ts (1)

39-39: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove redundant ?? storage fallback.

The participantContextStorage parameter already defaults to storage via parameter destructuring (participantContextStorage = storage). Using ?? storage here overrides an explicitly passed null, preventing the caller from intentionally disabling participant context persistence when token storage is available.

♻️ Proposed fix
-  const resolvedParticipantContextStorage = participantContextStorage ?? storage
+  const resolvedParticipantContextStorage = participantContextStorage
🤖 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 `@client/src/components/common/waitingRoomHandoffUtils.ts` at line 39, Remove
the redundant nullish fallback from the resolved participant context storage
assignment in the waiting-room handoff utility, using the already-defaulted
participantContextStorage value directly so an explicitly passed null remains
disabled.
🤖 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.

Outside diff comments:
In `@client/src/components/common/waitingRoomHandoffUtils.ts`:
- Line 39: Remove the redundant nullish fallback from the resolved participant
context storage assignment in the waiting-room handoff utility, using the
already-defaulted participantContextStorage value directly so an explicitly
passed null remains disabled.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f4d92acd-30a3-46af-bc60-2832fbad9d96

📥 Commits

Reviewing files that changed from the base of the PR and between 92481aa and 2ca5a56.

📒 Files selected for processing (4)
  • activities/postboard/playwright/flow.spec.ts
  • client/src/components/common/sessionParticipantContext.ts
  • client/src/components/common/waitingRoomHandoffUtils.test.ts
  • client/src/components/common/waitingRoomHandoffUtils.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@mrbdahlem
mrbdahlem merged commit 81cc69d into main Jul 16, 2026
17 checks passed
@mrbdahlem
mrbdahlem deleted the fix/syncdeck-waiting-room-reentry branch July 26, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants