[Debt] Refactor high-complexity core installer/configuration/runtime functions #245

Closed
opened 2026-07-11 12:51:16 +02:00 by zemion · 4 comments
Owner

Xenon/Radon identify several D/E/F-ranked core functions. These are not immediate security defects, but they increase risk in migration, installer, and configuration code.

Classification: structural maintainability work.

Report evidence:

  • govoplan-core/src/govoplan_core/commands/module_installer.py:42 main rank F.
  • govoplan-core/src/govoplan_core/core/install_config.py:110 validate_runtime_configuration rank F.
  • govoplan-core/src/govoplan_core/core/module_installer.py:418 run_module_install_plan, :1388, :1476 ranks E.
  • govoplan-core/src/govoplan_core/core/module_package_catalog.py:52 validate_module_package_catalog rank F.
  • Full Xenon output attached by user; future runs will capture this in xenon.txt.

Suggested next steps:

  • Split installer orchestration into smaller command planning, execution, rollback, and catalog-validation services.
  • Add focused regression tests before refactoring each cluster.
  • Use Xenon as report-only until a baseline is reduced.

Baseline report directory: audit-reports/govoplan-full-20260711-1238

<!-- codex-audit-full-2026-07-11:core-complexity-baseline --> Xenon/Radon identify several D/E/F-ranked core functions. These are not immediate security defects, but they increase risk in migration, installer, and configuration code. Classification: **structural maintainability work**. Report evidence: - `govoplan-core/src/govoplan_core/commands/module_installer.py:42 main` rank F. - `govoplan-core/src/govoplan_core/core/install_config.py:110 validate_runtime_configuration` rank F. - `govoplan-core/src/govoplan_core/core/module_installer.py:418 run_module_install_plan`, `:1388`, `:1476` ranks E. - `govoplan-core/src/govoplan_core/core/module_package_catalog.py:52 validate_module_package_catalog` rank F. - Full Xenon output attached by user; future runs will capture this in `xenon.txt`. Suggested next steps: - Split installer orchestration into smaller command planning, execution, rollback, and catalog-validation services. - Add focused regression tests before refactoring each cluster. - Use Xenon as report-only until a baseline is reduced. Baseline report directory: `audit-reports/govoplan-full-20260711-1238`
zemion added the
type
debt
status
ready
priority
p3
module/core
codex/ready
labels 2026-07-11 12:51:16 +02:00
zemion added the
audit/complexity
audit/structural
source/security-audit
labels 2026-07-11 16:06:05 +02:00
Author
Owner

Sequencing confirmed: leave this issue open, but do not pull it into the current small cleanup wave.

This should be tackled when installer/runtime work is active, with regression tests around catalog validation, install-plan execution, rollback, runtime validation, and daemon supervision before simplifying the high-complexity functions.

Sequencing confirmed: leave this issue open, but do not pull it into the current small cleanup wave. This should be tackled when installer/runtime work is active, with regression tests around catalog validation, install-plan execution, rollback, runtime validation, and daemon supervision before simplifying the high-complexity functions.
Author
Owner

Codex State: progress

Summary

  • Current Xenon state after the latest cleanup: validate_runtime_configuration and validate_module_package_catalog are no longer above threshold.
  • Remaining core hotspots are module_installer CLI main; module_installer install/preflight/catalog/migration/uninstall/data-safety helpers; configuration package catalog validation; configuration safety planning; module management normalization; registry validation; and DB migration task/reconciliation helpers.
  • Closing newer duplicate tracker govoplan-core#257 as superseded by this issue.

Verification

  • xenon --max-absolute C on src/govoplan_core still reports the remaining blocks listed above.

Next / Blocked

  • Tackle one cluster at a time, starting with module_installer CLI/main or migration helpers, with focused regression tests.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Current Xenon state after the latest cleanup: validate_runtime_configuration and validate_module_package_catalog are no longer above threshold. - Remaining core hotspots are module_installer CLI main; module_installer install/preflight/catalog/migration/uninstall/data-safety helpers; configuration package catalog validation; configuration safety planning; module management normalization; registry validation; and DB migration task/reconciliation helpers. - Closing newer duplicate tracker govoplan-core#257 as superseded by this issue. ### Verification - `xenon --max-absolute C on src/govoplan_core still reports the remaining blocks listed above.` ### Next / Blocked - Tackle one cluster at a time, starting with module_installer CLI/main or migration helpers, with focused regression tests. Suggested status label: `status/in-progress`
Author
Owner

Codex State: progress

Summary

  • Implemented another core complexity slice: configuration package catalog validation now delegates to a validation state object plus policy/result/warning helpers, and configuration change safety planning now delegates blocker collection and plan assembly.
  • Current Xenon state: validate_configuration_package_catalog and plan_configuration_change no longer appear in the core threshold violations.

Changed Files

  • src/govoplan_core/core/configuration_packages.py
  • src/govoplan_core/core/configuration_safety.py

Verification

  • python -m py_compile src/govoplan_core/core/configuration_safety.py src/govoplan_core/core/configuration_packages.py
  • python -m unittest tests.test_policy_contracts tests.test_module_system.ModuleSystemTests.test_configuration_package_catalog_validates_signed_entries
  • xenon passes for configuration_safety.py and configuration_packages.py individually

Next / Blocked

  • Remaining core complexity is concentrated in module_installer CLI/runtime helpers, module_management normalization, registry validation, and DB migration reconciliation.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Implemented another core complexity slice: configuration package catalog validation now delegates to a validation state object plus policy/result/warning helpers, and configuration change safety planning now delegates blocker collection and plan assembly. - Current Xenon state: validate_configuration_package_catalog and plan_configuration_change no longer appear in the core threshold violations. ### Changed Files - `src/govoplan_core/core/configuration_packages.py` - `src/govoplan_core/core/configuration_safety.py` ### Verification - `python -m py_compile src/govoplan_core/core/configuration_safety.py src/govoplan_core/core/configuration_packages.py` - `python -m unittest tests.test_policy_contracts tests.test_module_system.ModuleSystemTests.test_configuration_package_catalog_validates_signed_entries` - `xenon passes for configuration_safety.py and configuration_packages.py individually` ### Next / Blocked - Remaining core complexity is concentrated in module_installer CLI/runtime helpers, module_management normalization, registry validation, and DB migration reconciliation. Suggested status label: `status/in-progress`
Author
Owner

Codex State: done

Summary

  • Refactored the remaining core complexity hotspots from the audit: module installer CLI dispatch, installer preflight/run/rollback/command generation, uninstall/data-safety/catalog companion handling, migration planning, and server app startup wiring.
  • Full core Xenon now passes with --max-absolute C --max-modules B --max-average A.

Changed Files

  • src/govoplan_core/commands/module_installer.py
  • src/govoplan_core/core/module_installer.py
  • src/govoplan_core/server/app.py

Verification

  • /mnt/DATA/git/govoplan/.venv/bin/xenon --max-absolute C --max-modules B --max-average A src/govoplan_core: PASS
  • /mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_module_system: PASS (105 tests)
  • /mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_devserver: PASS
  • Focused create_app saved-state tests: PASS (3 tests)
  • Manual devserver smoke against local PostgreSQL: BLOCKED by existing Alembic revision mismatch e1f2a4b5c6d, unrelated to this refactor
## Codex State: done ### Summary - Refactored the remaining core complexity hotspots from the audit: module installer CLI dispatch, installer preflight/run/rollback/command generation, uninstall/data-safety/catalog companion handling, migration planning, and server app startup wiring. - Full core Xenon now passes with --max-absolute C --max-modules B --max-average A. ### Changed Files - `src/govoplan_core/commands/module_installer.py` - `src/govoplan_core/core/module_installer.py` - `src/govoplan_core/server/app.py` ### Verification - `/mnt/DATA/git/govoplan/.venv/bin/xenon --max-absolute C --max-modules B --max-average A src/govoplan_core: PASS` - `/mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_module_system: PASS (105 tests)` - `/mnt/DATA/git/govoplan/.venv/bin/python -m unittest tests.test_devserver: PASS` - `Focused create_app saved-state tests: PASS (3 tests)` - `Manual devserver smoke against local PostgreSQL: BLOCKED by existing Alembic revision mismatch e1f2a4b5c6d, unrelated to this refactor`
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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