meshai/work/tests/test_satpass_handler.py
Matt Johnson e90d30accb chore(central-ripout 2b): update satpass/tle test suite for the relocation
Repoints every remaining test import at the new env.satellite.* modules
and removes/adapts coverage for the Central envelope-ingest path deleted
in this pass (handle_satpass, consolidate_satpass_pending, handle_tle, and
the filtering/coercion/staleness logic that lived only inside them):

- test_satpass_native.py, test_tle_fetch.py, test_satpass_command.py:
  import-path updates only (pass_predictor, tle_store). Also dropped
  test_satpass_command.py's TestTLEUpsert.test_returns_none_always
  (handle_tle-specific contract, no longer applicable) and rewrote its two
  latest-wins tests to call upsert_tle directly — same behavior under test,
  now exercised through the still-live primitive instead of the dead
  wrapper.
- test_satpass_native.py: deleted test_central_consolidate_feeds_shared_gate_merged
  (spied on consolidate_satpass_pending, which no longer exists). The
  merge-across-observers logic it guarded is native-side (_consolidate)
  and already covered by test_two_observers_consolidate_to_one_broadcast.
- test_satpass_handler.py: gutted to the one test that calls format_pass
  directly (test_format_pass_worst_case_fits_140); the rest exercised
  handle_satpass's observer/norad/elevation filters, which have no live
  equivalent (the native adapter filters at the config level, not
  per-envelope) and is redundant with test_satpass_native.py's dedup/wire
  coverage via the real SatpassAdapter path.
- test_satpass_broadcast_safety.py: kept every test that calls format_pass
  or gate_consolidated_pass-adjacent REGISTRY checks directly (wire format,
  clean-format rules, REGISTRY defaults); deleted TestNoradIdTypeCoercion
  and TestStalenessGuard (handle_satpass-only logic, no live equivalent)
  and the 6 _elevation_bucket tests (_elevation_bucket itself was dead
  before this pass too — zero callers anywhere but its own tests, already
  superseded by the numeric "max NN°" wire format per its own docstring).
- test_satpass_persisted_timer.py: dropped test_due_at_persisted_on_normal_ingest
  (handle_satpass-only); kept the two schema/migration tests, which don't
  touch satpass_handler.
- Deleted outright (tested ONLY the dead Central envelope-ingest path, no
  live equivalent to port to): test_satpass_event_path.py,
  test_satpass_compass_fallback.py, test_satpass_wire_fields.py.

Full suite: 2059 passed, 0 failed (was 0 failed on main pre-change).
Satpass/TLE subset (99 tests across 8 files) verified green in isolation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 21:37:23 +00:00

37 lines
1.7 KiB
Python

"""v0.7 satpass_handler tests.
The Central envelope-ingest path (`handle_satpass`,
`consolidate_satpass_pending`, and the observer/norad/elevation/staleness
filtering that lived inside them) was retired with the Central NATS
consumer and deleted 2026-07 when the still-live wire-formatting + gate
code (`format_pass`, `gate_consolidated_pass`) moved to
`meshai.env.satellite.pass_format`. That live code's coverage now lives in
tests/test_satpass_native.py (dedup, wire format, commit callback, via the
native SatpassAdapter path) and tests/test_satpass_broadcast_safety.py
(format_pass formatting rules called directly). What remains here is the
one test that calls `format_pass` directly and doesn't fit either of those
files' focus.
"""
from __future__ import annotations
# ============================================================================
# Budget-fit SAFETY CAP: a pathologically long satellite name must not push
# the broadcast string past 140 chars. Calls format_pass directly (bypasses
# the consolidation path entirely).
# ============================================================================
def test_format_pass_worst_case_fits_140():
from meshai.env.satellite.pass_format import format_pass
wire = format_pass(
sat_name=("NOAA-19 EXPERIMENTAL SUPER LONG SATELLITE DESIGNATION "
"PAYLOAD REVISION X PROTOTYPE FLIGHT MODEL SERIAL 00042"),
max_el=78.0,
aos_epoch=1719900000, los_epoch=1719900780,
aos_compass="NNW", los_compass="SSE",
entry_observer="Treasure Valley Observatory West Ridge Site",
exit_observer="Magic Valley Observatory East Rim Station",
broadcast=True,
)
assert len(wire) <= 140, f"{len(wire)} chars:\n{wire!r}"