Skip to content

improve-modularity: split libvirt backend & workflow-contract modules (4 files) #50

Description

@Brad-Edwards

Part of #3 (modularity initiative tracker).

Context (re-scoped 2026-07-30)

Since this issue was filed the codebase moved out from under its original text, so it has been re-scoped:

No behavior change. Each file becomes a package directory behind an API-stable re-export shim.

Files (this issue)

File Lines (origin/dev) Import module
implementations/python/packages/raes_backend_libvirt/drivers/libvirt.py 555 raes_backend_libvirt.drivers.libvirt
implementations/python/packages/raes_backend_libvirt/realization.py 571 raes_backend_libvirt.realization
implementations/python/packages/raes_backend_libvirt/techvault_native.py 563 raes_backend_libvirt.techvault_native
implementations/python/packages/raes_contracts/workflow.py 688 raes_contracts.workflow

Mechanics (per file)

  1. Read the file. Identify cohesive subdomains by clustering classes/functions that share concepts, types, or call relationships.
  2. Convert the file to a Python package: replace <path>.py with a directory of the same base name <path>/.
  3. Move code into subdomain files <path>/<subdomain>.py. Each subdomain file MUST be ≤ 500 lines.
  4. <path>/__init__.py re-exports the public API — every name imported from the original module anywhere else in the codebase, plus any names in __all__.
  5. For each module, run git grep -E "from <module>|import <module>" (e.g. git grep -E "from raes_contracts.workflow|import raes_contracts.workflow") to enumerate every external import site. Confirm zero of those lines need to change.
  6. Remove the file's entry from tools/policy/oversized_allowlist.yaml.

Acceptance criteria

  • Each file above no longer exists as a .py; a package directory with __init__.py exists in its place.
  • Every .py file under each new package directory is ≤ 500 lines (verified by tools/check_repo_policy.py after the paths are removed from the allowlist).
  • No external import line referencing any of these four modules was modified by this PR (verified by diff inspection during clause verification).
  • tools/policy/oversized_allowlist.yaml no longer contains any of the four files above.
  • uv tool run --from 'nox[uv]==2026.4.10' nox -f noxfile.py -s verify passes.
  • No pre-existing test was modified to make the suite pass.
  • CHANGELOG.md has an entry for this change.

Out of scope

  • Any behavior change. This is a pure refactor — equality of public API and equality of behavior under the existing test suite is the contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressAn agent is actively working this issue via /implement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions