models.py types incident location as coordinates, so PUT /incidents/{id} cannot set one #29

Open
opened 2026-08-23 01:36:06 -04:00 by logan · 0 comments
Owner

IncidentRecord, IncidentCreate and IncidentUpdate in drb-c2-core/app/models.py all declare location: Optional[Dict[str, float]].

Every actual writer and reader treats location as the human-readable label string — incident_correlator._resolve_location_pair, intelligence.py, summarizer._sync_summarize (which renders it as "unknown location" when missing), and the frontend incident header. The coordinates live in a separate location_coords field, which none of the three models has at all.

Consequences:

  • PUT /incidents/{incident_id} cannot set a location — a string fails pydantic validation, and a dict would write a shape nothing else can render.
  • models.py is the de facto schema for a schemaless Firestore (see CLAUDE.md), so it actively misdescribes the incidents collection for anyone reading it.

Noticed while fixing server-26#23. Not fixed there because correcting the type means auditing every consumer of these three models, including routers/incidents.py create/update and the frontend types.

Also tracked in DEFERRED.md (Version 5C root, Server section).

`IncidentRecord`, `IncidentCreate` and `IncidentUpdate` in `drb-c2-core/app/models.py` all declare `location: Optional[Dict[str, float]]`. Every actual writer and reader treats `location` as the human-readable label **string** — `incident_correlator._resolve_location_pair`, `intelligence.py`, `summarizer._sync_summarize` (which renders it as `"unknown location"` when missing), and the frontend incident header. The coordinates live in a separate `location_coords` field, which none of the three models has at all. Consequences: * `PUT /incidents/{incident_id}` cannot set a location — a string fails pydantic validation, and a dict would write a shape nothing else can render. * models.py is the de facto schema for a schemaless Firestore (see CLAUDE.md), so it actively misdescribes the `incidents` collection for anyone reading it. Noticed while fixing server-26#23. Not fixed there because correcting the type means auditing every consumer of these three models, including `routers/incidents.py` create/update and the frontend types. Also tracked in DEFERRED.md (Version 5C root, Server section).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: logan/server-26#29