mirror of
https://github.com/zvx-echo6/meshai.git
synced 2026-08-26 17:31:34 +00:00
chore(config): delete 51 dead keys, fix usgs_quake floor, secret-flag consistency (#46)
Backend half of making the dashboard the complete config surface (per an
exhaustive per-key audit).
Delete 51 vestigial/unread config fields (load-safe: _dict_to_dataclass
whitelists by field, so existing files carrying these keys still load and the
keys drop on next save):
- 36 duplicated MQTT block (host/port/username/password/topic_root/use_tls)
on memory/context/commands + env nws/swpc/ducting (grep-proven unread;
mesh_sources keeps its real MQTT fields)
- 3 no-op history cleanup keys (auto_cleanup/cleanup_interval_hours/max_age_days)
- 5 alert scaffolding (alert_cooldown_minutes, RegionAnchor.nws_zones,
battery_{warning,critical,emergency}_voltage)
- 5 danger-zone non-fire min_acres (kept fire.min_acres via a fire subclass)
- 2 deprecated adapter_config keys (nws.broadcast_severities/warning_suffix_promotes)
Bug: usgs_quake native magnitude floor was unreachable from the GUI (native
reads config.min_magnitude; the GUI "Global Floor" wrote the registry
global_mag_floor that only the Central path reads). Reconciled: min_magnitude
is the canonical native floor the frontend will bind; registry floors marked
Central-path-only. Effective filtering unchanged.
Secret-flag consistency: add environmental.roads511.api_key + wzdx.api_key to
SECRET_FIELDS (secrets move to .env in the follow-up; ${VAR} interpolation kept).
Suite at 10-failure baseline (1703 passed).
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
5de683f7a7
commit
a502778990
8 changed files with 45 additions and 81 deletions
|
|
@ -36,7 +36,9 @@ def test_list_returns_all_59_keys(client):
|
|||
# 14 adapters with at least one key (itd_511 has zero -- not in the
|
||||
# grouped dict because the SQL only returns rows that exist).
|
||||
total = sum(len(v) for v in body.values())
|
||||
assert total == 96
|
||||
# was 96; config-schema cleanup removed the two deprecated nws keys
|
||||
# (broadcast_severities, warning_suffix_promotes) -> 94.
|
||||
assert total == 94
|
||||
|
||||
|
||||
def test_list_grouped_by_adapter(client):
|
||||
|
|
@ -184,12 +186,14 @@ def test_put_str_validation(client):
|
|||
|
||||
|
||||
def test_put_json_accepts_list(client):
|
||||
# broadcast_severities was removed in the config-schema cleanup; use the
|
||||
# surviving nws json-list key tombstone_msgtypes to exercise list PUTs.
|
||||
r = client.put(
|
||||
"/api/adapter-config/nws/broadcast_severities",
|
||||
json={"value": ["Extreme"]},
|
||||
"/api/adapter-config/nws/tombstone_msgtypes",
|
||||
json={"value": ["Cancel"]},
|
||||
)
|
||||
assert r.status_code == 200
|
||||
assert r.json()["value"] == ["Extreme"]
|
||||
assert r.json()["value"] == ["Cancel"]
|
||||
|
||||
|
||||
def test_put_json_accepts_dict(client):
|
||||
|
|
|
|||
|
|
@ -75,7 +75,9 @@ def test_adapter_config_type_check_constrains_vocabulary(fresh_db):
|
|||
|
||||
def test_registry_at_59_entries():
|
||||
"""v0.6-3a.1 trim: 43 CONFIG-only keys (was 77 in v0.6-3a draft)."""
|
||||
assert len(REGISTRY) == 96, (
|
||||
# was 96; config-schema cleanup removed the two deprecated nws keys
|
||||
# (broadcast_severities, warning_suffix_promotes) -> 94.
|
||||
assert len(REGISTRY) == 94, (
|
||||
f"REGISTRY drift guard; got {len(REGISTRY)}. "
|
||||
f"If a sentence template / emoji / heuristic snuck in, it belongs in CODE not config."
|
||||
)
|
||||
|
|
@ -225,7 +227,9 @@ def test_accessor_returns_bool(fresh_db):
|
|||
|
||||
def test_accessor_returns_json_list(fresh_db):
|
||||
invalidate_cache()
|
||||
assert adapter_config.nws.broadcast_severities == ["Extreme", "Severe"]
|
||||
# broadcast_severities was removed in the config-schema cleanup (deprecated,
|
||||
# no longer enforced); tombstone_msgtypes is the surviving nws json-list key.
|
||||
assert adapter_config.nws.tombstone_msgtypes == ["Cancel", "Expire"]
|
||||
|
||||
|
||||
def test_accessor_returns_json_dict(fresh_db):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue