Add stage participant controls and startup preview - #1424
Conversation
|
A preview of fa941be is uploaded and can be seen here: ✨ https://revisit.dev/study/PR1424 ✨ Changes may take a few minutes to propagate. |
There was a problem hiding this comment.
Pull request overview
Adds stage-level participant controls (capacity + between-subjects condition enable/targets) and a “startup preview” path that can safely render an assignment-independent first page while participant/session assignment is still in progress, while also preventing stale participant writes from clearing an admin rejection.
Changes:
- Add stage capacity enforcement + between-subjects condition gating/targets in the storage engine, with analysis-side management UI updates and tests.
- Introduce “startup preview” rendering for a fixed first Markdown/image component and gate recording/timers/navigation/response interactions during preview.
- Add admin participant timeout controls and ensure rejection events propagate to the participant UI without being overwritten by pending writes.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/utils/useDisableBrowserBack.tsx | Allows disabling back-button prevention during startup preview. |
| src/utils/tests/getStaticFirstComponent.spec.ts | Adds unit tests for determining whether a safe static first component can be previewed. |
| src/utils/getStaticFirstComponent.ts | Implements selection logic for a safe assignment-independent first component. |
| src/utils/colors.ts | Introduces a shared distinct color palette and shade generator. |
| src/store/hooks/useRecording.ts | Suppresses recording/screen-capture side effects during startup preview. |
| src/storage/tests/edgeCases.spec.ts | Adds regression test ensuring stale writes can’t clear an admin rejection. |
| src/storage/engines/types.ts | Adds stage capacity + between-subject controls, rejection listeners, and protects rejection state from stale writes. |
| src/storage/engines/tests/stageCapacity.spec.ts | Adds tests for stage capacity + disabled between-subject combinations behavior. |
| src/controllers/ComponentController.tsx | Disables back-button guard in preview and navigates on rejection events. |
| src/components/tests/Shell.spec.tsx | Adds tests for startup preview rendering and stage-capacity error UI. |
| src/components/StepRenderer.tsx | Adds startup-preview aside and suppresses device warnings / write-error listeners during preview. |
| src/components/StartupPreviewContext.ts | Adds context hook to detect startup preview mode. |
| src/components/Shell.tsx | Adds startup preview routing/store path and stage entry error screens. |
| src/components/response/ResponseBlock.tsx | Disables responses and check/next interactions during startup preview. |
| src/components/NextButton.tsx | Disables navigation, timers, and enter-key progression during startup preview. |
| src/components/audioAnalysis/provenanceColors.ts | Switches provenance palette to the shared distinct palette. |
| src/analysis/tests/ParticipantTimeoutModal.spec.tsx | Adds tests for the new participant timeout modal utilities and UI behavior. |
| src/analysis/tests/manageUtils.spec.ts | Updates default stage color expectation to match new palette default. |
| src/analysis/individualStudy/table/TableView.tsx | Uses shared palette default for missing stage color. |
| src/analysis/individualStudy/StudyAnalysisTabs.tsx | Adds participant timeout modal to analysis UI; passes studyConfig into ManageView. |
| src/analysis/individualStudy/ParticipantTimeoutModal.tsx | Adds admin UI for timing out (rejecting) in-progress participants. |
| src/analysis/individualStudy/management/tests/ManageView.spec.tsx | Updates management tests for stage max/condition features and shared palette usage. |
| src/analysis/individualStudy/management/StageManagementItem.tsx | Expands stage management UI: capacity, participant counts, between-subjects combination toggles and targets. |
| src/analysis/individualStudy/management/ManageView.tsx | Plumbs studyConfig into stage management for between-subjects controls. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const DEFAULT_STAGE_COLOR = '#F35C34'; | ||
| const FIRST_ADDITIONAL_STAGE_COLOR = '#F35C34'; |
|
Codewise everything here is good to go, it all works, open to review UI wise we should take another pass and discuss, it definitely doesnt make a ton of sense at the moment. Wont be huge changes, but definitely some, and idk what the right solution is currently |
|
This is adressing most of what's in #1387, except for the timeout. |
Summary
Validation
Known limitation
Stage capacity is enforced for ordinary entry, but exact simultaneous final-slot admission still needs a backend-atomic reservation transaction/RPC that works for both Firebase and Supabase. This PR does not claim to solve that distributed race.
A broader Node-only edge-case run still has two existing Blob/FileReader environment failures in asset-upload tests.