Skip to content

Test gap: TestExplicitTargetDirCreation and TestContentHashFallback are logic-replays #768

@danielmeppiel

Description

@danielmeppiel

Surfaced by Copilot review of #763.

The two test classes added in #763TestExplicitTargetDirCreation and TestContentHashFallback in tests/unit/test_install_command.py — re-implement the production conditional inline rather than exercising apm install itself. They will pass even if install/phases/targets.py or install/phases/{download,integrate}.py regress, defeating their purpose as regression guards.

Required follow-up

  1. Explicit target dir creation — invoke apm install --target claude via CliRunner (mocking downloads/integration), assert .claude/ is created. Or factor the loop in install/phases/targets.py into a helper and unit-test the helper directly.
  2. Content-hash fallback — exercise the install flow with a mocked git.Repo that raises and a mocked downloader; assert the downloader is not called when content_hash matches, and is called when it mismatches/is missing. Affects three sites:
    • install/phases/download.py:81-90
    • install/phases/integrate.py:104-114 (update_refs branch)
    • install/phases/integrate.py:115-126 (normal-mode branch)

Context

This aligns with the broader integration-coverage push in #767 — the cleanest fix is likely a shared CliRunner-based fixture under tests/integration/install/ rather than more isolated unit tests.

Acceptance criteria

  • New tests fail if the and not _explicit guard is removed from targets.py.
  • New tests fail if the content-hash fallback in any of the 3 sites is replaced back with pass.

Refs: #763 (Copilot review comments), #767 (integration coverage gaps).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/testingTest infrastructure, fixtures, e2e harness, coverage.good first issueGood for newcomerspriority/lowAccepted but not time-sensitivestatus/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).type/bugSomething does not work as documented.

    Type

    No type

    Projects

    Status

    In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions