Skip to content

TL-03: dispatch rules and tornado/freeze fixtures - #18

Merged
SJAryan merged 1 commit into
mainfrom
c/tl-03-dispatch-rules
Nov 8, 2026
Merged

SJAryan merged 1 commit into
mainfrom
c/tl-03-dispatch-rules

Conversation

@KsAashrith87

Copy link
Copy Markdown
Collaborator

Closes #3.

What: Pure TS dispatch rules in spacetimedb/src/domain/dispatch.ts (readyAt, evaluateOptions → lane, reason, best option, sorted options). Tornado fixture reuses TL-01 IDs (tornado-1, H17, H22, BAT-01, ana, 08:00Z) plus routes R4 / R4-ALT and the 20-min detour. Freeze fixture (freeze-1) uses distinct IDs. All data synthetic.

Check: npm install && npx tsx --test fixtures/*.test.ts → 10 pass, 0 fail.

  • R4 +17…+47 → Watch
  • After confirmed 20-min detour: R4 −3…+27, best R4-ALT +6…+36 → Act now
  • +15 Watch / +14 Act now; unknown runtime; open-ended upper bound; window anchored to report time; busy driver; no compatible resource; silent household
  • Freeze incident through the same function

Status: fixture only, not wired into the module. Module tsc --noEmit still clean.

For A (TL-05): import evaluateOptions from ./domain/dispatch. Needs route/travel inputs per option (driverToAssetMin, pickupMin, assetToHomeMin, setupMin, confirmedDelayMin, driverFreeAt, assetFreeAt). Times are epoch ms: Number(ts.microsSinceUnixEpoch / 1000n).
For D: expected numbers on the coordinator card: R4 +17 → −3, best option +17 → +6, Watch → Act now.

🤖 Generated with Claude Code

Refs #3. Pure TypeScript rules in spacetimedb/src/domain/dispatch.ts
(readyAt, evaluateOptions -> lane, reason, best option, sorted options).
Fixtures reuse A's TL-01 IDs (tornado-1, H17, H22, BAT-01, ana, 08:00Z)
and add a freeze incident with distinct IDs.

Proof: npx tsx --test fixtures/*.test.ts -> 10 pass, 0 fail.
R4 +17..+47 Watch; after the 20-min detour R4 -3..+27, best R4-ALT
+6..+36, Act now; +15 Watch / +14 Act now; unknown, open-ended,
report-time anchoring, busy driver, no compatible resource, silent.

Status: fixture only. A imports evaluateOptions in TL-05 and needs
route/travel tables to feed it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

TL-03 | Build two disaster fixtures and dispatch rules

2 participants