feat(broadcast): fit all mesh message formats to the packet budget (#8)

Tighten broadcast formats to fit 140 chars with critical info preserved:
traffic (directions/milepost never abbreviated, narrative trimmed from
end), nws hazard wording tightened (towns already path-sampled), fires
(drop ID line + ** + discovery time), avy (advice -> first sentence),
satpass/quake safety cap. Fire digest broadcast disabled by default.
All budget-aware via the shared max_chars.

Co-authored-by: Matt Johnson <mj@k7zvx.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
malice 2026-07-02 16:49:33 -06:00 committed by GitHub
commit 6bc57709a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 546 additions and 116 deletions

View file

@ -171,3 +171,24 @@ class TestSatpassHandler:
result = handle_satpass(env, "central.sat.pass.iss", data={}, now=1718163120)
assert result is None
# ============================================================================
# Budget-fit SAFETY CAP: a pathologically long satellite name must not push
# the broadcast string past 140 chars. Calls format_pass directly (bypasses
# the broken consolidation path).
# ============================================================================
def test_format_pass_worst_case_fits_140():
from meshai.central.satpass_handler 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}"