Skip to content

feat: ConfigChanged event — runtime config propagation via EventBus (#622)#634

Merged
ShaerWare merged 2 commits intomainfrom
server/eventbus-config-changed
Mar 21, 2026
Merged

feat: ConfigChanged event — runtime config propagation via EventBus (#622)#634
ShaerWare merged 2 commits intomainfrom
server/eventbus-config-changed

Conversation

@ShaerWare
Copy link
Owner

Summary

  • Add ConfigChanged event in modules/core/events.py — fields: key, value, previous_value, namespace
  • ConfigService.set(), set_telegram(), set_widget() publish ConfigChanged after DB commit
  • Audit subscriber in setup_event_subscriptions() logs all config changes (action=config_changed)
  • Namespace derived from key (e.g. widget.colors.primarywidget) for subscriber filtering
  • Graceful fallback: event publishing skipped if EventBus unavailable (startup, tests)
  • previous_value fetched from DB before write (not from Redis cache) for accuracy

Design decisions

  • Audit via EventBus replaces manual audit at call sites (widget/telegram routers still have their own audit for now — can be removed later)
  • Domain subscribers not added yet — widget reads config per-request (no cache to invalidate), telegram bot is a subprocess (can't hot-reload). Future domain events (BotConfigUpdated, WidgetConfigUpdated) are better suited for instance-specific changes
  • Idempotent handlers — repeated events with same value produce independent audit entries, no side effects

Test plan

  • 9 new unit tests pass (pytest tests/unit/test_config_changed.py)
  • All 106 unit tests pass (no regressions)
  • CI checks (lint-backend, lint-frontend, security)

Closes #622

🤖 Generated with Claude Code

ShaerWare and others added 2 commits March 21, 2026 01:25
…622)

- Add ConfigChanged event in modules/core/events.py with key, value, previous_value, namespace fields
- ConfigService.set(), set_telegram(), set_widget() now publish ConfigChanged after commit
- Audit subscriber in setup_event_subscriptions logs all config changes (action=config_changed)
- Graceful fallback: publishing is skipped if EventBus is unavailable (during startup)
- 9 unit tests covering event fields, namespace derivation, publish from set(), audit subscriber, idempotency, error isolation

Closes #622

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ShaerWare ShaerWare merged commit 455d0ca into main Mar 21, 2026
3 checks passed
@ShaerWare ShaerWare deleted the server/eventbus-config-changed branch March 21, 2026 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 5.6: ConfigChanged event — runtime config propagation via EventBus

2 participants