Add impossible-kinematics detector + 4x tests/demos, harden error paths#5
Open
cognis-digital wants to merge 1 commit into
Open
Add impossible-kinematics detector + 4x tests/demos, harden error paths#5cognis-digital wants to merge 1 commit into
cognis-digital wants to merge 1 commit into
Conversation
Detector
- New impossible_kinematics detector in core.analyze(): flags a single ICAO
whose consecutive geolocated reports imply a ground speed above a tunable
ceiling (default 3500 kt) — a classic position-spoof / injected-track / cloned
transponder signature. Public API stays stable: analyze() gains an optional
kinematics_max_speed_kt kwarg (0/negative disables it) and scan gains --max-speed.
- decision.recommend() gains an advisory playbook for the new kind.
Bug fixes (found while adding edge-case tests)
- decision.load_sensor_events("") / whitespace crashed with an opaque
JSONDecodeError because "" in "[{" is True in Python. Rewrote the CSV/JSON
detection: empty/whitespace/None -> [], malformed input -> clear ValueError.
- intel._iso() crashed with OverflowError on an out-of-range epoch (garbage
timestamp in a real feed), taking the whole GeoJSON/STIX export down. Now
falls back to the sentinel timestamp.
Tests: 49 -> 201 passing (test_core_edge, test_kinematics, test_cli_errors,
test_intel_edge, test_decision_edge, test_feeds_edge, test_datafeeds).
Demos: 5 -> 20 scenarios; run_all.py + docs/DEMOS.md updated. Each exits 0 offline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Deepens
adsbwatchwith a new detector, a 4x-larger test suite and demo set, and two real bug fixes — all while keeping the public API stable.New detector: impossible kinematics (position spoofing)
core.analyze()now flags a single ICAO whose consecutive geolocated reports imply a ground speed above a tunable ceiling (default 3500 kt — well above any real aircraft). A track that "teleports" is the classic signature of a spoofed / injected position or a cloned transponder.analyze(..., kinematics_max_speed_kt=...)— optional kwarg,0/negative disables it (API stays backward-compatible).adsbwatch scan feed.csv --max-speed 900.decision.recommend()gains an advisory playbook for the new kind (sensing / verification / evidence — no effectors).Bug fixes (surfaced by the new edge-case tests)
decision.load_sensor_events("")crashed with an opaqueJSONDecodeError—"" in "[{"isTruein Python, so empty/whitespace input fell into the JSON branch. Now: empty/whitespace/None→[]; malformed input → a clearValueError.intel._iso()crashed withOverflowErroron an out-of-range epoch (a garbage timestamp in a real feed would take the whole GeoJSON/STIX export down). Now falls back to the sentinel timestamp like the other error cases.Tests: 49 → 201
New files:
test_core_edge,test_kinematics,test_cli_errors,test_intel_edge,test_decision_edge,test_feeds_edge,test_datafeeds— edge cases, error paths, malformed CSV/JSON, kinematics detector, GeoJSON/STIX export integrity, decision-support scope guard, offline feed + air-gap snapshot round-trip.python -m pytest -qis green.Demos: 5 → 20
Scenarios 06–20 cover impossible kinematics, GeoJSON/STIX exports, region clip, air-gap snapshot, triage, sensor fusion, the advisory playbook + scope guard, malformed-input hardening, loiter tuning, the full pipeline, a clean-feed baseline, emergency response, CLI exit codes, and a combined spoof signature.
run_all.pyanddocs/DEMOS.mdupdated; each scenario exits 0 offline.Test plan
python -m pytest -q→ 201 passedpython demos/run_all.py→ exits 0 (all 20)PYTHONUTF8=1