feat: extend per-channel mute to all outbound uploads (closes #162)#165
Merged
Conversation
The channel-mute set introduced for CWOP/APRS in #161 now gates every outbound upload service. Weather Underground consults the same set and drops both the directly-mapped WU field and any derived field computed from a muted sensor (windchillf / heatindexf / dewptf when temperature is muted, etc.); future upload services pull the same helper. To keep one source of truth, the station_config keys are renamed ``cwop_mute_*`` → ``channel_mute_*`` with an idempotent one-shot migration in ``init_database``. API endpoint moves from ``/api/cwop/mute-status`` to ``/api/mute/status``; UI banner and Settings panel copy are broadened to reflect the wider scope. Backend - New: ``app/services/channel_mute.py`` (``MUTE_CHANNELS``, ``mute_key``, ``load_muted_channels``). - New: ``app/api/mute.py`` (replaces ``app/api/cwop.py``). - ``app/services/cwop.py`` re-exports the legacy ``CWOP_MUTE_CHANNELS`` / ``_mute_key`` symbols as compat aliases. - ``app/services/wunderground.py`` drops muted fields and derivatives; hourly-rain DB query skipped when ``rain_hour`` is muted. - ``app/models/database.py`` rename migration; uses ``CURRENT_TIMESTAMP`` for ``updated_at`` so raw SQL inserts aren't silently dropped by SQLite's NOT NULL constraint. Frontend - Hook + helpers renamed (``useMuteStatus``, ``notifyMuteChanged``); event ``channel-mute-changed``. - AppShell banner: "Muted channels — … in Settings → Channel Mute." - Settings panel: "Channel Mute — Sensor Reporting" with broadened explanatory copy. Tests - New ``tests/backend/test_wunderground.py``: per-channel direct-field drop, derived suppression for temp/humidity/wind, ``rain_24h`` no-op, hourly-rain query skip. - New ``tests/backend/test_database_migration.py``: migration of legacy keys, idempotency, no-clobber of pre-existing new-key values. - ``tests/backend/test_cwop.py`` adds compat-alias regression. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Both fields come from the same physical rain gauge counter as dailyrainin and have no CWOP analog, so they were always emitted — defeating the mute when an operator takes a broken rain sensor out of service. Add them to the rain_daily drop list and assert. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
There was a problem hiding this comment.
Re-checked HEAD 73ba15d against main. I still stand by the prior round-2 conclusion. Confirmed the migration, WU rain mute mapping, optional-auth /api/mute/status behavior, stable useMuteStatus array identity, and the CWOP compat aliases. Verification: python3 -m py_compile on touched backend files, targeted pytest (46 passed), and frontend npx tsc --noEmit.
cnighswonger
approved these changes
May 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
station_configkeyscwop_mute_*→channel_mute_*with an idempotent startup migration. One source of truth across services.tempf,windchillf,heatindexf,dewptf). Hourly-rain DB query skipped whenrain_houris muted.rain_dailyadditionally dropsyearraininandrainratein— both are alternate views of the same physical gauge counter (added in73ba15dafter Codex review of feat: extend per-channel mute to all outbound uploads (closes #162) #164)./api/cwop/mute-status→/api/mute/status. UI banner + Settings panel copy broadened: "Muted channels — … in Settings → Channel Mute."History
Reopened from closed PR #164 under the
kanfei-code-agent[bot]identity so the operator can review without a self-review block. Branch and commits identical; HEAD =73ba15d. Codex approved the prior PR after the rain-fix commit.Notes for reviewers
backend/app/services/cwop.pykeepsCWOP_MUTE_CHANNELS/_mute_keyas compat re-exports so the cwop test module's existing imports stay valid; a small regression test asserts they point at the canonical names.INSERTincludesupdated_atbecause the column is NOT NULL with an ORM-level default — without it,INSERT OR IGNOREsilently no-ops (caught during dev; covered by the migration test).rain_24hmute is a no-op for WU. Tested.Test plan
cd backend && python -m pytest ../tests/backend/ -q— 421 passcd frontend && npx tsc --noEmit— cleancd frontend && npm run build— clean (Vite chunk-size warning non-blocking per CLAUDE.md)py_compileon every modified Python file — cleancwop_mute_outdoor_temperature=truerow; restart; verify it's renamed tochannel_mute_*and the banner still shows the channel as muted.🤖 Generated with Claude Code