Skip to content

fix(0.37): route every caller through its canonical owner - #3988

Merged
Daniel Meppiel (danielmeppiel) merged 33 commits into
mainfrom
danielmeppiel-0-37-architecture-review
Nov 19, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 33 commits into
mainfrom
danielmeppiel-0-37-architecture-review

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

The 0.37 architecture review (umbrella #3983) found that roughly 60 consistency defects share one cause. A command, scope or mode skipped an owner that already exists: trust, marketplace origin, lockfile writer or script gate. Some owners also failed open when a caller left out an argument. Route-list guards, which name only the known callers, leaked. Closed-world guards, which refuse every caller except the approved ones, held.

This PR fixes each defect inside its owner, at the last shared point before the effect. In the same PR it makes that owner's static guard closed-world: deny by default, with named exemptions and an insertion mutation case. It adds no new frameworks. The plan/apply core, the obligations linter, the deprecation registry and the single-selector refactor are 0.38 work.

The paused worker PRs below were harvested and reshaped where needed. Each harvested commit names its source PR.

Owner Fix Guard (closed-world)
LockFile.write Stamps the running APM on substantive writes only. No-op writes keep their bytes, and a lock with untranslated pre-0.37 MCP claims keeps its stamp. A bundle's embedded lock warns through warn_if_newer. (#3977, #3978) No module other than deps/lockfile.py serializes a lockfile (to_yaml).
Marketplace resolution The origin check runs before any catalog I/O at every resolve_marketplace_plugin entry point: positional install x@alias (project and -g), uninstall and outdated. The lock read is lazy. (#3976) Unregistered callers of resolve_marketplace_plugin fail.
catalog_freshness envelope apm deps update and apm lock --update revalidate marketplaces. (#3961, new) Every caller of _install_apm_dependencies must sit inside a registered envelope. This replaces the route list.
Trust (exec_trust_context_for_project) Takes the scope's manifest file instead of deriving apm.yml from a root the caller picked. -g resolves APM_HOME/apm.yml. MCP admission under -g reads the parsed manifest. (#3969 test and MCP-admission change) Registered callers only, and the owner never derives apm.yml itself. This caught a new source_root call in the #3981 follow-up.
Exec decision on every exit apm update with no ref change runs the executables reconcile, and audit replay re-derives current trust instead of trusting exec_status: deployed. (#3981) Existing tokens plus mutation cases.
Bundle MCP A Claude bundle reinstall always reconciles its owned MCP servers, so revoke, deny and repack retire them. (#3975) Route _wire_legacy_bundle_mcp_servers -> run_owned_mcp_integration, plus the required reconcile condition.
Pack MCP Reads of root .mcp.json exclude APM-managed servers by default. A mixed file is not referenced by Codex. (#3971) The only allowed opt-out is a dependency's own authored file.
Lifecycle scripts apm lifecycle test --execute builds its runner with build_runner_from_context, so APM_NO_SCRIPTS, org deny_all and script trust apply. (new) New owner lifecycle-script-firing-gate: LifecycleScriptRunner( is constructed only by the factory.
approve/deny selection Exact names only, and an ambiguous name is refused. apm approve on a denied package clears the same-store deny and says so. --frozen names the gate, and deny --user works outside a project. (#3979, plus new matching) The prefix tier is banned, and the ambiguity refusal is required.
Object form apm install --dry-run and apm prune map object-form {name, marketplace} declarations to their lock row. (#3973, #3974) Routes plus removal mutation cases.
Targets and text apm targets honours targets:. Messages name targets:, executables.allow and "marketplace". Generated apm.yml headers and unknown-target errors stop listing vscode. Config docs show copilot. n/a

Behaviour changes Daniel approved on #3983:

  • install x@alias refuses after the alias is rebound.
  • Real lock writes stamp apm_version.
  • approve on a denied package clears the deny and says so.

Exit-code and stderr changes stay in 0.38.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Issue and approved scope

Issue: Refs #3983 (umbrella; scope record: #3983). This is PR A (owner hardening).

Fixes #3956
Fixes #3957
Fixes #3958
Fixes #3959
Fixes #3960
Fixes #3961
Fixes #3962
Fixes #3963
Fixes #3966
Fixes #3792

Refs #3954: #3986 carries the main -g grant fix. This PR adds the trust owner's manifest-path signature, the closed-world guard and the -g MCP-admission read. It will be rebased onto #3986 once that lands.
Refs #3967: this PR covers the vscode header and error text (C5c). Left for a follow-up, or 0.38 where noted: B4 deps list keys, B5 prefixes, C4 --exclude normalization, C5a double warning, C5b update -g label, C5d .github/mcp.json signal list, C5e dry-run .mcp.json preview, the A6 view hint, S8 setup-codex.sh, S11 intellij help.

Does this PR complete the issue, or what remains? It completes the must-ship tier of #3983. PR B, stacked on this one, carries #3955, #3964, #3965, #3874, #2606 and the native-plugin pin portability fix.

Supersedes: #3969 (pending the rebase onto #3986), #3971, #3973, #3974, #3975, #3976, #3977, #3978, #3979, #3981.

Type of change

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

Testing

  • Tested locally (targeted only, per the host capacity rule; CI runs the full matrix)
  • All existing tests pass (CI)
  • Added tests for new functionality (if applicable)

Local evidence:

  • uvx [email protected] check and format --check over the CI paths: passed.
  • YAML I/O, file-length (2100) and relative_to guards: clean.
  • bash scripts/lint-auth-signals.sh: clean.
  • bash scripts/lint-architecture-boundaries.sh: exit 0.
  • python -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 ...: 10.00/10.
  • pytest over the touched unit test files plus test_install_command.py, test_exec_vocab_unification.py and test_manifest_bootstrap.py: 501 passed, 1 skipped.
  • Mutation cases for every touched guard (test_architecture_owner_rule_mutations.py -k trust_owner_reads, freshness_envelope, pack_never_ships, bundle_reinstall_reconciles, object_form_declarations, gated_hooks_retire, lifecycle-script-gate, lockfile-generator): passed.
  • These were run on main and failed, then passed with this PR:
    • test_marketplace_explicit_refresh_lifecycle.py (deps update re-pin and the 503 matrix including deps update and lock --update);
    • the test_approve_deny.py exact and ambiguous matching tests;
    • test_targets_command.py::TestTargetsHonourManifest.
  • APM_E2E_TESTS=1 pytest -n 2 tests/integration/test_package_mcp_executables_gate_lifecycle.py test_deny_remediation_lifecycle.py test_executables_deny_retires_hooks_lifecycle.py test_lockfile_generator_gate_lifecycle.py: 41 passed.

Changelog

  • Lines under ## [Unreleased], grouped by theme (Fixed, Security, one upgrade note for lifecycle test --execute).
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour. It makes existing behaviour consistent across commands (see the waiver line above).

…nt (#3959)

Harvested from #3976; the positional install reads the lock lazily.

Co-authored-by: Copilot App <[email protected]>
…a same-store deny (#3957)

Harvested from #3979.

Co-authored-by: Copilot App <[email protected]>
A partial name could grant or deny execution for another package.

Co-authored-by: Copilot App <[email protected]>
… executables: (#3954)

exec_trust_context_for_project takes the manifest file instead of deriving
apm.yml from a caller-chosen root; -g resolves APM_HOME/apm.yml through
core.scope.get_manifest_path. A closed-world guard registers every caller.
Supersedes #3969 and keeps its lifecycle test.

Co-authored-by: Copilot App <[email protected]>
Every caller of the shared install entry now runs inside a registered
catalog-freshness envelope; the guard is closed-world.

Co-authored-by: Copilot App <[email protected]>
APM_NO_SCRIPTS, org executables.deny_all and project script trust now apply;
LifecycleScriptRunner is built only by build_runner_from_context, guarded
closed-world by the new lifecycle-script-firing-gate owner.

Co-authored-by: Copilot App <[email protected]>
#3966)

The only opt-out is a dependency's own authored .mcp.json; a closed-world
guard refuses any other.

Co-authored-by: Copilot App <[email protected]>
… the gate was never on (#3958)

Harvested from #3981 (b4cface, cb015e6); the trust read uses the scope manifest.

Co-authored-by: Copilot App <[email protected]>
Reads the manifest restriction through the same owner install uses.

Co-authored-by: Copilot App <[email protected]>
- compile's no-output hint names targets:, not the deprecated target:
- pack's mismatch hint no longer suggests the deprecated pack --target
- skip messages name executables.allow instead of allowExecutables
- origin and freshness errors say marketplace, not catalog
- generated apm.yml headers and unknown-target errors stop listing vscode
- config docs show default_client: copilot

Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 20:10
apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical gaps in legacy-lockfile validation and update-time policy enforcement can bypass catalog-origin checks and leave denied executable hooks deployed.

8 open issues
What changed in this PR

This PR hardens APM’s existing decision owners so commands consistently enforce executable trust, marketplace origins, lockfile compatibility, and lifecycle script controls. It addresses the must-ship consistency fixes tracked by #3983, while leaving broader architectural work for 0.38.

Changes:

  • Routes install, update, audit, bundle, and approval flows through shared checks.
  • Adds deny-by-default architecture guards and regression coverage.
  • Updates CLI guidance, documentation, and release notes for the changed behavior.
File Description
tests/​unit/​scripts/​test_architecture_runner.py Registers new guard expectations.
tests/​unit/​marketplace/​test_catalog_origin.py Tests row-level origin checks.
tests/​unit/​install/​test_replay_exec_allow_map.py Tests current executable decisions.
tests/​unit/​deps/​test_lockfile_generator.py Tests stamping and invalid-version warnings.
tests/​unit/​core/​test_target_catalog.py Tests deprecated-alias visibility.
tests/​unit/​core/​test_plugin_manifest.py Tests managed MCP exclusion.
tests/​unit/​commands/​test_targets_command.py Tests manifest-selected targets.
tests/​unit/​commands/​test_approve_deny.py Tests exact and ambiguous matching.
tests/​unit/​bundle/​test_local_bundle.py Tests embedded-lock warnings.
tests/​red_team/​trust/​test_kill_switch.py Verifies lifecycle kill-switch enforcement.
tests/​red_team/​install/​test_execute_bypass.py Verifies lifecycle trust enforcement.
tests/​integration/​test_package_mcp_executables_gate_lifecycle.py Covers global-scope executable trust.
tests/​integration/​test_pack_mcp_ownership_lifecycle.py Checks pack output excludes managed credentials.
tests/​integration/​test_marketplace_origin_entry_points_lifecycle.py Covers alias rebind refusals.
tests/​integration/​test_marketplace_object_form_prune_lifecycle.py Covers object-form pruning.
tests/​integration/​test_marketplace_object_form_dry_run_lifecycle.py Covers read-only object-form previews.
tests/​integration/​test_marketplace_explicit_refresh_lifecycle.py Extends marketplace refresh coverage.
tests/​integration/​test_lockfile_generator_gate_lifecycle.py Covers writer stamps and bundle warnings.
tests/​integration/​test_local_bundle_mcp_retire_lifecycle.py Covers bundle MCP retirement.
tests/​integration/​test_install_local_bundle_e2e.py Covers bundle LSP retirement.
tests/​integration/​test_executables_deny_retires_hooks_lifecycle.py Covers audit and update after denial.
tests/​integration/​test_deny_remediation_lifecycle.py Covers approval remediation and user scope.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds guard mutation cases.
tests/​integration/​test_architecture_marketplace_locked_evidence.py Tests origin-check guard enforcement.
src/​apm_cli/​security/​trust.py Passes explicit trust manifest paths.
src/​apm_cli/​security/​executables.py Makes trust resolution accept manifest paths.
src/​apm_cli/​models/​manifest_bootstrap.py Omits deprecated targets from generated comments.
src/​apm_cli/​marketplace/​errors.py Uses marketplace terminology in diagnostics.
src/​apm_cli/​marketplace/​catalog_origin.py Adds shared row-level origin validation.
src/​apm_cli/​integration/​mcp_config_view.py Names executable denials in diagnostics.
src/​apm_cli/​install/​template.py Uses scoped trust and skips unresolved previews.
src/​apm_cli/​install/​services.py Updates executable approval wording.
src/​apm_cli/​install/​service.py Distinguishes gated MCP from removed declarations.
src/​apm_cli/​install/​orphans.py Maps marketplace declarations to locked coordinates.
src/​apm_cli/​install/​mcp/​integration.py Uses manifest trust and skips empty reconciliation.
src/​apm_cli/​install/​local_bundle_handler.py Reconciles empty bundle MCP selections.
src/​apm_cli/​install/​exec_gate.py Re-evaluates executable trust for replay and update.
src/​apm_cli/​install/​dry_run_plan.py Deduplicates resolved marketplace dependencies.
src/​apm_cli/​install/​drift.py Applies current executable decisions during replay.
src/​apm_cli/​deps/​reachability.py Exposes locked marketplace mapping.
src/​apm_cli/​deps/​outdated_row.py Adds diagnostic details to outdated rows.
src/​apm_cli/​deps/​lockfile.py Stamps substantive writes and detects null versions.
src/​apm_cli/​deps/​lockfile_generator.py Adds bundle-specific compatibility warnings.
src/​apm_cli/​core/​target_detection.py Omits deprecated aliases from errors.
src/​apm_cli/​core/​target_catalog.py Defines advertised manifest target names.
src/​apm_cli/​core/​plugin_manifest.py Excludes APM-managed root MCP servers.
src/​apm_cli/​core/​experimental.py Updates canvas approval guidance.
src/​apm_cli/​commands/​update.py Reconciles changed trust without ref changes.
src/​apm_cli/​commands/​uninstall/​engine.py Checks origins before marketplace fallback.
src/​apm_cli/​commands/​targets.py Reads manifest target declarations.
src/​apm_cli/​commands/​pack.py Corrects target-selection guidance.
src/​apm_cli/​commands/​outdated.py Reports marketplace origin conflicts.
src/​apm_cli/​commands/​lock.py Wraps resolution in catalog freshness handling.
src/​apm_cli/​commands/​lifecycle.py Routes execution through the script gate.
src/​apm_cli/​commands/​install.py Checks locked origins for positional marketplace installs.
src/​apm_cli/​commands/​deps/​cli.py Revalidates catalogs during dependency updates.
src/​apm_cli/​commands/​compile/​cli.py Uses current target-field wording.
src/​apm_cli/​commands/​approve.py Tightens selection and clears same-store denials.
src/​apm_cli/​codex_plugins/​admission.py Updates approval-field diagnostics.
src/​apm_cli/​bundle/​plugin_exporter.py Filters managed MCP with a dependency exception.
src/​apm_cli/​bundle/​local_bundle.py Warns about newer embedded lock generators.
scripts/​architecture_linter/​groups/​contracts_tests.py Registers lifecycle script guards.
scripts/​architecture_linter/​checks/​marketplace_pack_plugin_manifests.py Guards MCP ownership filtering.
scripts/​architecture_linter/​checks/​marketplace_locked_evidence.py Guards marketplace mapping and resolution callers.
scripts/​architecture_linter/​checks/​marketplace_catalog_freshness.py Requires registered freshness envelopes.
scripts/​architecture_linter/​checks/​install_lsp_plugin.py Guards trust callers and exact matching.
scripts/​architecture_linter/​checks/​install_frozen_and_audit.py Guards bundle MCP reconciliation.
scripts/​architecture_linter/​checks/​contracts_lockfile_generator.py Guards version stamps and serialization.
scripts/​architecture_linter/​checks/​contracts_lifecycle_script_gate.py Restricts lifecycle runner construction.
packages/​apm-guide/​.apm/​skills/​apm-usage/​package-authoring.md Documents bundle executable retirement.
packages/​apm-guide/​.apm/​skills/​apm-usage/​dependencies.md Documents marketplace origin refusals.
docs/​src/​content/​docs/​troubleshooting/​install-failures.md Explains newer bundle-lock warnings.
docs/​src/​content/​docs/​reference/​lockfile-spec.md Clarifies generator stamping semantics.
docs/​src/​content/​docs/​reference/​cli/​pack.md Documents managed MCP filtering.
docs/​src/​content/​docs/​reference/​cli/​outdated.md Documents origin conflicts and exit status.
docs/​src/​content/​docs/​reference/​cli/​marketplace.md Lists commands that reject rebound aliases.
docs/​src/​content/​docs/​reference/​cli/​lifecycle.md Documents execution gate requirements.
docs/​src/​content/​docs/​reference/​cli/​install.md Clarifies frozen denial diagnostics.
docs/​src/​content/​docs/​reference/​cli/​deny.md Explains remediation and hook reconciliation.
docs/​src/​content/​docs/​reference/​cli/​config.md Corrects the default client example.
docs/​src/​content/​docs/​reference/​cli/​approve.md Documents denial clearing and user scope.
docs/​src/​content/​docs/​reference/​baseline-checks.md Documents denied MCP audit diagnostics.
docs/​src/​content/​docs/​enterprise/​lifecycle-scripts.md Clarifies gated synthetic execution.
docs/​src/​content/​docs/​consumer/​installing-from-marketplaces.md Explains alias-rebind protection.
docs/​src/​content/​docs/​consumer/​deploy-a-bundle.md Documents MCP and LSP retirement.
CHANGELOG.md Records fixes, security changes, and migration guidance.
.apm/​architecture/​owners/​marketplace-plugins.json Updates marketplace origin ownership.
.apm/​architecture/​owners/​contracts-tooling.json Registers script-gate and stamping ownership.

Review effort: Balanced

Comment thread src/apm_cli/commands/install.py Resolved
Comment thread src/apm_cli/commands/update.py Resolved
Comment thread src/apm_cli/install/exec_gate.py Resolved
Comment thread src/apm_cli/commands/approve.py Resolved
Comment thread src/apm_cli/commands/targets.py Resolved
Comment thread src/apm_cli/install/dry_run_plan.py Resolved
Comment thread src/apm_cli/install/orphans.py Resolved
Harvested from #3981 (6cd7b3a, delta panel fold). Only a denied row
with mixed per-type verdicts reconciles, so common partial approvals keep
the no-change short-circuit; the probe catches only unreadable-package
errors instead of every exception. Tests pin when the probe fetches
policy, mixed detection on a two-type package, and every unavailable
policy outcome. Test calls pass the scope manifest path, per #3988's
trust-owner signature.

Refs #3958

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: danielmeppiel <[email protected]>
Co-authored-by: Copilot App <[email protected]>
CI on 913336a was red on tests that encoded the pre-#3983 contracts:
- lifecycle test --execute now fires through the script gate, so the
  firing test trusts the project first and the old bypass trap now
  asserts untrusted scripts are withheld (mutation-break: restoring an
  ungated LifecycleScriptRunner fails it);
- codex native admission names executables.allow, not allowExecutables;
- a real LockFile.write stamps the running CLI (#3962), so the heal
  eligibility fixture pins the stamp it means to write;
- pack no longer ships servers apm install renders from apm.yml (#3966),
  so the bundle MCP retire test authors its server in .mcp.json.

Addresses merge-worker CI triage on #3988.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
require_locked_catalog_origin rescanned lockfile.dependencies for every
package, breaking the uninstall single-traversal guarantee. The batch
index now also keys rows case-insensitively, and the registry fallback
checks each matched row through require_locked_row_origin before any
catalog I/O. Adds a rebound-alias regression test (mutation-break:
dropping the check lets the catalog be reached) and moves the origin
entry-point guard and its mutation case to the new call.

Refs #3959

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
A Claude plugin silently lost the MCP servers apm install renders from
apm.yml. Pack now names them and the remedy; the CHANGELOG moves the
#3966 line to upgrade notes with that migration, pack.md and apm-usage
say the same, and the unrelated #3931 line this PR dropped is restored.

Addresses panel follow-ups (supply-chain, doc-writer) on #3988.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
- install x@alias reads a legacy apm.lock for the origin check, through
  the read-only lockfile resolver, so a rebound alias fails closed before
  migration (Copilot on commands/install.py:220);
- the update probe reuses POLICY_RESOLUTION_FAILURE_OUTCOMES, so an
  incomplete policy chain also forces the guarded install path
  (Copilot on commands/update.py:148);
- apm approve clears a same-store deny stored under any spelling the
  deny ladder matches (URL, host, case), via canonical_exec_identity
  (Copilot on commands/approve.py:817).

Each fix has a regression test proven by mutation-break.

Refs #3957, #3958, #3959

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
restriction() folds singular `target: all` to None (auto-detect), but
install expands it to the stable install set, so apm targets showed every
target inactive. Expand it through target_catalog.expand_all("install").
Regression test proven by mutation-break.

Addresses Copilot on commands/targets.py:32.

Refs #3792

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
locked_marketplace_row and locked_marketplace_form were called per
declaration without an index, so LockFile.get_dependency rebuilt the
marketplace index each time (O(M*N)). Both callers now build it once,
as the reachability walk already does.

Addresses Copilot on install/dry_run_plan.py:33 and install/orphans.py:46.

Refs #3960

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
The object-form mutation cases match the exact call text, which now
passes the shared marketplace index.

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel

Daniel Meppiel (danielmeppiel) commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

PR A of the 0.37 owner hardening routes every caller through its existing owner and closes each guard; the merge-worker folded the CI-red seams and the Copilot review.

panel-mode=lean (iteration 1), delta (iterations 2-3, terminal); personas=python-architect,supply-chain-security-expert,test-coverage-expert,doc-writer,apm-ceo

cc Daniel Meppiel (@danielmeppiel) Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

The architecture is right and on-scope: each #3983 defect is fixed inside its canonical owner with a closed-world guard and mutation case, and nothing from PR B (#3955, #3964, #3965, #3874, #2606, pin portability) or PR C (tier-2 polish) leaked in. The 913336a head was red because tests still encoded contracts this PR reverses (lifecycle --execute, allowExecutables wording, lock stamping), two harvested worker commits (#3971 pack exclusion, #3975 bundle MCP retire) disagreed, and the #3976 harvest broke the uninstall single-traversal guarantee. All were folded at the owner, and the #3981 delta fold (6cd7b3a) was harvested with the manifest-path trust signature.

Copilot's round surfaced six more in-scope gaps, all folded: legacy apm.lock in the origin check, incomplete_chain in the update probe, URL-form deny clearing in apm approve, singular target: all in apm targets, and per-declaration index rebuilds in dry-run and prune. One was declined as deliberate design (no org fetch when no gate was ever recorded). Pack now reads only authored MCP sources: apm.yml declarations ship from apm.yml and authored .mcp.json entries ship as written, never the copy apm install renders (maintainer decision on #3966 scope, red team qa-prA-5).

Aligned with: secure by default: Origin checks run before catalog I/O on every entry point; approve/deny match exactly; lifecycle --execute honours the script gate.; portable by manifest: Trust reads the scope manifest, so -g honours executables: in APM_HOME/apm.yml.; pragmatic as npm: Real lock writes record the CLI that wrote them; no-op writes keep their bytes.

Panel summary

Persona B R N Takeaway
Python Architect 0 3 0 Owner routing is sound; two harvest seams broke CI and the uninstall single-traversal contract -- both folded at the owner.
Supply Chain Security Expert 0 2 0 Fail-closed defaults hold (origin check, exact approve, gate on update/audit); pack drop of managed MCP was silent for Claude producers.
Test Coverage Expert 1 2 0 Coverage is broad and fail-on-main; CI exposed four suites still encoding pre-#3983 contracts -- all realigned with mutation-breaks.
Doc Writer 0 2 0 Docs and apm-usage track the changes; the CHANGELOG lost an unrelated line and the pack change needs an upgrade note.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 5 follow-ups

  1. [Test Coverage Expert] (blocking-severity) Realign lifecycle, codex admission, heal-eligibility and bundle-retire tests to the 0.37 contracts (folded in 430b4e2). -- They were the CI-red cause on 913336a.
  2. [Python Architect] Uninstall origin check consumes the batch index via require_locked_row_origin (folded in 95e5310). -- Restores the single-traversal guarantee without losing the [BUG] apm install plugin@alias bypasses the marketplace origin check after an alias rebind #3959 check.
  3. [Supply Chain Security Expert] Warn when Claude pack leaves out APM-managed MCP servers; [BUG] Codex plugin.json from apm pack can point at APM's rendered .mcp.json, which may contain credentials #3966 moved to upgrade notes (folded in 5e5e354). -- Silent omission of shipped content surprises producers.
  4. [Doc Writer] Restore the fix(self-update): isolate Windows installer from inherited PSModulePath #3931 CHANGELOG line this PR dropped (folded in 5e5e354). -- Never delete another PR's Unreleased entry.
  5. [Python Architect] Converge trust-owner manifest-path derivation on core.scope.manifest_root (done in the fix(security): apply ~/.apm/apm.yml executable grants to global install and uninstall #3986 merge, e9d6c9d). -- Removes the last split in how callers name the scope manifest.

Recommendation

Ship after required review: every required check is green on 2e846b8. Iteration 3 merged main (#3986) onto one trust-owner signature and folded red-team qa-prA-5/6: Claude bundles again ship the producer's own apm.yml MCP servers (from apm.yml, credentials stripped, identical before and after install), and only claims whose runtime writes root .mcp.json can hide an authored root server. The one red check is the advisory eligibility evidence, which stops at its issue-reference limit for this umbrella PR and asks for human review by design.

Reservations carried from strategic-alignment

Folded in this run

  • (copilot) src/apm_cli/commands/install.py:220 -- origin check read only apm.lock.yaml; a legacy apm.lock was ignored before migration -- resolved in 1a24c8d.
  • (copilot) src/apm_cli/commands/update.py:148 -- duplicated failure-outcome set missed incomplete_chain; now reuses POLICY_RESOLUTION_FAILURE_OUTCOMES -- resolved in 1a24c8d.
  • (copilot) src/apm_cli/commands/approve.py:817 -- same-store deny clear only stripped versions; now matches every spelling the deny ladder matches via canonical_exec_identity -- resolved in 1a24c8d.
  • (copilot) src/apm_cli/commands/targets.py:32 -- restriction() folds singular target: all to auto-detect; install expands it to the install set -- resolved in 60667a1.
  • (copilot) src/apm_cli/install/dry_run_plan.py:33 -- per-declaration marketplace index rebuild made the dry-run dedupe O(M*N) -- resolved in 2249909.
  • (copilot) src/apm_cli/install/orphans.py:46 -- per-declaration marketplace index rebuild in prune expected paths -- resolved in 2249909.
  • (copilot) tests/integration/test_local_bundle_mcp_retire_lifecycle.py:51 -- fixture declared the server in apm.yml, which pack now withholds; server is now authored in .mcp.json -- resolved in 430b4e2.
  • (panel) test_lifecycle.py realigned: --execute fires through the script gate (test-coverage-expert) -- resolved in 430b4e2.
  • (panel) codex admission tests and req-sc-009 spec test match executables.allow wording (test-coverage-expert) -- resolved in 430b4e2.
  • (panel) heal-eligibility fixture pins the 0.37 stamp LockFile.write now restamps (test-coverage-expert) -- resolved in 430b4e2.
  • (panel) uninstall origin check consumes the batch index via require_locked_row_origin; single traversal restored (python-architect) -- resolved in 95e5310.
  • (panel) Claude pack warns when APM-managed root .mcp.json servers are left out (supply-chain-security-expert) -- resolved in 5e5e354.
  • (panel) CHANGELOG: restore dropped fix(self-update): isolate Windows installer from inherited PSModulePath #3931 line; [BUG] Codex plugin.json from apm pack can point at APM's rendered .mcp.json, which may contain credentials #3966 line now describes authored-source packing; pack.md and apm-usage updated (doc-writer) -- resolved in 5e5e354.
  • (panel) harvest fix(update,audit): honour the current executables decision after apm deny #3981 delta fold 6cd7b3a: denied-only mixed reconcile, narrowed probe except, tests (implementer request) -- resolved in 30dc28d.
  • (panel) object-form mutation cases track the shared marketplace index -- resolved in 034033d.
  • (panel) Merge main fix(security): apply ~/.apm/apm.yml executable grants to global install and uninstall #3986 (14d828e): trust callers pass project_manifest_path(manifest_root(...)); package_path getattr chain dropped; audit replay reads APM_HOME/apm.yml under -g; guard refuses registered callers deriving apm.yml (resolves the deferred manifest_root convergence) -- resolved in e9d6c9d.
  • (panel) qa-prA-5: Claude bundle and plugin.json ship the producer's apm.yml self-defined MCP servers from apm.yml values, credential-stripped, byte-identical before/after install -- resolved in 2e846b8.
  • (panel) qa-prA-6: only lock claims whose runtime writes root .mcp.json hide an authored root server (Cursor-only claim no longer drops it from Claude/Codex) -- resolved in 2e846b8.

Copilot signals reviewed

  • src/apm_cli/commands/install.py:220 -- LEGIT: origin check read only apm.lock.yaml; a legacy apm.lock was ignored before migration (resolved in 1a24c8d).
  • src/apm_cli/commands/update.py:148 -- LEGIT: duplicated failure-outcome set missed incomplete_chain; now reuses POLICY_RESOLUTION_FAILURE_OUTCOMES (resolved in 1a24c8d).
  • src/apm_cli/install/exec_gate.py:396 -- NOT-LEGIT: deliberate fix(update,audit): honour the current executables decision after apm deny #3981 delta-panel design: no org fetch when no gate was ever recorded and local layers leave it off; apm install applies a newly enabled gate and apm audit --ci replay re-derives current trust, so hooks are reported.
  • src/apm_cli/commands/approve.py:817 -- LEGIT: same-store deny clear only stripped versions; now matches every spelling the deny ladder matches via canonical_exec_identity (resolved in 1a24c8d).
  • src/apm_cli/commands/targets.py:32 -- LEGIT: restriction() folds singular target: all to auto-detect; install expands it to the install set (resolved in 60667a1).
  • src/apm_cli/install/dry_run_plan.py:33 -- LEGIT: per-declaration marketplace index rebuild made the dry-run dedupe O(M*N) (resolved in 2249909).
  • src/apm_cli/install/orphans.py:46 -- LEGIT: per-declaration marketplace index rebuild in prune expected paths (resolved in 2249909).
  • tests/integration/test_local_bundle_mcp_retire_lifecycle.py:51 -- LEGIT: fixture declared the server in apm.yml, which pack now withholds; server is now authored in .mcp.json (resolved in 430b4e2).

Regression-trap evidence (mutation-break gate)

  • tests/unit/commands/test_lifecycle.py::TestLifecycleTestTrustDisplay::test_execute_flag_withholds_untrusted_scripts -- deleted build_runner_from_context in lifecycle_test (replaced by an ungated LifecycleScriptRunner); test FAILED as expected; guard restored.
  • tests/unit/test_uninstall_engine_helpers.py::TestResolveMarketplacePackagesSingleTraversal::test_rebound_alias_never_reaches_the_catalog -- deleted require_locked_row_origin loop in _resolve_marketplace_packages; test FAILED as expected; guard restored.
  • tests/integration/test_local_bundle_mcp_retire_lifecycle.py::test_bundle_mcp_retires_on_revoke_deny_and_repack -- deleted Claude-format clause of bundle_mcp_present in install_local_bundle; test FAILED as expected; guard restored.
  • tests/unit/core/test_plugin_manifest.py::TestApmManagedMcpExcludedFromPack::test_mixed_file_is_not_referenced_by_codex_and_filtered_for_claude -- deleted dropped-server warning in collect_mcp_servers; test FAILED as expected; guard restored.
  • tests/unit/test_install_command.py::test_marketplace_origin_check_reads_a_legacy_lockfile -- deleted resolve_lockfile_path_for_read in _scoped_lockfile; test FAILED as expected; guard restored.
  • tests/unit/install/test_replay_exec_allow_map.py::test_update_probe_fails_toward_the_gate_on_unavailable_policy[incomplete_chain-True] -- deleted POLICY_RESOLUTION_FAILURE_OUTCOMES in _executables_need_reconcile (old 4-outcome set); test FAILED as expected; guard restored.
  • tests/unit/commands/test_approve_deny.py::test_approve_clears_a_deny_stored_under_another_spelling -- deleted canonical_exec_identity match in _same_store_denies; test FAILED as expected; guard restored.
  • tests/unit/commands/test_targets_command.py::TestTargetsHonourManifest::test_singular_target_all_is_active_like_install -- deleted singular all expansion in _manifest_targets; test FAILED as expected; guard restored.
  • tests/unit/install/test_replay_exec_allow_map.py::test_global_replay_reads_the_user_manifest -- deleted user_scope in ReplayExecAllowMap manifest_root call; test FAILED as expected; guard restored.
  • tests/integration/test_architecture_owner_rule_mutations.py::test_trust_owner_guard_rejects_root_derived_callers[registered-caller-derives-apm-yml-from-root] -- deleted registered-caller apm.yml derivation clause in GUARD_EXECUTABLE_TRUST; test FAILED as expected; guard restored.
  • tests/unit/core/test_plugin_manifest.py::TestApmManagedMcpExcludedFromPack::test_root_manifest_declarations_ship_identically_before_and_after_install -- deleted apm.yml projection (whole fix; fails on e9d6c9d153); test FAILED as expected; guard restored.
  • tests/unit/core/test_plugin_manifest.py::TestApmManagedMcpExcludedFromPack::test_another_runtimes_claim_does_not_hide_an_authored_root_server -- deleted root-destination claim filter (whole fix; fails on e9d6c9d153); test FAILED as expected; guard restored.

Lint contract

uvx [email protected] check and format --check (src/, tests/, architecture linter scripts) silent; scripts/lint-auth-signals.sh clean; scripts/lint-architecture-boundaries.sh exit 0; pylint R0801 10.00/10.

CI

gh pr checks 3988 at 2e846b8: 30 pass (Lint, Build & Test shards, Lifecycle Smoke shards, Windows gates, Spec tests + conformance gate, NOTICE, CodeQL, 'gate'), 3 skipping, 1 fail: 'Publish neutral eligibility evidence' (advisory-only pull_request_target check: 'Issue reference limit exceeded' for this umbrella PR's body; asks for human review; not a required check). Earlier recovery: test realignment push, two infra flakes rerun once each. (after 3 CI fix iteration(s)).

Mergeability status

PR head SHA CEO stance iters folds defers Copilot rounds CI mergeable mergeStateStatus notes
#3988 2e846b8 ship_with_followups 3 18 0 2 red (advisory eligibility only) MERGEABLE BLOCKED pending required review

Convergence

3 outer iteration(s); 2 Copilot round(s). Final panel stance: ship_with_followups. Ready for maintainer review.


Full per-persona findings

Python Architect

Supply Chain Security Expert

  • [recommended] Claude pack silently drops root .mcp.json servers apm install manages, so a producer's apm.yml-declared MCP vanishes from the plugin without notice. at src/apm_cli/core/plugin_manifest.py
    Codex already warns on a mixed file; the Claude path filtered with no message. Silent omission of shipped content is a correctness surprise even when the direction is safe.
    Suggested: Warn naming the dropped servers and the remedy (write them in .mcp.json yourself).
  • [recommended] Uninstall registry fallback must keep the [BUG] apm install plugin@alias bypasses the marketplace origin check after an alias rebind #3959 origin check before any catalog I/O once it moves off require_locked_catalog_origin. at src/apm_cli/commands/uninstall/engine.py
    A rebound alias must never reach the new catalog; a recased plugin name misses both exact and plugin indexes and is the only path that reaches the fallback with a locked row.
    Proof (passed): tests/unit/test_uninstall_engine_helpers.py::TestResolveMarketplacePackagesSingleTraversal::test_rebound_alias_never_reaches_the_catalog -- proves: uninstall never resolves through a marketplace alias rebound since lock time

Test Coverage Expert

  • [blocking] test_lifecycle.py still asserted that lifecycle test --execute bypasses trust, the contract this PR deliberately reverses. at tests/unit/commands/test_lifecycle.py:234
    Build & Test Shard 1/2 failed on 913336a; the stale trap kept CI red and mis-documented the security posture.
    Proof (passed): tests/unit/commands/test_lifecycle.py::TestLifecycleTestTrustDisplay::test_execute_flag_withholds_untrusted_scripts -- proves: an untrusted project script is not fired by lifecycle test --execute
  • [recommended] Codex admission tests (unit and spec_conformance req-sc-009) matched the old allowExecutables wording. at tests/spec_conformance/test_codex_compatibility_admission_reqs.py:80
    Spec tests (2/3) and the Spec conformance gate failed on the message rename only; the req-sc-009 deny behavior is unchanged.
    Proof (passed): tests/spec_conformance/test_codex_compatibility_admission_reqs.py::test_codex_consumer_denies_unapproved_manifest_referenced_mcp -- proves: an unapproved manifest-referenced MCP server is denied before queueing
  • [recommended] heal-eligibility fixture wrote a 0.37 lock through LockFile.write, which now restamps the running CLI. at tests/unit/install/test_copilot_project_mcp_destination.py
    The fixture, not the heal, was wrong: the pre-install snapshot case passes; the stamped-only fixture must pin the stamp it intends to write.
    Proof (passed): tests/unit/install/test_copilot_project_mcp_destination.py::test_heal_eligibility_reads_the_pre_install_lock -- proves: heal eligibility reads the pre-install lock, not a post-write stamp

Doc Writer

This panel is advisory. It does not block merge. Re-apply the
panel-review label after addressing feedback to re-run.


Generated by autopilot-pr-merge-worker. This comment is AI-generated and may contain errors.

…t caller

Brings in #3986 (user-scope executable grants from ~/.apm/apm.yml) at
14d828e. Conflicts in install/template.py and security/trust.py are
resolved to #3988's trust-owner signature: exec_trust_context_for_project
takes the scope's manifest FILE, derived through the scope owner as
project_manifest_path(manifest_root(root, user_scope=...)). #3986's
manifest_root stays for directory callers (resolve_project_exec_allow_map,
uninstall, hook integrator); policy stays anchored at the deploy root.

Folded at the owner:
- prepare_mcp_integration drops the apm_package.package_path getattr chain;
  McpAdmission.for_project(user_scope=...) now names the grants manifest.
- Audit replay (ReplayExecAllowMap) takes user_scope and reads
  APM_HOME/apm.yml under -g instead of deriving apm.yml from the deploy root;
  regression test proven by mutation-break.
- GUARD_EXECUTABLE_TRUST also refuses a registered caller whose body derives
  apm.yml from a root; standalone mutation test
  test_trust_owner_guard_rejects_root_derived_callers covers an unregistered
  #3986-style global-uninstall caller and a registered caller deriving
  apm.yml (mutation-break: dropping the new clause fails it).

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
…entries

Red team qa-prA-5 and qa-prA-6 on #3988, both regressions against main:

- A Claude bundle and plugin.json dropped the producer's own apm.yml MCP
  servers: they were read only from the rendered root .mcp.json, which pack
  now withholds. collect_mcp_servers projects the root manifest's
  self-defined declarations from apm.yml values (never the rendered copy),
  through the existing credential stripping, so output is byte-identical
  before and after apm install. The pack warning remains only for
  APM-managed servers apm.yml does not define (a dependency's).
- apm_managed_mcp_names unioned lock claims from every runtime, so a
  Cursor-only claim on `docs` hid an authored root `docs` from Claude and
  Codex. Only claims whose runtime writes root .mcp.json count, read
  through the factory (ClientFactory.project_destination_is_root_mcp_json,
  side-effect free); unknown runtimes and unplaced aggregate names stay
  managed (conservative).

The new unit tests fail on e9d6c9d and pass here; the bundle-retire
lifecycle test is back to its apm.yml declaration; test_pack_mcp_ownership
asserts byte identity, no header or secret values and no reference to the
rendered file; the pack guard requires both owner rules, with a standalone
mutation test. CHANGELOG, pack.md and apm-usage updated.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 67936cd into main Nov 19, 2026
33 of 34 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-0-37-architecture-review branch November 19, 2026 22:33
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 19, 2026
#3966's pack projection (#3988) ships the root apm.yml's self-defined MCP
servers in the Claude plugin, and #2606 (this PR) adds `targets:` on
dependencies.mcp. A server declared `targets: [cursor]` was still embedded
in the Claude plugin.json and bundle .mcp.json. The projection now asks the
per-dependency runtime owner (mcp_dependency_runtimes) whether Claude
receives it. Regression test proven by mutation-break; pack.md updated.

Addresses merge-worker lean panel (python-architect) on #3989.

apm-spec-waiver: consistency fixes route callers through existing owners; no new or changed normative requirement

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants