mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
* chore: excise the dead Central NATS consumer path
Central was retired and its database dropped 2026-07-15; its NATS broker no
longer exists. Verified against the live CT108 deployment: all 12 adapters
run feed_source=native, zero on central, and central.enabled is False
(default, never overridden). The consumer and its handlers were unreachable.
Removed:
- central/consumer.py and 6 dead handlers (nws, quake, swpc, nwis, avy,
incident) -- their handle_* entrypoints were reachable only from the
consumer's dispatch
- the Central wiring in main.py (init, guarded start, retry loop, stop path)
- the dead config surface: CentralConsumerConfig, EnvironmentalConfig.central,
adapter_config ("central","severity_thresholds") and its display block
- the nats-py dependency (consumer.py was its only importer)
- 19 test files that exercised only the dead path
KEPT -- these live under central/ but are imported directly by native
adapters, and deleting them would break production:
- wfigs_handler.py: firms_handler._handle_pass_boundary() calls its _render()
on the live FIRMS growth-fire path (env/firms.py -> ingest_hotspot_pixel)
- firms_handler, satpass_handler, tle_handler: split files whose handle_*
entrypoints are dead but whose engines are live. Left intact; splitting
them is separate work.
- pass_predictor, budget, idaho_gauge_sites: fully live.
The usgs_quake keys global_mag_floor / regional_mag_floor / regional_centroid
/ regional_radius_mi / broadcast_pager_alerts are NOT removed despite comments
labelling them "CENTRAL-PATH ONLY" -- notifications/gating/quake.py reads them
unconditionally in the native path. Those comments are corrected separately.
Test-count note: the suite drops ~425 tests. Most were migration PARITY tests
whose sole purpose was proving the native rewrite byte-matched the Central
handler (golden byte-parity, cross-source identity, gate-sequence replay).
With the handler deleted there is nothing left to compare against, so they
cannot exist. Native-only tests were kept and reworked where a test reached
for a central symbol incidentally. This is a real coverage loss, accepted
deliberately: the parity harness proved the refactor faithful, and git
history preserves the originals.
Suite: 1984 passed, 6 failed -- the same 6 pre-existing failures as main
(stale SCHEMA_VERSION x3, expired TLE fixtures x2, one order-dependent),
all being fixed on fix/green-test-suite. No new failures.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(nws): restore native-only golden coverage for the wire formatter
Commit ca751fb5 deleted the Central nws_handler parity harness along with
the handler itself, which took the ONLY tests that pinned formatters.nws
.format()'s literal wire output. Gate-sequence and schema-conformance
tests already survived natively; the formatter's actual rendered text did
not have any native-only regression net.
Add TestFormatterGolden to test_nws_refactor.py: 3 real-fixture cases plus
6 hand-built pathological cases mined from the deleted test_nws_handler.py
(SVR path-sampling, the "no dangling separator" regression, TOR on-ground
vs radar-indicated, FFW flood-cause detection). Every literal was verified
by temporarily restoring the pre-excision central.nws_handler._render()
from git history (ca751fb5^) in a throwaway, uncommitted script, confirming
byte-identical output against the current native format() for all 37 real
fixtures (nws/ + nws_last/) and all 9 pathological cases, then pinning the
confirmed-matching string as the literal -- not a blind snapshot of
current behavior.
quake/swpc/avalanche/hydro/incident/fire were checked and already carry
equivalent native-only golden coverage (added directly in ca751fb5), so no
changes were needed there.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Matt Johnson <mj@k7zvx.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
96 lines
3.4 KiB
Python
96 lines
3.4 KiB
Python
"""Tests for satpass adapter registration on EnvironmentalConfig.
|
|
|
|
Verifies:
|
|
- SatpassConfig exists and defaults to feed_source="central"
|
|
- EnvironmentalConfig.satpass field is present and correctly typed
|
|
- _subject_owned() includes central.sat.* subjects when satpass is registered
|
|
- adapter_config REGISTRY contains satpass keys with valid types
|
|
"""
|
|
|
|
import pytest
|
|
|
|
|
|
# -- config model tests -------------------------------------------------------
|
|
|
|
def test_satpass_config_exists():
|
|
from meshai.config import SatpassConfig
|
|
cfg = SatpassConfig()
|
|
assert cfg.feed_source == "central"
|
|
assert cfg.enabled is False
|
|
|
|
|
|
def test_satpass_config_is_sourced_feed():
|
|
from meshai.config import SatpassConfig, _SourcedFeed
|
|
assert issubclass(SatpassConfig, _SourcedFeed)
|
|
|
|
|
|
def test_satpass_config_rejects_invalid_feed_source():
|
|
from meshai.config import SatpassConfig
|
|
with pytest.raises(ValueError, match="feed_source"):
|
|
SatpassConfig(feed_source="bogus")
|
|
|
|
|
|
def test_environmental_config_has_satpass():
|
|
from meshai.config import EnvironmentalConfig, SatpassConfig
|
|
env = EnvironmentalConfig()
|
|
assert hasattr(env, "satpass")
|
|
assert isinstance(env.satpass, SatpassConfig)
|
|
|
|
|
|
def test_environmental_satpass_default_central():
|
|
from meshai.config import EnvironmentalConfig
|
|
env = EnvironmentalConfig()
|
|
assert env.satpass.feed_source == "central"
|
|
|
|
|
|
# -- adapter_config REGISTRY --------------------------------------------------
|
|
|
|
def test_registry_has_satpass_enabled():
|
|
from meshai.adapter_config.defaults import REGISTRY
|
|
assert ("satpass", "enabled") in REGISTRY
|
|
spec = REGISTRY[("satpass", "enabled")]
|
|
assert spec["type"] == "bool"
|
|
assert spec["default"] is False
|
|
|
|
|
|
def test_registry_satpass_types_valid():
|
|
"""All satpass REGISTRY entries must use types in the valid vocabulary."""
|
|
from meshai.adapter_config.defaults import REGISTRY
|
|
valid = {"int", "float", "str", "bool", "json"}
|
|
satpass_keys = [(a, k) for a, k in REGISTRY if a == "satpass"]
|
|
assert len(satpass_keys) >= 5, f"Expected >= 5 satpass keys, got {len(satpass_keys)}"
|
|
for a, k in satpass_keys:
|
|
assert REGISTRY[(a, k)]["type"] in valid, (
|
|
f"satpass.{k} has invalid type {REGISTRY[(a, k)]['type']!r}"
|
|
)
|
|
|
|
|
|
def test_registry_satpass_list_types_are_json():
|
|
"""List-valued satpass keys must use type='json', not 'list'."""
|
|
from meshai.adapter_config.defaults import REGISTRY
|
|
for key in ("observers", "norad_ids", "command_norad_ids"):
|
|
spec = REGISTRY[("satpass", key)]
|
|
assert spec["type"] == "json", (
|
|
f"satpass.{key} should be type='json', got {spec['type']!r}"
|
|
)
|
|
|
|
|
|
def test_adapter_meta_has_satpass():
|
|
from meshai.adapter_config.defaults import ADAPTER_META
|
|
assert "satpass" in ADAPTER_META
|
|
|
|
|
|
# -- YAML round-trip -----------------------------------------------------------
|
|
|
|
def test_yaml_parsing_satpass():
|
|
"""SatpassConfig should be deserialized from YAML config dict."""
|
|
from meshai.config import SatpassConfig, _dict_to_dataclass, EnvironmentalConfig
|
|
import yaml
|
|
|
|
yaml_str = "environmental:\n satpass:\n enabled: true\n feed_source: central\n"
|
|
data = yaml.safe_load(yaml_str)
|
|
env = _dict_to_dataclass(EnvironmentalConfig, data["environmental"])
|
|
assert isinstance(env.satpass, SatpassConfig)
|
|
assert env.satpass.enabled is True
|
|
assert env.satpass.feed_source == "central"
|
|
|