correlator: stop non-primary scenes inheriting the call doc's pin (#87)
Build & Deploy / Build & push images (push) Successful in 4m30s
Build & Deploy / Deploy to VM (push) Successful in 1m47s
Build & Deploy / Report a failed deploy (push) Skipped

_build_context fell back to call_doc.get("location_coords") whenever a
scene passed no coordinates of its own. One radio call can be split
into several scenes, but only the primary scene's geocode is ever
written to the call doc — so every non-primary scene silently
inherited the primary scene's pin. That fabricated location_proximity,
the strongest accept signal the correlator has, for a scene that had
no location at all, and drove it into the primary scene's incident on
a pin it never had.

Drop the fallback: coords = location_coords. A scene with no location
is now correctly judged thin, cannot win the location path, cannot
supply call_coords to _call_fits_incident, and cannot seed
_find_cross_system_parent.

recorrelation_sweep.py, the only other caller of correlate_call, was
verified to already pass both location and location_coords explicitly
from the call doc, so the fallback there was a no-op and this change
is behavior-preserving for that path.

Adds test_a_scene_with_no_location_does_not_inherit_the_call_docs_pin
to test_incident_identity.py, pinning ctx["coords"] is None and
ctx["is_thin_call"] is True when location=None but the call doc
carries a location_coords.

Ref: server-26#87
This commit is contained in:
Logan Cusano
2026-08-31 02:45:31 -04:00
parent 29c2fb11b9
commit bdb57ae75a
2 changed files with 33 additions and 1 deletions
@@ -789,7 +789,14 @@ async def _build_context(
location = clean_location(location)
if location is None:
location_coords = None
coords = location_coords or call_doc.get("location_coords")
# NOT `location_coords or call_doc.get("location_coords")` — server-26#87.
# A radio call can be split into several scenes, and only the primary
# scene's geocode is written to the call doc. Falling back to it here
# would hand every non-primary scene the primary scene's pin, fabricating
# location_proximity (the strongest accept signal) for a scene that has
# no location of its own and driving over-merges. If a scene passes no
# coords, it has none — it is judged thin and must win on its own signal.
coords = location_coords
is_thin_call = _is_thin_call(
call_units, call_vehicles, coords, tags, location, call_severity, reassignment
)