refactor: move CVDRole to vultron/enums/; config.py → config/ sub-package (#1342)#1432
refactor: move CVDRole to vultron/enums/; config.py → config/ sub-package (#1342)#1432sei-ahouseholder wants to merge 4 commits into
Conversation
…sub-package - vultron/enums/roles.py: CVDRole StrEnum + serialize_roles/validate_roles (moved from vultron/core/states/roles.py; deleted, no shim) - vultron/enums/__init__.py: re-exports CVDRole, serialize_roles, validate_roles - vultron/config/actor.py: ActorConfig BaseModel (moved from vultron/core/models/actor_config.py; deleted, no shim) - vultron/config/app.py: AppConfig + get_config/reload_config; AppConfig gains actor: ActorConfig field; removed dead get_field_value() override - vultron/config/__init__.py: public re-exports - All ~99 vultron.core.states.roles and ~15 vultron.core.models.actor_config import sites updated via bulk sed - test/architecture/test_enums_import_graph.py: 5 AST-based import-graph tests; refactored to shared helper (no copy-paste, no dead helpers, module-level imports) - test/test_config.py: add VULTRON_ACTOR__* env var clearance in reset_config fixture; add 5 AppConfig.actor coverage tests - test/core/states/test_cvd_roles.py: update non-list test (validate_roles now raises for non-None non-list input) - test/core/models/test_actor_config.py: add scalar-string rejection test - AGENTS.md: fix stale load_actor_config() reference → get_config().actor; fix section link → Current Architecture - notes/configuration.md: fix stale testing-pattern code snippet - notes/case-communication-model.md: fix stale CVDRole import path - notes/two-actor-demo.md: fix stale roles.py file reference Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…enums/; config.py → config/ sub-package
- notes/bt-composability.md: update ActorConfig path from vultron/core/models/ (or config.py) to vultron/config/actor.py - notes/codebase-structure.md: replace stale vultron/enums.py entry with correct vultron/enums/ package description (ADR-0031) - notes/configuration.md: annotate historical Module Structure section as superseded; update intro to reference sub-package; Background text no longer refers to flat config.py as active - vultron/bt/roles/enums.py: fix docstring path vultron.core.states.roles → vultron.enums.roles Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sei-ahouseholder
left a comment
There was a problem hiding this comment.
PR Review — refactor: move CVDRole to vultron/enums/; config.py → config/ sub-package
CI: All 12 checks pass (lint, type, tests, demo integration, CodeQL)
Phase 2 — Issue Linkage: PASS
- Closes #1342 — all 4 ACs addressed.
load_actor_config()(CFG-07-005) correctly deferred to #1343 — out of scope for this PR.
Phase 3 — PR Body Format: PASS
Closing reference at top, Summary/Changes/Verification present, actual test count (4718, 7 new), all ACs checked, Co-authored-by trailer present.
Phase 5 — Spec and Notes Conformance: PASS
CFG-07-001 through CFG-07-006 satisfied. ADR-0031 written, accepted, and referenced throughout.
Phase 6 — ADR Check: PASS
ADR-0031 added, correctly formatted, listed in docs/adr/index.md.
Phase 8 — Code Review: PASS
validate_roles()handlesNone, list, and non-list correctly; uppercase string inputs normalised via.lower().YamlConfigSource.get_field_value()satisfies the ABC correctly —__call__()is the pydantic-settings 2.x data path.- Architecture ratchet tests in
test/architecture/test_enums_import_graph.pyuse AST static analysis — well-designed. vultron/core/states/__init__.pyre-exportsCVDRolefromvultron.enums.roles, preserving backward compatibility.
Phase 9 — Notes Currency: IMPROVE → FIXED
Four stale references not touched by the PR were found and fixed in review commit 7bbf3301:
notes/bt-composability.mdline 536:ActorConfigpath updated fromvultron/core/models/(orvultron/config.py) →vultron/config/actor.pynotes/codebase-structure.mdline 49: Stalevultron/enums.py(backward-compat re-exports) entry replaced with correctvultron/enums/package description per ADR-0031notes/configuration.md: "Module Structure" section annotated as historical/superseded; intro updated to reference sub-package rather than the flat filevultron/bt/roles/enums.pydocstring: Stalevultron.core.states.rolespath updated tovultron.enums.roles
Phase 10 — Test Coverage: PASS
7 new tests cover AppConfig.actor defaults/env-var overrides, validate_roles scalar rejection, and ActorConfig scalar string rejection. Import-graph ratchet enforces layer invariants statically.
Phase 11 — CI: PASS
All 12 checks green including FVV and Two-Actor demo integration.
Summary
| Phase | Verdict |
|---|---|
| Issue linkage | PASS |
| PR body format | PASS |
| Spec conformance | PASS |
| ADR check | PASS |
| Code review | PASS |
| Notes currency | IMPROVE → FIXED (7bbf3301) |
| Test coverage | PASS |
| CI | PASS |
Ready to merge. No FAIL findings. Four stale notes references fixed in follow-up commit.
- common.py: take main's _ensure_reporter_participant/_upgrade_participant_to_accepted addition; apply our CVDRole import fix (vultron.enums.roles, not vultron.core.states.roles); keep is_rm_at_least and _as_id imports added by main - _helpers.py: take main's version (functions moved to common.py; no longer needs CVDRole import) - test_offer_case_participant.py: fix stale vultron.core.states.roles import in new test added by main (#1427); update to vultron.enums.roles All 4722 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Moves
CVDRole(and helpers) to a new bottom-of-stackvultron/enums/package, and convertsvultron/config.pyinto avultron/config/sub-package that addsAppConfig.actor: ActorConfigfor neutral actor-policy configuration — prerequisite for wiring actor config into the production dispatch path without a layering violation.Changes
vultron/enums/roles.py:CVDRoleStrEnum +serialize_roles/validate_roles(moved fromvultron/core/states/roles.py; deleted, no shim).validate_rolesnow raisesValueErrorfor non-Nonenon-list input instead of silently returning[].vultron/enums/__init__.py: public re-exports; MUST NOT import fromvultron.core/config/adaptersvultron/config/actor.py:ActorConfigPydanticBaseModel(moved fromvultron/core/models/actor_config.py; deleted, no shim); importsCVDRolefromvultron.enums.rolesvultron/config/app.py:AppConfiggainsactor: ActorConfigfield;get_config()/reload_config()unchanged; removed deadget_field_value()override (pydantic-settings 2.x dispatches via__call__()only — ABC requirement retained)vultron/config/__init__.py: public re-exports;vultron/config.pydeleted, no shimfrom vultron.core.states.roles import→from vultron.enums.roles importfrom vultron.core.models.actor_config import ActorConfig→from vultron.config.actor import ActorConfigtest/architecture/test_enums_import_graph.py: 5 AST-based import-graph invariant tests; refactored to shared helper (_assert_no_forbidden_imports), dead helpers removed, module-level importstest/test_config.py:reset_configfixture clearsVULTRON_ACTOR__*env vars; 5 newAppConfig.actorcoverage teststest/core/states/test_cvd_roles.py: update non-list test to match new raising behaviourtest/core/models/test_actor_config.py: add scalar-string rejection testAGENTS.md: fix staleload_actor_config()reference →get_config().actor; fix section linknotes/configuration.md: fix stale testing-pattern code snippet (_config_cachelives inapp.py)notes/case-communication-model.md: fix staleCVDRoleimport pathnotes/two-actor-demo.md: fix stalevultron/core/states/roles.pyreferenceVerification
vultron/enums/roles.pyexportsCVDRole,serialize_roles,validate_roles; all formervultron.core.states.rolesimport sites updated; no shimvultron/config/sub-package withapp.pyandactor.py;AppConfighasactor: ActorConfig; all former import sites updated; no shimnotes/configuration.mdupdated with current architecture, YAML schema, and env var reference