Emit emergency-squawk events from local ADS-B adapter (M2)#12
Conversation
Close out the last partial Milestone 2 deliverable (PRD §32): the local ADS-B adapter recognized emergency squawks but only tagged the track. It now also emits a discrete critical EventRecord on the onset edge. - ThrottleGate.admit() returns Admission(publish, emergency_onset); the not-emergency -> 7500/7600/7700 (or explicit transponder emergency) edge was already computed for the immediate-publish bypass and is now exposed rather than discarded. - On that edge local_adsb_records() yields a critical EventRecord (event_type=emergency_squawk, subject_id=track, geometry=last position, local_rf provenance copied from the track). Fires once per onset; a steady stream of the same squawk does not re-fire. - EMERGENCY_SQUAWK_MEANINGS maps each code to plain language. No frontend change: the existing EventFeed already renders events. Tests: unit onset detection + generator event + steady no-refire; integration aircraft_emergency.json exercises adapter -> MQTT -> backend -> websocket end to end. Adjusts one pre-existing test whose item ordering shifts because the standard fixture already carries a 7700 aircraft. scripts/check.sh green (125 passed). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request implements the M2 emergency-squawk event template. It updates the local ADS-B adapter to detect when an aircraft transitions into an emergency state (e.g., squawking 7500, 7600, or 7700) and emits a discrete critical EventRecord on the stream. To support this, ThrottleGate.admit now returns an Admission named tuple indicating both whether to publish and whether an emergency onset occurred. New integration and unit tests have been added to verify this behavior. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Closes out the last partial Milestone 2 (Local RF baseline) deliverable from PRD §32: emergency-squawk templates. The local ADS-B adapter already recognized emergency squawks but only tagged the track — it never surfaced a discrete event. It now emits a critical
EventRecordon the onset edge, rendered by the existingEventFeed.What changed
ThrottleGate.admit()now returnsAdmission(publish, emergency_onset). The not-emergency →7500/7600/7700(or explicit transponderemergency) edge was already computed for the immediate-publish bypass; it's now exposed rather than discarded.local_adsb_records()yields a criticalEventRecord(event_type=emergency_squawk,severity=critical,subject_id=track,geometry=last position,local_rfprovenance copied from the track). Fires once per onset — a steady stream of the same squawk does not re-fire.EMERGENCY_SQUAWK_MEANINGSmaps each code to plain language (e.g.7700 → general emergency).EventFeedalready rendersevent_type+summary.This is the event substrate the M4 alert-rule engine will later consume — not the rule engine itself.
Tests / verification
aircraft_emergency.json) exercises the full path adapter → MQTT → backend → websocket and asserts aeventframe with critical severity,7700in the summary, Point geometry, andlocal_rf: true.7700aircraft (so the onset event now correctly fires for it too).scripts/check.shgreen — ruff + mypy (strict) + 125 tests passed.🤖 Generated with Claude Code