Repository navigation
TL-07: live SpacetimeDB board, resident and driver phones - #33
Merged
Merged
Conversation
Adds a Fixture/Live switch. Live mode gates each screen on the window's claimed role, reads A's views through generated subscriptions, and writes through reserve, ingestCheckin, confirmRouteReport, postJobMessage and updateJob. Messages show sending, sent and a retry that reuses the same clientMessageId; reducer conflict/forbidden/rejected errors are shown. Co-Authored-By: Claude <[email protected]>
…ncovered Act now An option is blocked when its driver or asset is missing from the views, the asset kind does not match the household's need, or either is busy. A known runtime with no free option stays Act now (team lane rules: uncovered work surfaces) and the board row now says 'No free option' instead of a dash. Co-Authored-By: Claude <[email protected]>
Tabs and private windows of one browser share localStorage, so a single token gave every tab the same role. main.tsx now keeps a token per screen (board = coordinator, register/resident = resident, driver = driver). The SDK pools connections by host and database, so in live mode moving to a screen with another role reloads into that identity; fixture navigation never reloads. Role-gate copy no longer says to use private windows. Recording a phone reply now reuses one eventId and observedAt per answer until it succeeds, so a retry after a lost response is a server-side no-op. Co-Authored-By: Claude <[email protected]>
After delivery the drawer offers 'Release BAT-01 and Ana for the next household', calling A's releaseJob (#39) with the job's version. Once the battery and driver no longer hold the job it says they are free. Merged main for the TL-11 bindings. A confirmed delay report now gets its own report ID, reused only when retrying that same report, so a later report on the route is not treated as a duplicate. Co-Authored-By: Claude <[email protected]>
… appear driver_jobs keeps every job for the driver and carries no release state, so after delivery the driver screen now reads 'Job 1 done' and says the next job appears as soon as a coordinator assigns it. A newer job replaces it automatically, since the phone shows the latest job. Co-Authored-By: Claude <[email protected]>
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
src/live/RoleGate.tsx): every live screen checksmyRole. A window with no role shows a claim form (claimInvite). A window with the wrong role is told to open a separate private window. Each window holds one role.src/live/LiveBoard.tsx): lanes, KPI tiles and route options come from the coordinator views. The coordinator can record a reply taken by phone (ingestCheckin), confirm a +20 min route delay (confirmRouteReport) and reserve (reservewithexpectedVersion). The drawer shows the committed job, its 3-step status and a read-only thread.src/live/LivePhone.tsx): the driver and resident readdriverJobs/residentJobsandjobMessages. Messages show Sending…, then sent; a failed send can be retried and reuses itsclientMessageId. The driver taps I have arrived and the resident taps I received the battery (updateJobwithexpectedVersion). Serverconflict:/forbidden:/rejected:errors are shown.How it was tested (Maincloud, 3 separate authenticated browser contexts)
npx tsc -bandnpm run buildpass after merging current main.Not done or not verified
Clock: why this PR doesn't change it
The client uses real time on purpose, because the server does too.
reservecomputes the committedetaAtfromctx.timestamp. If the board used the incident clock instead, it would disagree with the ETA the server commits and texts to the resident. The wrong numbers come from the seed: it sets drivers' and batteries'freeAtto the incident clock (02:00 Nov 8). The fix is to seedfreeAtrelative to the publish time, or add an owner reducer that re-anchors the incident to now. That's A's module, tracked in #34, and it needs no change to this PR. Until then, record the margin story after 2 AM or in fixture mode.Review follow-ups since opening
releaseJob, TL-11 support: silent follow-ups with owners, audit and job release #39). On Maincloud this waits for A's TL-11 republish (TL-18 | Demo seed on real time, one lead incident, and a repeatable Maincloud reset #34), and until then the drawer shows "no such reducer".Needs from A
freeAtis the incident clock (02:00 Nov 8), but readiness uses real time. Arrivals show about 02:13 and margins are about −200 min until then. SeedfreeAtrelative to now, or line the clocks up.Setup
Live mode needs
VITE_SPACETIMEDB_HOSTandVITE_SPACETIMEDB_DB_NAMEin.env.local(gitignored). No invite codes are in the repo.🤖 Generated with Claude Code