Skip to content

Switch: correcting a flip within a minute keeps the same session - #33

Merged
JarenKempton merged 1 commit into
mainfrom
t3/session-switch-debounce
Nov 18, 2026
Merged

JarenKempton merged 1 commit into
mainfrom
t3/session-switch-debounce

Conversation

@JarenKempton

Copy link
Copy Markdown
Owner

Why care: Flipping the switch off by mistake and straight back splits one work session into two, even though the one-minute rule already drops accidental short sessions.

What changes

  • Switch flipped to the middle and back to the same company within a minute: the original session reopens and keeps its start time
  • Switch flipped to the other company and back within a minute: the brief detour session is dropped and the original session reopens
  • Any session a switch flip ends after under a minute is discarded, the same as a sub-minute stop
  • Flipping back after a minute or more still starts a new session
  • Dashboard and bar starts are unchanged

Proof

  • cd cloud && pnpm vitest run test/time-clock.test.ts -t "minute|detour" → before: the flip-back and detour tests failed (expected 201 to be 200, new session created); after: pass. They drive signed device requests through the Worker against D1; no physical switch flipped.
  • cd cloud && pnpm check && pnpm test && pnpm format:check → 42/42 pass, types and formatting clean

Merge: needs an independent review first; deploys on merge, no migration

No ticket

🤖 Generated with Claude Code · Opus 5.5 (Claude Code)

Flipping to the middle or the other company and back within a minute
reopens the original session instead of starting a new one, and a
sub-minute session ended by a flip is discarded like a sub-minute stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JarenKempton
JarenKempton marked this pull request as ready for review November 18, 2026 16:58
@JarenKempton
JarenKempton merged commit 163e1a3 into main Nov 18, 2026
2 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