Skip to content

[architect] Spec: Refactor vmtest package structure to split concerns #607

Open

Description

@hanthor-hive-agent

Overview

Issue #604 identifies that pkg/vmtest couples image building, layer composition, and VM orchestration, making it difficult to reuse layer logic independently.

This spec defines the exact refactoring steps to split vmtest into focused packages.

Current Structure

  • pkg/vmtest/image.go (264 LOC) — Dockerfile→OCI building
  • pkg/vmtest/layer.go (661 LOC) — Layer composition, patching, filesystem overlays
  • pkg/vmtest/run.go (673 LOC) — VM boot orchestration, lifecycle
  • pkg/vmtest/runner.go (155 LOC) — Harness lifecycle ✓ (already well-abstracted)
  • pkg/vmtest/spec.go (409 LOC) — Test manifest DSL, validation

Target Structure

Phase 1: Extract Pure Layer Logic → pkg/image/layer

Goal: Make layer composition independently importable.

  • Create pkg/image/layer/
  • Move layer.go → pkg/image/layer/
  • Move layer_test.go → pkg/image/layer/
  • Update package name: vmtest → layer
  • Update imports within layer.go (no pkg/vmtest imports except for Spec type initially)
  • Have pkg/vmtest/layer.go re-export types from pkg/image/layer for backwards compat

Deliverables:

  • A project importing 'pkg/image/layer' gets only crypt, yaml, and shell dependencies
  • No VM orchestration or kubevirt imports in the layer package

Phase 2: Extract Image Building → pkg/image/build

  • Create pkg/image/build/
  • Move image.go → pkg/image/build/
  • Move image_test.go → pkg/image/build/
  • Update package name, imports
  • pkg/vmtest/image.go re-exports for compat

Phase 3: Extract Spec DSL → pkg/vmtest/spec (stays)

  • Clean up internal-only types (buildContext, contextFile) to private
  • Clear separation: spec is DSL only, independent of build/layer logic

Phase 4: Lean Down pkg/vmtest

  • vmtest becomes the test harness orchestrator only
  • Public API: Run, NewRunner, interfaces (ImagePreparer, VMLifecycle, etc.)
  • Continue re-exporting types from pkg/image packages if external callers use them

Risk & Mitigation

Risk Mitigation
Large number of imports to update Do phases atomically, test after each phase
Backwards compatibility break Re-export key types from vmtest until deprecation period
Circular dependencies Ensure pkg/image/ packages never import pkg/vmtest

Success Criteria

  • pkg/image/layer can be imported standalone without pulling VM/kubevirt deps
  • pkg/image/build can be imported standalone (depends on layer only)
  • pkg/vmtest imports from pkg/image packages instead of defining layer logic
  • All existing tests pass
  • vmtest's public API (Run, NewRunner, Result, Spec, etc.) is stable or re-exported
  • A new tool outside corral can do: 'import "pkg/image/layer"' and use layer composition

Filed by architect agent (ACMM L6 — full mode)


🐝 Hive Agent: architect | Instance: new-hive-99 | SHA: 9a37f20

— hive: agent=architect backend=pi model=kiro-api-key/claude-haiku-4-5:low pi=1.2.0

Activity

  1. added
    architectureApproved by a Hive merger/owner for auto-merge on green CI
    agent/architectApproved by a Hive merger/owner for auto-merge on green CI
    hive/new-hive-99Approved by a Hive merger/owner for auto-merge on green CI
    tech-debtApproved by a Hive merger/owner for auto-merge on green CI
    kind/specCreated by Hive for agent-filed issue provenance
    stage/010-actionableTriaged; eligible for the hive to pick up
    stage/stalledIn its current stage longer than expected
    and removed
    stage/010-actionableTriaged; eligible for the hive to pick up
    stage/stalledIn its current stage longer than expected
    on Oct 16, 2026
  2. hanthor commented on Oct 31, 2026

    @hanthor
    Member

    Maintainer note: #631 was closed as superseded. Phase 1 (pkg/image/layer behind a Spec-free LayerConfig) is #670, per the Option 1 decision on #604. Phase 2 (pkg/image/build) should start from main after #670 lands, as a separate move-only PR without compatibility re-exports.

  3. 324 remaining items

  4. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  5. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  6. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  7. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  8. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  9. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  10. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  11. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  12. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  13. hanthor-hive-agent commented on Nov 9, 2026

    @hanthor-hive-agent
    ContributorAuthor

    @hanthor is configured as this hive's project.ai_author, so Hive treats comments from it as its own and will not act on /hive commands from it. To un-park this issue, remove the parking label by hand, or set project.ai_author to an account that is not a maintainer (clear it to author as the GitHub App bot).

  14. added
    approved-directionMaintainer accepts this agent proposal; Hive may implement it
    and removed on Nov 10, 2026
  15. hanthor commented on Nov 10, 2026

    @hanthor
    Member

    Applied @hanthor's 2026-11-02 /hive decision above by hand: removed blocked, added approved-direction. The hive refused the command because @hanthor is its project.ai_author, and the repeated refusal replies were a marker-trust bug (fix proposed in hivecommons/hive#17512).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/architectApproved by a Hive merger/owner for auto-merge on green CIapproved-directionMaintainer accepts this agent proposal; Hive may implement itarchitectureApproved by a Hive merger/owner for auto-merge on green CIhive/new-hive-99Approved by a Hive merger/owner for auto-merge on green CIkind/specCreated by Hive for agent-filed issue provenancestage/010-actionableTriaged; eligible for the hive to pick upstage/stalledIn its current stage longer than expectedtech-debtApproved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions