Skip to content

fix: trust and integrity consistency hardening, part 2 - #4061

Merged
Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
danielmeppiel-4027-part2
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 6 commits into
mainfrom
danielmeppiel-4027-part2

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Trust and integrity consistency hardening, part 2.

Local-bundle hooks now record the exact approval key that admitted them, alongside their hook ownership marker. apm install (including --frozen), apm update and apm prune re-check that key against current approvals and org policy. Hooks whose approval no longer holds are retired through the hook integrator's local-bundle retirement owner, and apm audit --ci reports them first.

Coverage:

  • Merged-config targets (claude, cursor, codex, gemini, antigravity, windsurf) keep the record in their apm-hooks.json sidecar.
  • Per-file targets (Copilot) keep it in the same sidecar name at the target root (.github/apm-hooks.json; under -g, the user-scope Copilot root). That is outside the hooks directory the harness loads. Retirement deletes <root>/hooks/<slug>-hooks.json and drops its lockfile rows.
  • An approved bundle reinstalled from its source re-derives and writes a missing key (upgrade path). A missing key fails closed on apm install, apm install --frozen, apm update, apm prune and apm audit --ci, and prints a hint to rerun apm install <bundle>.

After a retirement:

  • Merged targets: only the hook registration is removed. The inert script files stay recorded in the lockfile, and apm audit --ci stays clean.

  • Copilot: the hook file is removed with its lockfile rows. Under --frozen, lockfile writes are suppressed, so the row stays until the next writable install, and apm audit --ci reports the missing file until then.

  • Single reader/writer of the approval record: integration/hook_ownership.py (local_bundle_hook_source_marker, parse_local_bundle_hook_source).

  • Re-check owner: install/local_bundle_hook_trust.py.

  • New guard install-deployment-local-bundle-hook-trust, registered in the owner registry, with mutation cases.

Stacked on #4051.

Issue and approved scope

Issue: Refs #4027

Human scope-approval comment: #4027 (comment) (item 5)

Does this PR complete the issue, or what remains? Together with #4051 it covers the approved scope.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass (CI pending)

  • Added tests for new functionality (if applicable)

  • tests/integration/test_trust_integrity_consistency_lifecycle.py (installed CLI) covers:

    • grant, install, revoke, then install / install --frozen / update / prune, on both claude and copilot targets: hooks retired;
    • org executables.deny_all: hooks retired;
    • --as alias: approved hooks stay, revoked ones go;
    • missing approval record (merged sidecar and Copilot): fails closed;
    • reinstalling an approved bundle writes a missing key and keeps its hooks;
    • audit --ci flags the hook before retirement.
  • tests/unit/install/test_local_bundle_hook_trust.py.

  • Owner mutation matrix cases for the new guard. Behavioural mutation-breaks: disabling the key re-check fails 6 lifecycle cases, and disabling per-file retirement fails the 6 Copilot cases.

  • ruff check / ruff format --check / pylint R0801 / lint-architecture-boundaries.sh: clean.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

No req-XXX behaviour changes.

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Bump pyproject.toml and uv.lock to 0.37.0 and move [Unreleased] to [0.37.0] in CHANGELOG.md, re-sanitized to one line per change in one section, with 4 Highlights. README: apm-guide pin to v0.37.0 and Codex .codex-plugin/plugin.json in the Build plugins line. Lint mirror green locally (ruff check + format, pylint R0801, auth-signals).

Built on main merged with the final 0.37 stack heads (#3996 ... #4051, without #4061). Post-merge: tag v0.37.0.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Bump pyproject.toml and uv.lock to 0.37.0 and move [Unreleased] to [0.37.0] in CHANGELOG.md, re-sanitized to one line per change in one section, with 4 Highlights. README: apm-guide pin to v0.37.0 and Codex .codex-plugin/plugin.json in the Build plugins line. Lint mirror green locally (ruff check + format, pylint R0801, auth-signals).

Built on main merged with the final 0.37 stack heads (#3996 ... #4051, without #4061). Post-merge: tag v0.37.0.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review November 20, 2026 04:33
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Base automatically changed from danielmeppiel-laughing-bassoon to main November 20, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant