Skip to content

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

Merged
SJAryan merged 2 commits into
mainfrom
c/tl-03-dispatch-rules-v2
Nov 8, 2026
Merged

SJAryan merged 2 commits into
mainfrom
c/tl-03-dispatch-rules-v2

Conversation

@KsAashrith87

@KsAashrith87 KsAashrith87 commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #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

Reapplies 1643c69, which #18 merged and #19 reverted. Same four files,
unchanged. Refs #3.

Proof: npx tsx --test fixtures/*.test.ts -> 10 pass, 0 fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@KsAashrith87 KsAashrith87 changed the title TL-03: dispatch rules and tornado/freeze fixtures (reapply) TL-03: dispatch rules and tornado/freeze fixtures Nov 8, 2026
evaluateOptions returned act_now before checking silence, so an overdue,
unanswered household lost its silent status when its margin fell under
+15 or no compatible resource existed. CaseResult now carries a separate
`silent` flag computed before any lane decision; lane order is unchanged.

Proof: npx tsx --test fixtures/*.test.ts -> 11 pass, 0 fail. The new
regression test and two silent assertions fail on 1d99a61.

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.

2 participants