mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
- Move all application source (meshai/, dashboard-frontend/, tests/, config/, docs/, Dockerfile, etc.) into work/ directory - Add Node.js multi-stage build to Dockerfile for frontend compilation; remove compiled static assets from git tracking - Fix satpass missing time windows: consolidation was splitting wire on newline and only putting line 1 in event.title, dropping the time window line that the composer uses for precomposed broadcasts - Fix satpass burst flooding: stagger consolidation timers (+60s per pending pass) so Central batch publishes don't blast the mesh - Update CI workflow build context to work/ - Anchor lib/ and data/ gitignore patterns to repo root to prevent false matches on nested directories - Add dashboard-frontend/node_modules/ to .dockerignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
"""v0.4 C.1: per-adapter `source` field + CentralConsumerConfig."""
|
|
|
|
import pytest
|
|
|
|
from meshai.config import (
|
|
NWSConfig, FIRMSConfig, USGSQuakeConfig,
|
|
EnvironmentalConfig, CentralConsumerConfig,
|
|
)
|
|
|
|
_ADAPTERS = ("nws", "swpc", "ducting", "fires", "avalanche",
|
|
"usgs", "usgs_quake", "traffic", "roads511", "firms")
|
|
|
|
|
|
def test_source_defaults_native():
|
|
assert NWSConfig().feed_source == "native"
|
|
assert FIRMSConfig().feed_source == "native"
|
|
assert USGSQuakeConfig().feed_source == "native"
|
|
|
|
|
|
def test_all_adapters_default_native():
|
|
env = EnvironmentalConfig()
|
|
for attr in _ADAPTERS:
|
|
assert getattr(env, attr).feed_source == "native", attr
|
|
|
|
|
|
def test_source_central_validates():
|
|
assert NWSConfig(feed_source="central").feed_source == "central"
|
|
assert USGSQuakeConfig(feed_source="central").feed_source == "central"
|
|
|
|
|
|
def test_source_garbage_rejects():
|
|
with pytest.raises(ValueError):
|
|
NWSConfig(feed_source="garbage")
|
|
with pytest.raises(ValueError):
|
|
FIRMSConfig(feed_source="")
|
|
|
|
|
|
def test_environmental_has_central_default():
|
|
env = EnvironmentalConfig()
|
|
assert isinstance(env.central, CentralConsumerConfig)
|
|
assert env.central.enabled is False
|
|
assert env.central.url.startswith("nats://")
|
|
|
|
|
|
def test_source_field_survives_dict_coercion():
|
|
"""A `source` in yaml/dict is coerced onto the adapter config."""
|
|
from meshai.config import Config, _dict_to_dataclass
|
|
cfg = _dict_to_dataclass(Config, {"environmental": {"usgs_quake": {"enabled": True, "feed_source": "central"}}})
|
|
assert cfg.environmental.usgs_quake.feed_source == "central"
|
|
assert cfg.environmental.nws.feed_source == "native" # untouched default
|