Skip to content

Fold integration drift gate into 'apm audit --drift' (or 'apm install --check') #1071

@danielmeppiel

Description

@danielmeppiel

Problem

CI's APM Self-Check job (.github/workflows/ci.yml:160) runs apm install then asserts git status --porcelain -- .github/ .claude/ .cursor/ .opencode/ is empty as a shell-level drift gate. This catches one drift mode that the in-tree apm audit --ci does not:

Drift case audit --ci catches? Porcelain catches?
Hand-edited regenerated file (hash mismatch) Yes (content-integrity SHA-256) Yes
Lockfile missing file that's on disk Partial Yes
New .apm/ source added but never apm installd No -- lockfile simply omits it; nothing to check Yes -- only gate

The third row bit PR #1067 (commit a51921e4): adding .apm/instructions/linting.instructions.md without re-running apm install slipped past audit and was only caught by porcelain in CI.

Why this matters

  • Porcelain check is shell logic embedded in workflow YAML -- not portable, not testable, not invokable by contributors locally without copy-pasting the bash one-liner.
  • commands/audit.py:5 already declares --drift is a planned mode. Folding the integration drift gate into it (or apm install --check) would:
    • give contributors a single apm command to mirror CI locally;
    • let consumers of microsoft/apm-action opt in via drift-check: true instead of templating bash;
    • delete the run: | block from ci.yml.

Proposed shape

Either:

  • apm audit --drift -- runs apm install against a scratch directory, diffs the resulting governed paths (.github/, .claude/, .cursor/, .opencode/) against the working tree, exits non-zero with a diff on mismatch.
  • apm install --check -- same logic but as a no-write mode of install itself (closer to pip install --dry-run or terraform plan).

Either should:

  1. Detect the missing-mirror case (new .apm/ source not yet integrated).
  2. Detect lockfile entries not yet in local_deployed_files / local_deployed_file_hashes.
  3. Render a diff suitable for CI annotations.

Follow-on

Once shipped, update microsoft/apm-action to expose drift-check: true (companion to existing compile: true), and migrate .github/workflows/ci.yml to call it instead of the inline porcelain script.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/audit-policyapm-policy.yml schema, custom_checks, install-time enforcement.area/ci-cdGitHub workflows, merge queue, gh-aw integrations, release pipeline.area/cliCLI command surface, flags, help text (cross-cutting).enhancementDeprecated: use type/feature. Kept for issue history; will be removed in milestone 0.10.0.priority/highShips in current or next milestonestatus/needs-designDirection approved, design discussion required before code.status/triagedInitial agentic triage complete; pending maintainer ratification (silence = approval).theme/governanceGoverned by policy. apm-policy, audit, enforcement, enterprise rollout.type/featureNew capability, new flag, new primitive.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions