fix: add satpass to region rewrite table in _subjects_for()

_subjects_for() consults a per-adapter region table when region is set
(e.g. us.id). The table had no satpass entry, so it returned [] and
Central silently subscribed to nothing for sat subjects.

Changes:
- Add satpass entry to the region table: pass alerts use Convention A
  (central.sat.pass.{region}.>), TLEs are global (central.sat.tle.>)
- Update test_central_region_default_propagates_to_consumer_subjects
  to expect satpass subjects (satpass defaults to feed_source=central)
- Add 3 tests in test_satpass_registration.py: _subjects_for with
  region, without region, and empty region fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt Johnson (via Claude) 2026-06-12 15:33:25 +00:00
commit 4a17c7b702
3 changed files with 42 additions and 1 deletions

View file

@ -115,3 +115,33 @@ def test_yaml_parsing_satpass():
assert isinstance(env.satpass, SatpassConfig)
assert env.satpass.enabled is True
assert env.satpass.feed_source == "central"
# -- _subjects_for() region rewrite table ------------------------------------
def test_subjects_for_satpass_with_region():
"""_subjects_for('satpass', 'us.id') must return region-scoped pass
subjects and global TLE subject."""
from meshai.central.consumer import _subjects_for
result = _subjects_for('satpass', 'us.id')
assert len(result) == 2, f'Expected 2 subjects, got {len(result)}: {result}'
assert result[0] == 'central.sat.pass.us.id.>'
assert result[1] == 'central.sat.tle.>'
def test_subjects_for_satpass_no_region_falls_back():
"""_subjects_for('satpass', None) must return bare-wildcard forms
from _SUBJECTS_BARE."""
from meshai.central.consumer import _subjects_for
result = _subjects_for('satpass', None)
assert len(result) == 2, f'Expected 2 subjects, got {len(result)}: {result}'
assert result[0] == 'central.sat.pass.>'
assert result[1] == 'central.sat.tle.>'
def test_subjects_for_satpass_empty_region_falls_back():
"""_subjects_for('satpass', '') must behave like None — bare wildcards."""
from meshai.central.consumer import _subjects_for
result = _subjects_for('satpass', '')
assert result == _subjects_for('satpass', None)