Skip to content

Follow-ups from apm-review-panel on #1313 (adopt byte-identical files) #1314

@danielmeppiel

Description

@danielmeppiel

Tracking the deferred recommendations from the apm-review-panel synthesis on #1313. Each one was raised by 1-3 panelists; none block the merge.

1. Observability: IntegrationResult.files_adopted counter

Convergence: cli-logging-expert + devx-ux-expert.
Adopt-only package runs emit (files unchanged) in the install summary because services.py:347 computes _total_integrated from files_integrated + skill_created + sub_skills_promoted -- adopted files are absent from all three. The catch-22 recovery is invisible to humans and to AI agents reading --verbose traces.

Suggested change:

  • Add files_adopted: int = 0 to IntegrationResult (mirrors the existing sub_skills_promoted field).
  • Increment at each is_content_identical_to_source call site instead of a bare append + continue.
  • Fold into _total_integrated and emit |-- N files adopted (byte-identical) under --verbose.

2. End-to-end test rigor: exercise the real policy-blocked catch-22

Convergence: devx-ux-expert + test-coverage-expert.
tests/integration/test_silent_adopt_existing_files_e2e.py::test_required_packages_deployed_passes_after_lockfile_wipe re-installs with --no-policy, which bypasses the very gate that defines the catch-22. The current test cannot fail even on unfixed main.

Suggested change: add a third apm install run (without --no-policy) and assert returncode == 0; or add an integration-with-fixtures-tier test that keeps the lockfile intact with deployed_files=[] and exercises the real policy_gate -> integrate ordering. Document the one-time apm install --no-policy recovery command for users already in the catch-22.

3. Refactor: BaseIntegrator.try_adopt_identical helper

From: python-architect.
The 5-line if self.is_content_identical_to_source(t, s): target_paths.append(t); continue pattern is repeated verbatim at 7 call sites across agent_integrator, instruction_integrator, prompt_integrator, command_integrator, and (after #1313) hook_integrator. Exceeds the project's abstract-at-3-call-sites threshold.

Sketch:

@staticmethod
def try_adopt_identical(target_path: Path, source_path: Path, target_paths: list[Path]) -> bool:
    if BaseIntegrator.is_content_identical_to_source(target_path, source_path):
        target_paths.append(target_path)
        return True
    return False

Each call site collapses to if self.try_adopt_identical(...): continue. Pure refactor, no behavior change.

(Architect explicitly recommends against the heavier tri-state decide_file_action -> Literal['adopt','skip','write'] shape until adopt logic grows beyond byte-equality -- speed and simplicity over complexity.)

4. Naming symmetry: SkillIntegrator._dirs_equal

From: python-architect (nit).
Rename SkillIntegrator._dirs_equal to is_skill_dir_identical_to_source so the symmetry with BaseIntegrator.is_content_identical_to_source is visible without having to discover the parallel.

5. Error UX: hint the --no-policy escape

From: devx-ux-expert.
The required-packages-deployed violation message at policy_gate.py:153 lists missing packages but offers no concrete next action for users in the catch-22. Append:

Hint: re-run with --no-policy to bypass this check and repair the lockfile, then reinstall normally.

6. CommandIntegrator copilot-target unit test

From: test-coverage-expert (nit).
tests/unit/integration/test_content_identical_adopt.py:239 has a comment claiming CommandIntegrator adopt is dead-code because of the format transformer. False: the adopt check fires before the format dispatch for the primary copilot target (which is a direct .prompt.md copy). Add a TestCommandIntegratorAdopt mirroring TestPromptIntegratorAdopt for the copilot target and remove the misleading comment.

7. Growth-narrative framing

From: oss-growth-hacker.
Frame the next release post around 'self-healing governance' -- a real enterprise consumer (zava-storefront) reproduced a permanent install lockout and the policy engine now repairs itself. Lead with the named-user citation; the trust arc converts skeptics of heavy policy tooling into adopters.


Originating PR: #1313

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliCLI command surface, flags, help text (cross-cutting).area/testingTest infrastructure, fixtures, e2e harness, coverage.status/acceptedDirection approved, safe to start work.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/governanceGoverned by policy. apm-policy, audit, enforcement, enterprise rollout.type/refactorInternal restructure, no behavior change.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions