[Audit] Refactor core installer, catalog, and runtime validation complexity hotspots #257

Closed
opened 2026-07-13 20:10:34 +02:00 by zemion · 3 comments
Owner

Xenon flags several core blocks above the configured complexity threshold.

Source report: /mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt

Hotspots include:

  • src/govoplan_core/commands/module_installer.py:48 main rank F
  • src/govoplan_core/core/install_config.py:110 validate_runtime_configuration rank F
  • src/govoplan_core/core/module_package_catalog.py:52 validate_module_package_catalog rank F
  • src/govoplan_core/core/module_installer.py plan/preflight/install helpers rank D/E
  • src/govoplan_core/db/migrations.py migration reconciliation helpers rank D

Acceptance criteria:

  • Break large validation/installer flows into named phases with focused tests.
  • Preserve module boundary rules and existing installer behavior.
  • Reduce Xenon violations incrementally rather than doing a broad rewrite.
<!-- codex-security-audit-fingerprint:security-audit-20260713-core-complexity-hotspots --> Xenon flags several core blocks above the configured complexity threshold. Source report: `/mnt/DATA/git/govoplan/audit-reports/govoplan-full-20260713-1949/xenon.txt` Hotspots include: - `src/govoplan_core/commands/module_installer.py:48 main` rank F - `src/govoplan_core/core/install_config.py:110 validate_runtime_configuration` rank F - `src/govoplan_core/core/module_package_catalog.py:52 validate_module_package_catalog` rank F - `src/govoplan_core/core/module_installer.py` plan/preflight/install helpers rank D/E - `src/govoplan_core/db/migrations.py` migration reconciliation helpers rank D Acceptance criteria: - Break large validation/installer flows into named phases with focused tests. - Preserve module boundary rules and existing installer behavior. - Reduce Xenon violations incrementally rather than doing a broad rewrite.
Author
Owner

Codex State: progress

Summary

  • Refactored runtime configuration validation into named validation phases.

Changed Files

  • validate_runtime_configuration now delegates through a runtime profile object and issue collector to focused validators for APP_ENV, database, MASTER_KEY_B64, enabled modules, async/auth settings, CORS, file storage, and module catalog trust.

Verification

  • py_compile and git diff --check for install_config.py; python -m unittest tests.test_install_config (4 tests OK); combined core set covering test_http_fetch, test_install_config, and selected module installer subprocess/database-hook paths (11 tests OK).

Next / Blocked

  • Remaining core#257 hotspots still include module_installer CLI main, module package catalog validation, additional module installer plan/preflight helpers, and migration reconciliation helpers.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Refactored runtime configuration validation into named validation phases. ### Changed Files - `validate_runtime_configuration now delegates through a runtime profile object and issue collector to focused validators for APP_ENV, database, MASTER_KEY_B64, enabled modules, async/auth settings, CORS, file storage, and module catalog trust.` ### Verification - `py_compile and git diff --check for install_config.py; python -m unittest tests.test_install_config (4 tests OK); combined core set covering test_http_fetch, test_install_config, and selected module installer subprocess/database-hook paths (11 tests OK).` ### Next / Blocked - Remaining core#257 hotspots still include module_installer CLI main, module package catalog validation, additional module installer plan/preflight helpers, and migration reconciliation helpers. Suggested status label: `status/in-progress`
Author
Owner

Codex State: progress

Summary

  • Refactored module package catalog validation so validate_module_package_catalog delegates source loading, policy checks, result assembly, warnings, and default state handling to small helpers.
  • Tightened the retired WebUI admin API regression test so it no longer treats the shared adminCommon helper as the retired api/admin surface.

Changed Files

  • src/govoplan_core/core/module_package_catalog.py
  • tests/test_module_system.py

Verification

  • python -m py_compile src/govoplan_core/core/module_package_catalog.py tests/test_module_system.py
  • python -m unittest tests.test_module_system
  • radon cc: validate_module_package_catalog is B (8)
  • xenon --max-absolute C passes for module_package_catalog.py

Next / Blocked

  • Remaining core complexity hotspots from the full audit are in module_installer, configuration packages/safety, module management, registry, and migration helpers.

Suggested status label: status/in-progress

## Codex State: progress ### Summary - Refactored module package catalog validation so validate_module_package_catalog delegates source loading, policy checks, result assembly, warnings, and default state handling to small helpers. - Tightened the retired WebUI admin API regression test so it no longer treats the shared adminCommon helper as the retired api/admin surface. ### Changed Files - `src/govoplan_core/core/module_package_catalog.py` - `tests/test_module_system.py` ### Verification - `python -m py_compile src/govoplan_core/core/module_package_catalog.py tests/test_module_system.py` - `python -m unittest tests.test_module_system` - `radon cc: validate_module_package_catalog is B (8)` - `xenon --max-absolute C passes for module_package_catalog.py` ### Next / Blocked - Remaining core complexity hotspots from the full audit are in module_installer, configuration packages/safety, module management, registry, and migration helpers. Suggested status label: `status/in-progress`
Author
Owner

Codex State: done

Summary

  • Closed as a duplicate/superseded audit tracker.
  • Fixed items from this issue: runtime configuration validation and module package catalog validation now pass the configured complexity threshold.
  • Remaining referenced hotspots are still open and tracked in govoplan-core#245.

Changed Files

  • src/govoplan_core/core/install_config.py
  • src/govoplan_core/core/module_package_catalog.py
  • tests/test_module_system.py

Verification

  • xenon confirms validate_runtime_configuration and validate_module_package_catalog are below the configured threshold.

Next / Blocked

  • Continue remaining core complexity work from govoplan-core#245.
## Codex State: done ### Summary - Closed as a duplicate/superseded audit tracker. - Fixed items from this issue: runtime configuration validation and module package catalog validation now pass the configured complexity threshold. - Remaining referenced hotspots are still open and tracked in govoplan-core#245. ### Changed Files - `src/govoplan_core/core/install_config.py` - `src/govoplan_core/core/module_package_catalog.py` - `tests/test_module_system.py` ### Verification - `xenon confirms validate_runtime_configuration and validate_module_package_catalog are below the configured threshold.` ### Next / Blocked - Continue remaining core complexity work from govoplan-core#245.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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