Skip to content

Organize agentd-runner internals into modules with shared test fixtures #35

@pentaxis93

Description

@pentaxis93

Summary

crates/agentd-runner/src/lib.rs is a single 3000-line file containing the entire runner: public types, validation, container lifecycle, resource management, script generation, utility functions, and all tests. Concerns are interleaved and the test suite rebuilds the same fake-podman scaffolding from scratch in each test.

This structure makes the crate harder to review (findings scatter across unrelated code), harder to maintain (changes in one concern sit adjacent to another), and expensive to extend (each new test copies and adapts a ~60-line shell script).

Constraints

  • The public API is unchanged: SessionSpec, SessionInvocation, SessionOutcome, RunnerError, ResolvedEnvironmentVariable, EnvironmentNameValidationError, run_session, and validate_environment_name remain the crate's public surface.
  • All existing tests pass with identical behavior — this is a pure structural refactor.
  • The crate remains a single Rust crate (agentd-runner); the restructuring is internal modules, not new crates.
  • The integration tests in tests/session_lifecycle.rs remain a separate test target.

Acceptance Criteria

  • Each distinct concern in the production code lives in its own module within the crate. A reader can navigate to any concern without scanning unrelated code.
  • The fake-podman test infrastructure is a shared fixture. Adding a new test that needs fake-podman requires configuring the fixture's behavior, not writing a new shell script.
  • cargo test -p agentd-runner passes.
  • cargo clippy -p agentd-runner --all-targets -- -D warnings passes.
  • cargo fmt --check passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions