Repository navigation
fix: 0.36.0 red-team round 2 (MCP config safety, user-file collisions, graph reconciliation, approvals, manifest corner cases) - #3709
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
APM Review Panel:
|
| Persona | B | R | N | Takeaway |
|---|---|---|---|---|
| Python Architect | 0 | 0 | 0 | Owner routing is clean across all 25 fixes; no split authority, no import-time cost, no merge-risk interactions with #3672. |
| Supply Chain Security Expert | 0 | 0 | 0 | Strengthens defenses on approval keys, MCP config I/O, same-name conflicts, lock parent identity and cleanup release; no regressions found. |
| Test Coverage Expert | 0 | 2 | 0 | Lifecycle modules cover all exit-code fixes at integration tier; #3692 and #3685 were unit-only (#3692 now folded). |
B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.
Top 1 follow-ups
- [Test Coverage Expert] Fold the [BUG] An unquoted
lockfile_version: 1fails with "Unsupported lockfile version 1; supported versions: 1, 2, 3" #3692 lockfile_version integration-with-fixtures lifecycle case -- unit coverage passed but the lockfile surface floor is integration-with-fixtures. Done in 71a0085.
Recommendation
Merge once CI is green. The #3692 lifecycle case is folded; the #3685 unit test is the correct probative tier given case-sensitive Linux CI. Zero blocking findings across three specialist lenses and the fail-before/pass-after matrix make this a high-confidence ship for 0.36.0.
Full per-persona findings
Python Architect
No findings.
Supply Chain Security Expert
No findings.
Test Coverage Expert
- [recommended] [BUG] An unquoted
lockfile_version: 1fails with "Unsupported lockfile version 1; supported versions: 1, 2, 3" #3692 lockfile_version int fix has unit coverage only; lockfile surface floor requires integration-with-fixtures attests/unit/test_lockfile_v2_bump.py
No integration test drove a CLI command against a lockfile with an unquoted integer version. Folded:tests/integration/test_unquoted_lockfile_version_lifecycle.py(fails before, passes after).
Proof (passed):tests/unit/test_lockfile_v2_bump.py::test_unquoted_integer_lockfile_version_is_the_same_version-- proves: a lockfile whose version field lost its YAML quotes still loads and round-trips [devx,portability-by-manifest] - [recommended] [BUG]
apm export-patchwrites two packages whose names differ only by case to the same patch file on macOS and Windows #3685 export-patch case-insensitive filename collision fix is unit-only attests/unit/commands/test_export_patch.py
No e2e exercises case-only package names. On case-sensitive Linux CI an e2e cannot reproduce the collision, so the unit test on the casefold logic carries the proof.
Proof (passed):tests/unit/commands/test_export_patch.py::test_patch_filenames_disambiguates_case_only_collisions-- proves: two packages differing only by case produce distinct patch filenames [devx,multi-harness-support]
assert len({name.casefold() for name in names.values()}) == 2
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-review-worker. This comment is AI-generated and may contain errors.
There was a problem hiding this comment.
🟡 Changes recommended
Duplicate manifest keys can cause deployment removal, while cross-section installs can silently discard dependency pins, source metadata, and selection restrictions.
4 open issues
What changed in this PR
This PR addresses the second round of APM’s pre-release lifecycle sweep, extending shared install, configuration, ownership and manifest logic to protect user files and keep dependency state consistent.
Changes:
- Harden MCP configuration writes, executable approvals, interruption handling and user-file collision behavior.
- Correct dependency reconciliation, manifest validation, bundle target selection and cross-platform path handling.
- Add regression tests, architecture guards and documentation for the revised behavior.
| File | Description |
|---|---|
| tests/unit/utils/test_paths.py | Tests physical path aliases. |
| tests/unit/test_view_file_provenance.py | Covers Unicode and user-scope provenance. |
| tests/unit/test_transitive_mcp.py | Isolates name-only adapter behavior. |
| tests/unit/test_lockfile_v2_bump.py | Tests integer lockfile versions. |
| tests/unit/test_install_update_refs.py | Checks selection-scoped local rechecks. |
| tests/unit/test_config_command.py | Tests valid-key reporting and dispatch. |
| tests/unit/test_cli_sigterm.py | Tests first and repeated SIGTERM handling. |
| tests/unit/test_claude_mcp.py | Requires malformed configs to remain unchanged. |
| tests/unit/scripts/test_architecture_runner.py | Updates expected architecture rules. |
| tests/unit/policy/test_ci_checks.py | Requires CI audit to reject missing manifests. |
| tests/unit/models/test_manifest_io.py | Tests duplicate-key rejection and manifest loading. |
| tests/unit/models/test_dependency_uninstall_selection.py | Tests equivalent duplicate declarations. |
| tests/unit/models/test_dependency_materialization.py | Tests nested package-directory detection. |
| tests/unit/integration/test_cleanup_skill_dirs.py | Tests ownership release with preserved user content. |
| tests/unit/integration/test_cleanup_helper.py | Covers case-only stale-path cleanup. |
| tests/unit/integration/test_check_collision.py | Covers managed case-only aliases. |
| tests/unit/install/test_partial_subtree_reconciliation.py | Exercises legacy parent casing through YAML loading. |
| tests/unit/install/test_package_resolution_persistence.py | Tests cross-section dependency moves and updates. |
| tests/unit/install/test_obstructed_path_diagnostics.py | Tests actionable obstruction diagnostics. |
| tests/unit/install/test_mcp_self_defined_declared_keys.py | Updates native-key comparison expectations. |
| tests/unit/install/test_mcp_ownership.py | Checks adapter comparison coverage. |
| tests/unit/deps/test_stamp_plugin_version.py | Updates the manifest-loader patch point. |
| tests/unit/deps/test_lockfile_parent_identity.py | Tests canonical parent identities. |
| tests/unit/core/test_script_executors.py | Checks interrupted script-group termination. |
| tests/unit/copilot_plugins/test_pr2705_folds.py | Uses real dependency references in approval fixtures. |
| tests/unit/commands/test_uninstall_atomic_selection.py | Tests removal of duplicate Windows declarations. |
| tests/unit/commands/test_export_patch.py | Tests case-insensitive patch-name uniqueness. |
| tests/spec_conformance/test_codex_compatibility_admission_reqs.py | Aligns approval fixtures with default-host identity. |
| tests/integration/test_user_scope_file_provenance_lifecycle.py | Exercises global provenance across target roots. |
| tests/integration/test_removed_dependency_user_skill_file_lifecycle.py | Verifies removal preserves user skill files. |
| tests/integration/test_nested_package_declaration_lifecycle.py | Exercises nested declaration rejection and recovery. |
| tests/integration/test_manifest_duplicate_key_lifecycle.py | Checks duplicate manifests fail without writes. |
| tests/integration/test_local_bundle_manifest_targets_lifecycle.py | Tests bundle target precedence and replay. |
| tests/integration/test_lifecycle_script_interrupt_lifecycle.py | Exercises script termination on interrupts. |
| tests/integration/test_install_conflicted_lockfile_e2e.py | Checks inventory commands report conflicted lockfiles. |
| tests/integration/test_executables_gate_integration.py | Tests canonical executable-approval keys. |
| tests/integration/test_duplicate_declaration_lifecycle.py | Exercises dependency moves and complete removal. |
| tests/integration/test_cursor_rules_lifecycle.py | Requires user collisions to survive lifecycle operations. |
| tests/integration/test_case_only_rename_lifecycle.py | Exercises case-only primitive renames. |
| tests/integration/test_case_insensitive_parent_identity_lifecycle.py | Verifies mixed-case dependency graph edges. |
| tests/integration/test_audit_user_collision_classification_lifecycle.py | Distinguishes unmanaged conflicts from managed edits. |
| tests/integration/test_audit_ci_project_root_lifecycle.py | Checks audit failure outside the project root. |
| tests/integration/test_architecture_owner_rule_mutations.py | Adds mutations for new ownership guards. |
| tests/integration/test_architecture_mcp_native_comparison.py | Tests native-comparison guard enforcement. |
| tests/integration/test_architecture_install_compound_mutations.py | Guards shared declaration reconciliation. |
| tests/integration/test_architecture_drift_unmanaged_classification.py | Guards unmanaged drift classification. |
| tests/integration/test_architecture_dependency_reference.py | Guards nested materialization detection. |
| tests/integration/test_architecture_confirmed_bypass_mutations.py | Guards bundle manifest-target routing. |
| src/apm_cli/utils/yaml_io.py | Adds string-input round-trip YAML loading. |
| src/apm_cli/utils/paths.py | Adds filesystem-confirmed spelling aliases. |
| src/apm_cli/utils/file_ops.py | Centralizes path-obstruction messages. |
| src/apm_cli/security/executables.py | Aligns approval keys and preserves manifest formatting. |
| src/apm_cli/policy/ci_checks.py | Rejects empty CI audits without manifests. |
| src/apm_cli/models/manifest_io.py | Centralizes duplicate-key-aware manifest reads. |
| src/apm_cli/models/dependency/selection.py | Matches all declarations of one dependency. |
| src/apm_cli/models/dependency/materialization.py | Detects nested materialization paths. |
| src/apm_cli/models/apm_package.py | Routes package loading through the manifest reader. |
| src/apm_cli/integration/targets.py | Detects obstructed roots and documents collision policy. |
| src/apm_cli/integration/mcp_integrator_install.py | Extends native connection comparison across adapters. |
| src/apm_cli/integration/base_integrator.py | Recognizes managed aliases and names obstructed files. |
| src/apm_cli/install/template.py | Uses shared obstruction diagnostics. |
| src/apm_cli/install/phases/resolve.py | Scopes targeted install rechecks. |
| src/apm_cli/install/phases/cleanup.py | Supplies live paths for rename-aware cleanup. |
| src/apm_cli/install/package_resolution.py | Adds cross-section declaration reconciliation. |
| src/apm_cli/install/mcp/writer.py | Preserves manifest formatting during MCP edits. |
| src/apm_cli/install/mcp/ownership.py | Centralizes comparison eligibility and native fingerprints. |
| src/apm_cli/install/manifest_reconcile.py | Passes live deployments into stale cleanup. |
| src/apm_cli/install/local_bundle_handler.py | Honors manifest targets for local bundles. |
| src/apm_cli/install/exec_gate.py | Aligns approval identity and blocked-type tracking. |
| src/apm_cli/install/drift.py | Classifies unclaimed files as unmanaged conflicts. |
| src/apm_cli/install/drift_render.py | Updates unmanaged-conflict recovery guidance. |
| src/apm_cli/drift.py | Restricts local rechecks to selected dependencies. |
| src/apm_cli/deps/file_provenance.py | Adds scope-aware matching and Unicode retries. |
| src/apm_cli/deps/apm_resolver.py | Rejects nested root declarations before fetching. |
| src/apm_cli/core/target_detection.py | Exposes optional target auto-detection. |
| src/apm_cli/core/script_executors.py | Terminates script groups during interruption. |
| src/apm_cli/core/safe_installer.py | Records fingerprints after successful MCP writes. |
| src/apm_cli/core/deployment_ledger.py | Adds compatibility-aware scope matching. |
| src/apm_cli/compilation/agents_compiler.py | Deduplicates merged compilation errors. |
| src/apm_cli/commands/uninstall/cli.py | Removes every matching manifest declaration. |
| src/apm_cli/commands/prune.py | Reports lockfile format errors directly. |
| src/apm_cli/commands/install.py | Uses shared manifest and cross-section helpers. |
| src/apm_cli/commands/export_patch.py | Disambiguates case-insensitive patch filenames. |
| src/apm_cli/commands/deps/cli.py | Propagates duplicate-manifest and lockfile-conflict errors. |
| src/apm_cli/commands/config.py | Centralizes valid keys and unknown-key messages. |
| src/apm_cli/commands/approve.py | Uses effective trust when listing pending approvals. |
| src/apm_cli/commands/_helpers.py | Routes configuration reads through manifest validation. |
| src/apm_cli/cli.py | Routes SIGTERM through interrupt handling. |
| src/apm_cli/bundle/local_bundle.py | Retains normalized lockfile versions. |
| src/apm_cli/adopt/manifest_edit.py | Uses validated round-trip manifest reads. |
| src/apm_cli/adapters/client/vscode.py | Uses safe JSON writes and full-reference keys. |
| src/apm_cli/adapters/client/opencode.py | Forwards environment inputs during native rendering. |
| src/apm_cli/adapters/client/kiro.py | Uses shared JSON safety helpers. |
| src/apm_cli/adapters/client/intellij.py | Explicitly opts out of native comparison. |
| src/apm_cli/adapters/client/hermes.py | Explicitly opts out of native comparison. |
| src/apm_cli/adapters/client/gemini.py | Uses shared JSON writes and propagates failures. |
| src/apm_cli/adapters/client/copilot.py | Refuses unsafe JSON rewrites. |
| src/apm_cli/adapters/client/claude.py | Preserves malformed configs and uses atomic project writes. |
| scripts/architecture_linter/diagnostics.py | Maps the manifest rewrite guard to its contract. |
| scripts/architecture_linter/checks/registry_owner_guards.py | Guards target routing and signal ownership. |
| scripts/architecture_linter/checks/mutation_mcp_target_and_scope.py | Guards centralized MCP JSON writes. |
| scripts/architecture_linter/checks/install_uninstall_and_resolution.py | Guards shared declaration matching. |
| scripts/architecture_linter/checks/install_lsp_plugin.py | Guards approval identity and manifest I/O delegation. |
| scripts/architecture_linter/checks/install_deployment_analyzers.py | Registers cleanup and manifest rewrite rules. |
| scripts/architecture_linter/checks/contracts_test_taxonomy.py | Guards nested materialization ownership. |
| packages/apm-guide/.apm/skills/apm-usage/troubleshooting.md | Adds duplicate-manifest-key recovery guidance. |
| packages/apm-guide/.apm/skills/apm-usage/dependencies.md | Documents nested declaration restrictions. |
| docs/src/content/docs/troubleshooting/install-failures.md | Documents interruption and rollback behavior. |
| docs/src/content/docs/troubleshooting/common-errors.md | Clarifies unmanaged-conflict recovery. |
| docs/src/content/docs/reference/manifest-schema.md | Documents top-level key uniqueness. |
| docs/src/content/docs/reference/lockfile-spec.md | Documents expanded MCP fingerprint coverage. |
| docs/src/content/docs/reference/cli/view.md | Documents filesystem-confirmed Unicode matching. |
| docs/src/content/docs/reference/cli/uninstall.md | Documents removal of duplicate declarations. |
| docs/src/content/docs/reference/cli/audit.md | Explains conflict classification and root requirements. |
| docs/src/content/docs/reference/baseline-checks.md | Documents the missing-manifest check. |
| docs/src/content/docs/enterprise/lifecycle-scripts.md | Documents script termination on interruption. |
| docs/src/content/docs/enterprise/drift-detection.md | Clarifies unmanaged drift and remediation. |
| docs/src/content/docs/consumer/manage-dependencies.md | Documents nested package restrictions. |
| docs/src/content/docs/consumer/install-mcp-servers.md | Explains native conflicts and safe JSON handling. |
| docs/src/content/docs/consumer/deploy-a-bundle.md | Documents bundle target precedence. |
| .apm/architecture/owners/install-deployment.json | Records expanded deployment and manifest ownership. |
| .apm/architecture/owners/hooks-integrations.json | Registers shared MCP JSON safety ownership. |
| .apm/architecture/owners/core-runtime.json | Registers process-interrupt ownership. |
Review effort: Balanced
Folds Copilot review 4558274750 on #3709. reject_duplicate_manifest_keys compared line numbers, so two `dependencies:` entries in one flow-style mapping (same line) reached the last-wins loader and install could remove the first entry's deployments. Duplicates are now detected by key identity; a same-line duplicate reports "twice on line N" and asks to merge both entries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ted (#3649) Lifecycle command scripts run in their own session so a timeout can killpg the tree, but Ctrl+C reaches only the foreground group. An interrupted apm compile/install exited and released its lifecycle lock while the pre-compile/pre-install script kept running and writing into .apm/. _execute_command now reaps the group on any BaseException before propagating it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…er (#3649) Copilot (.github/mcp.json and the Copilot CLI user config), VS Code (.vscode/mcp.json), Gemini and Kiro read their config with a parser that returned {} on any JSON error and then rewrote the file, so a user mcp.json with a JSONC comment or a trailing comma lost every user server on apm install, with exit 0 and no warning. They now parse through the base MCPClientAdapter owner (_parse_json_config_for_update, split out of _read_json_config_for_update) and write through _write_json_config, so an unparsable file is kept byte-identical and the server is reported failed, as Cursor and OpenCode already do. Claude's project .mcp.json now uses the same shared atomic, symlink-safe writer; its recorded tolerate-and-rewrite parse policy is unchanged. _write_json_config gains shared=True for committed project config files so they keep their umask mode instead of 0600. Static boundary: the MCPClientAdapter owner record gains the hooks-integrations-mcp-json-config-write guard (mutation_writes.mcp_json_config_write) with a mutation case: adapters other than base.py may not serialize JSON straight into a config file. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…scenarios (#3649) Installed-CLI scenarios that inject one fault mid-pipeline (read-only module store, target root replaced by a file, deployed path replaced by a directory or a symlink, unwritable nested compile output, Ctrl+C during a fresh install) and assert a failing exit, unchanged apm.lock.yaml and user bytes, no staging leftovers, and convergence with apm audit --ci. Fix guards cover MCP config merges that keep unparsable user configs and interrupted pre-compile scripts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…erwriting (#3649) Rule-dir formats (.claude/rules, .cursor/rules, .windsurf/rules, .kiro/steering) treated any existing file at the derived path as APM-owned and silently rewrote it, then recorded it so uninstall deleted it. Route them through the shared BaseIntegrator _check_adopt_or_skip decision like every other primitive: adopt when the rendered output already matches, rewrite managed paths, and skip unmanaged user-authored files unless --force (docs: enterprise/security Collision detection). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…lockfile (#3649) Without apm.lock.yaml, uninstall fell back to broad legacy globs and deleted every .cursor/rules/*.mdc and .github/instructions/*.instructions.md, including user-authored files. Uninstall only removes lockfile-tracked paths (docs: reference/cli/uninstall), so drop the instruction legacy glob like the Claude, Windsurf, Kiro and Copilot user-scope precedents. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…3649) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…-file (#3649) apm install -g persists deployment rows whose scope DeploymentLedgerCodec infers from the path, so only ~/.copilot/ rows say 'user'. view -g --file skipped every other row and reported 'No recorded provenance' (exit 1) for ~/.claude, ~/.cursor, ~/.agents and other user-scope files. Add DeploymentLedgerCodec.locator_in_scope: a path-inferred scope is not scope evidence; only a recorded scope that differs from the inference excludes a row. Route file provenance through it and extend the install-deployment-provenance-state guard to reject raw locator.scope comparisons outside the codec. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…esystems (#3649) When a package renamed a primitive only by letter case (Guide.md -> guide.md), apm update / install on macOS or Windows treated the existing APM-owned entry as a user collision (agents, prompts, instructions were skipped), then stale cleanup deleted the old spelling -- the same entry the run had just written -- so the package's new files vanished and left the lockfile, while rules were kept as 'user-edited'. Add apm_cli.utils.paths.physical_alias, the single owner for 'another spelling of the same directory entry' (case/NFC only, confirmed with os.path.samefile). BaseIntegrator.check_collision treats such an alias of a managed path as managed, and remove_stale_deployed_files renames the aliased entry to the live spelling instead of deleting it. Extend the install-deployment-base-integrator guard to keep both routes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…3649) patch_filenames disambiguated sanitizer collisions by exact name, so two packages whose patch names differ only by case (skills/PDF vs skills/pdf) kept distinct names that macOS and Windows fold into one file; the second write silently replaced the first patch. Group by casefolded name. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… paths (#3649) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ory patch roots (#3649) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
With the executable gate on, `apm approve owner/repo` recorded the grant under the lockfile identity (`owner/repo#<version>`), but the install gate looked a package up by `str(dependency_ref)`, which is host-qualified (`github.com/owner/repo#ref`): the gate called a non-existent `canonical_string()` and fell back to it. Every dependency on the default host therefore stayed parked after approval while `apm policy explain` said "allowed". Non-default hosts and local paths were unaffected. - security/executables.py owns `dependency_approval_key()`: the lockfile identity domain `apm approve` writes, bound to the selected source so a replacement still never inherits upstream approval. - install/exec_gate.py routes `resolve_package_key` through it, and only parks a package when one of its DECLARED exec types stays unapproved (an approved hooks-only package no longer prints "parked pending approval"). - `apm approve --pending` resolves through the same deny-wins ladder as install (project, user, org layers) instead of an exact-key lookup in one store, so a `--user` grant no longer shows as pending. - Architecture guard install-deployment-executable-trust-context now requires the gate and `--pending` to route through the owner. apm-spec-waiver: executable trust key routing fix, no OpenAPM contract change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…3649) #2000/#2012 made `apm install PKG` / `apm uninstall PKG` rewrite apm.yml through the ruamel round-trip pair so comments and layout survive. Two sibling writers of the same consumer manifest still used the lossy `load_yaml` / `dump_yaml` pair: `apm approve` / `apm deny` (security/executables.write_project_executables) and `apm install --mcp` (install/mcp/writer.add_mcp_to_apm_yml). Each run stripped every comment, expanded anchors/aliases and reflowed flow-style lists. Route both through `load_yaml_roundtrip` / `dump_yaml_roundtrip`, the existing comment-preserving owner. The executable-trust architecture guard now requires the round-trip read in write_project_executables. apm-spec-waiver: manifest write formatting only, no OpenAPM contract change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…cle lock (#3649) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Folds the python-architect review of the approve/deny and install --mcp round-trip fix: the MCP writer had no static guard. Register owner `consumer-manifest-rewrite` (utils/yaml_io round-trip pair) with guard install-deployment-consumer-manifest-rewrite, requiring install, uninstall, approve/deny and install --mcp to rewrite apm.yml through load_yaml_roundtrip / dump_yaml_roundtrip, plus its mutation case. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ocal packages (#3649) Since #3571 the shared ref-recheck gate re-staged every local dependency, so apm install PKG, apm install --update PKG and apm update PKG re-read the current apm.yml of unselected local packages too. An unrelated sibling with invalid YAML or an unpublished dependency failed the targeted command, and a valid edit fetched the sibling's new dependencies into apm_modules without locking them. Pass the selected-key set for every targeted run and let the gate recheck a local package only inside that selection; full installs still re-read every local package. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…3649) A parent declared as Owner/Repo on a case-insensitive host was written as resolved_by: Owner/Repo while its lock entry is owner/repo, so deps tree could not place the transitive, deps why lost the chain and changing the declared casing churned the lockfile. lockfile_parent_identity now returns the canonical repository identity for legacy locks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… fail closed (#3649) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
macOS tools such as Finder drag and drop pass NFD paths for NFC-named
files. view --file compared the query exactly, so an absolute NFD path
exited 2 ('outside the project deploy root') and a relative one exited 1
('origin is unknown') for a recorded file.
When the exact query matches nothing, retry once with its NFC spelling,
but only when utils.paths.physical_alias confirms through the filesystem
that both spellings name the same file; case variants and
normalization-sensitive filesystems keep exact-path semantics. The
install-deployment-base-integrator guard now also requires this route.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…#3688) APM resolves the project from the working directory and does not search parent directories. From a project subdirectory or a wrong checkout path, apm audit --ci reported 'All checks passed' and exited 0 although it audited nothing, a false green for a CI gate. In --ci mode, run_baseline_checks now always emits a failing manifest-missing check when apm.yml is absent, naming the fix (run from the project root that contains apm.yml). Bare audit keeps the advisory warning only when APM artifacts suggest a deleted manifest. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…rs (#3677) #3677 released a skill directory kept only for user content in every cleanup pass, so narrowing a still-declared dependency's targets dropped its directory claim from the lockfile. Release now applies only to orphan cleanup (failed_path_retained=False, the owner is leaving the lockfile); intra-package stale cleanup retains the claim as before, so a later install still removes the directory once the user's file is gone. The static guard and mutation case follow the scoped condition. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
VS Code update_config writes through MCPClientAdapter._write_json_config (atomic temp file + os.replace), so patching builtins.open no longer injects a write error; the write-error tests now fail the owner's atomic_write_text and still assert False plus the logged/printed error. The Claude corrupted-.mcp.json test now asserts the approved fail-closed contract: the file is kept as-is and update_config returns False. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
#3681) Native comparison used Python equality, where True == 1, so an OpenCode enabled: true entry matched a declaration that changed it to enabled: 1 and the managed entry was never rewritten. MCPClientAdapter.json_identical compares sorted JSON text; the base matches_managed_server_config and the registry-request comparison in compare_native_mcp_connection use it. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…er its guards (#3682) Moves replay claim membership (claimed_prefixes and the unclaimed predicate behind the #3682 unmanaged-conflict classification) from install/drift.py into install/drift_claims.py (ReplayClaims), bringing drift.py back under its LOC budget without raising it. Registers the #3681/#3682 static checks as canonical owner guards instead of guard-less registry_delegation rules: install-deployment-mcp-native-comparison on the MCP ownership owner and install-deployment-drift-claim-classification on the new drift-claim-membership owner, each with a MutationCase and an entry in the frozen rule inventory. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…3681) Native comparison rewrote an unchanged, APM-written entry on VS Code, Copilot, Cursor, Gemini, Kiro and OpenCode whenever its render changed only through the install environment (GitHub auto-auth credential source precedence, resolved env values), churning native files the previous name-only behavior kept stable. compare_native_mcp_connection now takes declaration_changed and returns MATCHING_MANAGED for an unchanged declaration unless the adapter opts into refreshes_environment_renders (Claude and Codex, which already reconcile such renders). Registry declaration drift is now detected for every compared server, so a real declaration change (e.g. OpenCode enabled true -> 1) still rewrites. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…3681) Tests that encoded the pre-#3681 name-only behavior now expect a differing same-name user connection on Cursor/OpenCode to be preserved and reported (exit 1); scenarios meant to exercise unowned names use an identical foreign entry instead. Name-only 'already configured' characterisations patch native_comparison_clients to the opt-out set. The deps-model drift test tracks its path so it stays a managed edit (#3682). Frozen rule inventory kept in sorted order. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…hes (#3681) A managed self-defined connection that already matches is not rewritten, so a lockfile rebuilt without its deployment rows lost the native fingerprint on the next install and the repaired lock differed from the original. retain_native_receipt records the existing entry's fingerprint when none is held. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nal fields (#3681) VS Code's write path keeps optional registry fields the existing entry already carries, but native comparison rendered without them, so an entry identical to what APM would write compared as a conflict. render_server_config now passes the existing entry like configure_mcp_server does. The reinstall test now expects that identical, unowned entry to be left alone (no rewrite, no conflict). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ack scenario (#3699) The branch case declared fixture-private/private-package together with its own subdirectory package, which install now rejects. Declare two sibling subdirectory packages of the same private repository instead: the scenario still proves the scoped credential fallback, locale normalization and the subdirectory (partial clone) path; the semver case keeps the whole-repository clone. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Folds Copilot review 4558274750 on #3709. reject_duplicate_manifest_keys compared line numbers, so two `dependencies:` entries in one flow-style mapping (same line) reached the last-wins loader and install could remove the first entry's deployments. Duplicates are now detected by key identity; a same-line duplicate reports "twice on line N" and asks to merge both entries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
physical_alias rescanned and NFC/casefold-normalized the whole candidate inventory on every lookup, so stale cleanup cost O(stale x live) and every existing unmanaged collision destination cost O(managed), even when no alias existed. The utils.paths spelling owner now offers SpellingAliasIndex (built once per inventory; lookups hash the queried spelling and samefile only its bucket) and stored_alias (looks up the filesystem's stored spelling of an existing entry, plus its NFC/NFD forms for HFS+, in the inventory: a few set lookups). Stale cleanup builds one index per call; check_collision uses stored_alias. physical_alias stays as the one-shot wrapper. The install-deployment-base-integrator guard and owner record follow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ath (#3687) The NFD retry normalized the whole absolute path, including the deploy root. When the project (or target) root itself is stored decomposed, the NFC path no longer matched _roots(deploy_root), so an NFD query for an NFC-recorded member still had no provenance. Compare query and each deploy/target root in NFC, then rebuild the candidate as <root as spelled>/<NFC member>; physical_alias still confirms the filesystem names one file. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… it across sections (#3693) Cross-section reconciliation ran after validation against only the destination section, so a bare apm install X dropped the ref of X's devDependencies declaration, and apm install --dev X moved a bare copy that lost the production entry's ref, skills restriction or registry source. Expose the existing declaration to validation first (borrow), so its explicit-change rules decide what the CLI changes, then return a kept declaration to its position (settle). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1bd46af to
f9eccea
Compare
…equires Since #3672 stale cleanup deletes only files whose recorded hash still matches, so the alias-index and released-directory tests now pass the recorded hash of each APM-deployed member. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix(tests): restore release-gate lanes for 0.36.0 Main's tag-gate lanes (build-release push + manual-build-release) were red on runs 43381609442, 43381682871 and 43394173235. PR CI never runs them. Product regressions (Windows/real installs), fixed: - Hook cleanup removed nothing on Windows: remove_stale_deployed_files looked up recorded hashes with POSIX keys while callers passed native backslash keys, so content proof failed closed (#3672, Refs #3649). - describe_path_obstruction returned None on Windows, which reports a directory-for-file as EACCES and a file-for-parent as ENOENT instead of EISDIR/ENOTDIR (#3709, Refs #3678). - Skill preflight refused claimed members of an unclaimed, populated skill directory that materialization leaves alone, failing a local bundle install (Refs #3625). Stale tests (behaviour changed intentionally), updated: - policy chain mocks now return real PolicyFetchResult (#2933, Refs #2753) - bare-cache/downloader/anonymous-https fixtures use real Git checkouts (#3603, Refs #3457) - mcp install help, registry error wording, deps why -g help (#3633 Refs #3588, #2803 Refs #2478, #3614 Refs #2884) - downloader stub carries carried_licenses (#3646, Refs #3556) - frozen-hash lifecycle uses a generic git host so -g URL validation uses git ls-remote instead of a live api.github.com 404 (#3672) New Windows-shaped regression tests are marked windows_compat. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * chore: spec waiver for release-gate repair apm-spec-waiver: restores pre-existing behaviour on Windows and in skill preflight; no OpenAPM-observable change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: danielmeppiel <danielmeppiel@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* fix(tests): restore arm64 integration lanes for 0.36.0 Gate run 44090072790 (main e9860ee) failed 27 Linux arm64 integration tests (19 also on macOS arm64), introduced by PRs that landed after the previous gate. PR CI never runs this corpus. Product regression, fixed: - On case-sensitive file systems a stale apm_modules/Test/C beside apm_modules/test/e made every repeat install fail ("Found multiple package directories"), and switching the declared casing failed with a false casing collision. Materialization now treats only two complete paths for one package as a collision and relocates into an existing case-variant owner directory (Refs #3698). Stale tests, updated to intentional behaviour changes: - #3672 (Refs #3649): stale-file removal needs a recorded hash (#3663); runtime-scoped MCP cleanup without marker dir (#3664); audit replays the install image (#3667); --frozen fails closed on edited skills (#3654); unverifiable marketplace ref is an error (#3670); architecture owner/semantic mutation matrix and audit.py re-anchor (#3659). - #3716 (Refs #3649): unpack writes only under managed integration dirs; registry token via headers_for(); raw-file fetch passes allow_netrc. - #3709: case-only user-file collisions branch on the actual file system (#3679, #3684); conflicted-lockfile path survives rich 80-col wrapping (#3695); a package and its own subdirectory package cannot both be declared (#3699). apm-spec-waiver: restores pre-existing install behaviour on case-sensitive file systems; no OpenAPM-observable change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * fix(install): prune emptied source ancestors after cross-parent relocation Moving Test/C/packages/a beside test/c/packages/b on a case-sensitive file system left an empty Test/C tree that a later root dependency test/c counted as a second package directory. relocate_path now removes emptied source ancestors below apm_modules; rollback already recreates them via source.parent.mkdir(parents=True). apm-spec-waiver: restores pre-existing install behaviour on case-sensitive file systems; no OpenAPM-observable change Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: danielmeppiel <danielmeppiel@users.noreply.github.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>


Description
Round 2 of the 0.36.0 pre-release lifecycle sweep. Six new red-team charters drove the real
apmbinary over hermetic local fixtures, building on the patterns that found bugs in round 1 (#3672):audit --cireplay across package shapes and targets,apm.ymlcorner cases, concurrency).Every confirmed bug was filed in 0.36.0. This PR fixes all of them except the items listed under "Not in this PR", each through the canonical owner for that decision, and adds the scenarios as permanent lifecycle tests.
Fixed
#3697(regression,#3571)install/drift.should_force_ref_recheck(selection-scoped)test_targeted_install_unselected_local_edit_lifecycle.py#3674adapters/client/base.MCPClientAdapterread/write ownertest_mcp_config_merge_safety_lifecycle.py,test_user_authored_name_collision_lifecycle.py#3675core/script_executors._execute_commandtest_lifecycle_script_interrupt_lifecycle.py#3676cli.main(newprocess-interrupt-signalsowner)test_fault_injection_atomicity_lifecycle.py,test_lifecycle_script_interrupt_lifecycle.py,tests/unit/test_cli_sigterm.py#3677integration/cleanup.CleanupResult.releasedtest_removed_dependency_user_skill_file_lifecycle.py#3678utils/file_ops.obstructed_path_messagetest_fault_injection_atomicity_lifecycle.py#3679.claude/rules,.cursor/rules,.windsurf/rules,.kiro/steeringare skipped, not overwrittenBaseIntegrator._check_adopt_or_skiptest_user_authored_name_collision_lifecycle.py#3680InstructionIntegrator.sync_for_targettest_user_authored_name_collision_lifecycle.py#3681install/mcp/ownership.native_comparison_clients+ existing#3239conflict pathtest_json_mcp_native_conflict_lifecycle.py#3682unmanaged-conflict, no export-patch hintinstall/drift.diff_scratch_against_projecttest_audit_user_collision_classification_lifecycle.py#3683,#3687view -g --fileresolves every user-scope target; NFD paths matchDeploymentLedgerCodec.locator_in_scope,deps/file_provenance+utils/paths.physical_aliastest_user_scope_file_provenance_lifecycle.py+ unit#3684apm updateon case-insensitive FSutils/paths.physical_aliasincheck_collisionand stale cleanuptest_case_only_rename_lifecycle.py#3685commands/export_patch.patch_filenames#3688audit --cifails withoutapm.ymlin cwdpolicy/ci_checks.run_baseline_checkstest_audit_ci_project_root_lifecycle.py#3689apm approveworks for github.com dependenciessecurity/executables.dependency_approval_keytest_executable_approval_default_host_lifecycle.py#3690install --mcpkeep comments and anchorsmodels/manifest_iotest_manifest_rewrite_preservation_lifecycle.py#3691apm.ymlkeys rejected before any writemodels/manifest_io(new read owner)test_manifest_duplicate_key_lifecycle.py#3692,#3694,#3695lockfile_version; config unknown-key message; conflicted lockfile named by deps list/tree/prune_CONFIG_KEYSregistry,LockfileConflictErrortest_install_conflicted_lockfile_e2e.py#3693install --dev Xmoves Xmodels/dependency/selection.manifest_declarations_oftest_duplicate_declaration_lifecycle.py#3698deps/lockfile.lockfile_parent_identity+ read-time canonicalizationtest_case_insensitive_parent_identity_lifecycle.py#3699models/dependency/materialization.nested_materialization_pairstest_nested_package_declaration_lifecycle.py#3704apm install ./bundlehonoursapm.ymltargetsresolve_manifest_target_decisiontest_local_bundle_manifest_targets_lifecycle.pyFail-before / pass-after: the 17 fix-guard modules above fail on
main'ssrc/(48 failed, 13 controls passed) and pass with this PR (61 passed).Permanent lifecycle coverage added
21 new
tests/integration/*_lifecycle.pymodules (72 tests) plus kits_fault_injection_kit.py,_path_corner_world_kit.py,_install_audit_replay_kit.py, and byte-identical copies of round-1's_dependency_graph_world.pyand_target_compile_kit.py(merge cleanly with#3672). Passing-coverage modules protect 0.36 behavior: fault-injection atomicity (read-onlyapm_modules, target root as a file, obstructed deployed paths, compile batch atomicity, interrupted fresh install), dependency spellings sharing one lock entry and conflicting diamonds failing closed, spaced/Unicode project, HOME and package paths across five targets, concurrent manifest mutation. Four small fix guards carrylifecycle_smoke.Architecture
Every fix extends an existing owner from
.apm/architecture/owners/or adds one with a static guard and a MutationCase (process-interrupt-signals,consumer-manifest-rewrite, MCP JSON config write, MCP native comparison, drift unmanaged classification, cleanup ownership release, uninstall declarations). Each fix had a python-architect review (all APPROVE / APPROVE-WITH-NITS, nits folded); a final combined-diff review returned APPROVE-WITH-NITS and both nits are folded (write_allow_executablesnow uses the round-trip manifest owner). No covered file exceeds 2100 lines, also on the tree merged with#3672.Not in this PR
#3686deferred to 0.37.0 (maintainer decision).#3705,#3706(bundle install for compile-only targets / Codex agents): awaiting a product decision.#3696(same owner/repo from two hosts): design item.#3525.Issue and approved scope
Issue: Refs
#3649Human scope-approval comment: #3649 (comment) (sweep scope). Behavior decisions for
#3676,#3677,#3681,#3682,#3688,#3691,#3693,#3699were approved by the maintainer and recorded on each issue.Fixes #3674
Fixes #3675
Fixes #3676
Fixes #3677
Fixes #3678
Fixes #3679
Fixes #3680
Fixes #3681
Fixes #3682
Fixes #3683
Fixes #3684
Fixes #3687
Fixes #3688
Fixes #3689
Fixes #3690
Fixes #3691
Fixes #3692
Fixes #3693
Fixes #3694
Fixes #3695
Fixes #3697
Fixes #3698
Fixes #3699
Fixes #3704
This PR does not complete the tracking issue (round 1 is
#3672). The#3685fix is included here too; close#3685by hand on merge (the PR eligibility evidence caps closing references at 25).Type of change
Testing
Validation evidence (macOS,
.venv/bin/apmbuilt from this branch, one pytest process,-p no:xdist):uvx ruff@0.15.12 check/format --checkonsrc/ tests/ scripts/lint_architecture_boundaries.py scripts/architecture_linter/ scripts/windows_native_symlink_probe_entry.pypython -m pylint --disable=all --enable=R0801 --min-similarity-lines=10 --fail-on=R0801 ...bash scripts/lint-auth-signals.sh;bash scripts/lint-architecture-boundaries.shrelative_toguardsAPM_BINARY_PATH=.venv/bin/apm pytest -p no:xdist <26 new/changed integration modules>pytest -p no:xdist <MCP/drift/collision integration modules after the last fixes>pytest -p no:xdist tests/unit/{adapters,deps,integration,scripts,security,policy} + changed unit files + architecture mutationsmainsrc / on this PRSpec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regeneratedapm-spec-waiver:line in the changelog commit.)