Skip to content

Add impossible-kinematics detector + 4x tests/demos, harden error paths#5

Open
cognis-digital wants to merge 1 commit into
mainfrom
feat/kinematics-detector-4x-depth
Open

Add impossible-kinematics detector + 4x tests/demos, harden error paths#5
cognis-digital wants to merge 1 commit into
mainfrom
feat/kinematics-detector-4x-depth

Conversation

@cognis-digital

Copy link
Copy Markdown
Owner

Summary

Deepens adsbwatch with 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).
  • CLI: 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)

  1. decision.load_sensor_events("") crashed with an opaque JSONDecodeError"" in "[{" is True in Python, so empty/whitespace input fell into the JSON branch. Now: empty/whitespace/None[]; malformed input → a clear ValueError.
  2. intel._iso() crashed with OverflowError on 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 -q is 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.py and docs/DEMOS.md updated; each scenario exits 0 offline.

Test plan

  • python -m pytest -q → 201 passed
  • python demos/run_all.py → exits 0 (all 20)
  • each demo exits 0 standalone under PYTHONUTF8=1
  • public API unchanged (only additive kwargs/flags)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant