Skip to content

feat(run): WS5 early exit and incomplete runs - #275

Merged
jdpigeon merged 9 commits into
mainfrom
feat/ws5-early-exit
Sep 24, 2026
Merged

jdpigeon merged 9 commits into
mainfrom
feat/ws5-early-exit

Conversation

@jdpigeon

@jdpigeon jdpigeon commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Implements docs/superpowers/plans/2026-09-23-ws5-early-exit-incomplete-runs.md (spec §1.2, §1.5, §11 WS5).

What changes

  • End experiment early and a 1 s Escape hold end the run with no confirm. A tap of Escape does nothing. Escape no longer ends lab.js studies.
  • The runtimes report onAbort(csv), separate from onFinish(csv), with the trials recorded so far.
  • The run lifecycle lives in the store: EndRun (RunBar or escapeHoldEpic) sets isEnding, the reducer keeps the first Stop as runOutcome, and endRunFallbackEpic ends a run no runtime reported. The result screen and RunBar say "EEG" only when a headset was connected (selectRecordsEEG).
  • The stop epic closes the EEG stream, saves behavior, then renames an ended-early run to *.incomplete.csv (new fs:markRecordingIncomplete). Clean, Analyze and the badges skip it; recordingExists still counts it, so the session number isn't reused.
  • RunResult (feat(design): WS5 participant screens + run outcome Storybook states #273) shows "Saving…", then the complete result or "Experiment ended early". The RunBar shows the Escape-held hint. The run screen fits under the RunBar.

Fixes beyond the plan

  • lab.js 23: a root end() doesn't stop the study. Aborts now use controller.jump('abort'), and the data is reported at once.
  • jsPsych keeps waiting out post_trial_gap after an abort, so its data is reported at once too.
  • A late report from an earlier run can't settle the next one.
  • A failed behavior save no longer skips marking the run incomplete.

Verification

  • typecheck, lint (0 errors), npm test (285/285), electron-smoke PASS.
  • Electron playtest (Fixture): End early and hold-Escape write *.incomplete.csv (behavior rows, and a complete last raw row). A tap of Escape doesn't end the run. Clean doesn't list incomplete runs. The earlier incomplete session is left byte-identical. Preview writes nothing.
  • Not run live, because they need native dialogs or file pickers: a full complete run, the session-taken prompt, ending an imported jsPsych study early, and behavior-only runs. Tracked as QA in TODOS.md.

@jdpigeon
jdpigeon merged commit 0025f8e into main Sep 24, 2026
15 checks passed
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.

1 participant