Skip to content

Add stage participant controls and startup preview - #1424

Open
ZachCutler04 wants to merge 10 commits into
devfrom
zc/timedOut
Open

Add stage participant controls and startup preview#1424
ZachCutler04 wants to merge 10 commits into
devfrom
zc/timedOut

Conversation

@ZachCutler04

@ZachCutler04 ZachCutler04 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add admin timeout controls plus stage capacity and between-subject condition management
  • prevent stale participant writes from clearing an admin rejection
  • show a safe static first page only after it is proven assignment-independent
  • keep preview mode free of recording, device, browser-history, route, and timer side effects

Validation

  • yarn typecheck
  • yarn lint (pre-existing StepsPanel.tsx hook-dependency warning only)
  • focused storage and static-preview Vitest tests

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.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

A preview of fa941be is uploaded and can be seen here:

https://revisit.dev/study/PR1424

Changes may take a few minutes to propagate.

@JackWilb
JackWilb requested review from JackWilb and jaykim1213 and a lite review from Copilot August 22, 2026 15:45

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

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.

Comment on lines +119 to +120
const DEFAULT_STAGE_COLOR = '#F35C34';
const FIRST_ADDITIONAL_STAGE_COLOR = '#F35C34';
@ZachCutler04

Copy link
Copy Markdown
Contributor Author

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

@JackWilb JackWilb linked an issue Aug 24, 2026 that may be closed by this pull request
Base automatically changed from ew/factors_refactor to dev August 24, 2026 22:21
@alexsb

alexsb commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This is adressing most of what's in #1387, except for the timeout.

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.

Add target number of participants in the firebase

3 participants