mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
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:
parent
7c15fa3f09
commit
6bc57709a2
19 changed files with 546 additions and 116 deletions
|
|
@ -173,3 +173,21 @@ def test_commit_callback_updates_last_broadcast(mem_db):
|
|||
"SELECT last_broadcast_at FROM quake_events WHERE event_id='cb1'"
|
||||
).fetchone()
|
||||
assert post["last_broadcast_at"] == 1_000_001
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# Budget-fit SAFETY CAP: a freak-long USGS place string must still fit 140.
|
||||
# ============================================================================
|
||||
|
||||
from meshai.central.quake_handler import _render as _quake_render
|
||||
|
||||
|
||||
def test_quake_render_worst_case_fits_140():
|
||||
place = ("293 km SSW of a pathologically long place description island "
|
||||
"region in the remote northern pacific ocean near absolutely nowhere "
|
||||
"at all off the coast of the far edge of the map")
|
||||
wire = _quake_render(mag=7.9, place=place, depth_km=12, lat=44.123,
|
||||
lon=-114.987, tsunami=True, is_update=False)
|
||||
assert len(wire) <= 140, f"{len(wire)} chars:\n{wire!r}"
|
||||
# magnitude survives on the (critical) first line
|
||||
assert "M7.9" in wire
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue