Skip to content

fix: stop "subjects have already been set" during pre-checkin - #3

Merged
scriptcoded merged 2 commits into
mainfrom
fix/select-subjects-rollback
Jul 25, 2026
Merged

fix: stop "subjects have already been set" during pre-checkin#3
scriptcoded merged 2 commits into
mainfrom
fix/select-subjects-rollback

Conversation

@scriptcoded

Copy link
Copy Markdown
Member

Confirming subject selection failed for anyone who used the back button. base:selectSubjects wrote CheckinSubject rows but its onStepRollback was an empty stub, so goBack deleted the step data and left the rows behind. On the re-run, setSubjects saw existing rows and threw. The pre-checkin flow renders a back button on every screen and has two informational steps right after subject selection, so this was easy to hit.

  • selectSubjects: clear subjects on rollback instead of no-op.
  • setSubjects: replace the set in a transaction rather than throwing. Resolves the TODO there. Safe because nothing downstream of subject selection has run yet, and it also unsticks sessions that died between setSubjects and setCompleted -- those hit the error on every retry via the resume path.
  • SelectSubjectScreen: block double submits, which could otherwise put two confirmSubjects calls in flight before the step advanced.

Also guard goBack against completed/aborted sessions. Rollback hooks undo real side effects, and step:goBack can be sent directly (admin debug panel) even though the kiosk hides the button once the session finishes. undoCheckin stays the one way to reverse a finished check-in.

scriptcoded and others added 2 commits July 25, 2026 11:09
Confirming subject selection failed for anyone who used the back button.
base:selectSubjects wrote CheckinSubject rows but its onStepRollback was an
empty stub, so goBack deleted the step data and left the rows behind. On the
re-run, setSubjects saw existing rows and threw. The pre-checkin flow renders a
back button on every screen and has two informational steps right after subject
selection, so this was easy to hit.

- selectSubjects: clear subjects on rollback instead of no-op.
- setSubjects: replace the set in a transaction rather than throwing. Resolves
  the TODO there. Safe because nothing downstream of subject selection has run
  yet, and it also unsticks sessions that died between setSubjects and
  setCompleted -- those hit the error on every retry via the resume path.
- SelectSubjectScreen: block double submits, which could otherwise put two
  confirmSubjects calls in flight before the step advanced.

Also guard goBack against completed/aborted sessions. Rollback hooks undo real
side effects, and step:goBack can be sent directly (admin debug panel) even
though the kiosk hides the button once the session finishes. undoCheckin stays
the one way to reverse a finished check-in.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ScoutButton has a `loading` prop that renders a centered spinner and hides the
label, and it already implies disabled (the render sets the underlying disabled
attribute and suppresses the click), so it replaces the extra disabled
condition. `disabled` stays for the empty-selection case, where there is
nothing to communicate beyond "not available".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@scriptcoded
scriptcoded merged commit 890057a into main Jul 25, 2026
1 check 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