Skip to content

Consolidate duplicated workspace CLI test invocation harnesses #2308

Description

@codeforester

Goal

Create a package-local test invocation helper/fixture and migrate the identical clone/configure/pull harnesses first. Support explicit stream and environment overrides for related variants without hiding test setup.

Background

Repository-wide duplication review against f9c18f3294873cbbcda9acc7af7f1bc6b17eed45 (2026-09-17).

Three invoke_engine bodies are AST-identical and duplicate HOME/Base environment setup, optional user-config writing, output capture and engine invocation. Additional workspace suites repeat closely related TTY and project-context variants. This is test infrastructure duplication, separate from independently valuable scenario assertions.

Verified source locations:

Closed #1912 introduced root ManifestFactory fixtures and #1075 addressed older test-suite helpers. This issue concerns remaining CLI invocation harnesses, not re-creating those completed manifest fixtures.

This is a maintainability refactor. Similarity alone is not evidence of a production failure; any demonstrated differences are called out above.

Scope

Create a package-local test invocation helper/fixture and migrate the identical clone/configure/pull harnesses first. Support explicit stream and environment overrides for related variants without hiding test setup.

Acceptance Criteria

  • The three identical harnesses use one helper.
  • Tests retain explicit args, HOME/Base paths, optional config and environment overrides.
  • Preserve TTY simulation and restoration of process environment/stdout/stderr.
  • Keep scenario-specific fake commands and assertions local; do not create a production dependency on test code.

Validation

Run the affected workspace test modules, then all base_projects tests. Verify ordinary and TTY output capture and environment restoration on success and exception.

Run focused checks first, then the repository-required broader checks for the actual implementation. Preserve public command contracts and review .ai-context/ impact in the PR.

Non-Goals

No wholesale fixture rewrite, test-case merger, reduced assertions or migration of every test to one framework.

Project Fields

  • Status: Ready
  • Priority: P3
  • Area: Python
  • Initiative: Contract Hardening
  • Size: S
  • Milestone: Unscheduled; no release commitment is implied by this audit.

Agent Assignment

Implementation-ready scoped follow-up, assigned to codeforester. Follow AGENTS.md and docs/github-workflow.md: start through basectl gh issue start, use the canonical issue worktree, characterize current behavior before extraction, and open an issue-linked PR. Keep each refactor independently reviewable.

Activity

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or product improvement

Type

No type

Projects

  • Status
    Ready

Relationships

None yet

Development

No branches or pull requests

Issue actions