[Debt] Provide shared module runtime proxy helper for modules #251

Closed
opened 2026-07-13 17:21:10 +02:00 by zemion · 1 comment
Owner

Created from add-ideas/govoplan#3 after triaging /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260711-1857/jscpd/jscpd-report.json.

Evidence

jscpd reports identical runtime proxy modules in:

  • govoplan_calendar/backend/runtime.py lines 1-27
  • govoplan_files/backend/runtime.py lines 1-27

Both modules keep registry/settings globals, configure_runtime, get_registry, get_settings, and SettingsProxy with only the module name in the error message differing.

Desired Shape

Expose a small core helper/factory for module runtime registry/settings proxies so modules do not copy this pattern.

Acceptance Criteria

  • Calendar and files use the shared helper or a documented core runtime adapter.
  • Error messages remain module-specific enough to diagnose missing runtime configuration.
  • Module imports remain optional and do not create module-to-module dependencies.
  • Focused backend import/module tests pass.
Created from add-ideas/govoplan#3 after triaging `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260711-1857/jscpd/jscpd-report.json`. ## Evidence jscpd reports identical runtime proxy modules in: - `govoplan_calendar/backend/runtime.py` lines 1-27 - `govoplan_files/backend/runtime.py` lines 1-27 Both modules keep registry/settings globals, `configure_runtime`, `get_registry`, `get_settings`, and `SettingsProxy` with only the module name in the error message differing. ## Desired Shape Expose a small core helper/factory for module runtime registry/settings proxies so modules do not copy this pattern. ## Acceptance Criteria - Calendar and files use the shared helper or a documented core runtime adapter. - Error messages remain module-specific enough to diagnose missing runtime configuration. - Module imports remain optional and do not create module-to-module dependencies. - Focused backend import/module tests pass.
Author
Owner

Codex State: done

Summary

  • Added shared ModuleRuntimeState/ModuleSettingsProxy in core and switched calendar, files, and mail runtime adapters to use it.

Changed Files

  • src/govoplan_core/core/runtime.py
  • tests/test_module_system.py
  • ../govoplan-calendar/src/govoplan_calendar/backend/runtime.py
  • ../govoplan-files/src/govoplan_files/backend/runtime.py
  • ../govoplan-mail/src/govoplan_mail/backend/runtime.py

Verification

  • python -m py_compile core/calendar/files/mail runtime files
  • python -m ruff check changed runtime files
  • python -m unittest tests.test_module_system.ModuleSystemTests.test_module_route_factories_receive_runtime_settings
  • module runtime adapter sentinel import check
## Codex State: done ### Summary - Added shared ModuleRuntimeState/ModuleSettingsProxy in core and switched calendar, files, and mail runtime adapters to use it. ### Changed Files - `src/govoplan_core/core/runtime.py` - `tests/test_module_system.py` - `../govoplan-calendar/src/govoplan_calendar/backend/runtime.py` - `../govoplan-files/src/govoplan_files/backend/runtime.py` - `../govoplan-mail/src/govoplan_mail/backend/runtime.py` ### Verification - `python -m py_compile core/calendar/files/mail runtime files` - `python -m ruff check changed runtime files` - `python -m unittest tests.test_module_system.ModuleSystemTests.test_module_route_factories_receive_runtime_settings` - `module runtime adapter sentinel import check`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: add-ideas/govoplan-core#251
No description provided.