Skip to content

Dispatch consumes telemetry.driver-location-updated — W006 slice 5, CritterCab's first cross-service flow - #47

Merged
erikshafer merged 8 commits into
mainfrom
feat/dispatch-slice-5-nearby-available-drivers
Jul 25, 2026
Merged

Dispatch consumes telemetry.driver-location-updated — W006 slice 5, CritterCab's first cross-service flow#47
erikshafer merged 8 commits into
mainfrom
feat/dispatch-slice-5-nearby-available-drivers

Conversation

@erikshafer

Copy link
Copy Markdown
Owner

Closes the last pending W006 slice. W006's slice walk is complete: all five slices now run.

Dispatch consumes telemetry.driver-location-updated into per-driver AvailableDriver documents, backs the slice-5.3 INearbyAvailableDriversSource port with an H3 k-ring query over them, and demotes NearbyAvailableDriversStub to a test double — closing W001 §10 parking-lot #4 in code, three months after the design closed it on paper.

This is CritterCab's first cross-service flow. Until now "two services" meant two services that never spoke; a GPS ping entering Telemetry over gRPC now comes out as a document write in Dispatch, over Kafka, in a different bounded context.

Firsts

  • Dispatch's first transport — everything it did before was in-process Marten over HTTP.
  • First time two services compile the same .proto. Deliberately not a shared assembly: Wolverine's message identity is Type.FullName-based and assembly-agnostic, so the real coupling is the proto's csharp_namespace, not the assembly.
  • First non-event-sourced document inside an event-sourced BC. Event-sourcing the inbound feed would reimport onto Dispatch's event store exactly the volume Telemetry's throttle exists to suppress.

CandidateSelectionAutomation.cs does not appear in the diff — which was the entire point of building the port as a seam back in slice 5.3.

Decisions escalated rather than absorbed

Four forks, all signed off:

  1. A driver with a location but no availability data is excluded from selection. The ASB half is a forward-constraint to an un-workshopped Driver Profile BC, so that is currently every driver. Defaulting to Available/STANDARD was rejected: it would fabricate a capability claim Dispatch has no source for, invisibly, at the point of query.
  2. The H3 query resolution is read from the most recently ingested document, not held as a Dispatch-side constant that would silently drift from Telemetry's policy.
  3. EtaSeconds is derived from distance against a constant invented at implementation time and labelled as such.
  4. BeginAtLatest() cold-start policy, chosen on W006 §6.4's own eviction logic. BeginAtEarliest() would have turned four failing tests green in one line while quietly committing the service to replaying its entire retained topic on every fresh deploy.

Two real defects found before merge

  • Per-side LWW. The first cut used one shared Marten revision column where W006 §6.5 locks "LWW per driver per side". A heartbeat position stamped after an availability transition would silently discard it, leaving an offline driver dispatchable with no error anywhere. Found by code-review's two-axis pass — with both axes converging on it independently — after a source-verification pass and two convention audits had run clean. Fixed by separating business ordering (per-side timestamp comparison) from write concurrency (an incrementing revision plus a ConcurrencyException retry policy). The regression tests were themselves verified by reverting the old behaviour; a first version of them passed against both implementations and proved nothing.
  • H3 k-ring under-coverage. DeriveK divided by the axis-aligned hexagon spacing (edge × √3) rather than the worst-case per-ring advance (edge × 1.5), so at the production 5 km radius drivers near the edge were silently dropped. Invisible at the 1 km value the test originally used.

Also

57/57 tests green (35 Dispatch, 22 Telemetry), up from 33. No pre-existing test modified.

Prompt: docs/prompts/implementations/009-dispatch-w006-slice-5-nearby-available-drivers.md
Retro: docs/retrospectives/implementations/009-dispatch-w006-slice-5-nearby-available-drivers.md

@erikshafer erikshafer self-assigned this Jul 25, 2026
@erikshafer
erikshafer merged commit 327916d into main Jul 25, 2026
1 check passed
@erikshafer
erikshafer deleted the feat/dispatch-slice-5-nearby-available-drivers branch July 25, 2026 06:11
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