Repository navigation
fix(install): a refused install --mcp leaves apm.yml and .github untouched (#4759) - #4803
Merged
Daniel Meppiel (danielmeppiel) merged 10 commits intoNov 22, 2026
Conversation
…#4759) apm install --mcp NAME -- COMMAND detected a collision with the user's own .mcp.json entry only in the MCP write path, after apm.yml had been modified. Run the #4745 native collision projection (refuse_unrecorded_mcp_collisions) on the self-defined entry before the manifest write, so a refused install leaves every durable file byte-identical (I7). The conflict message and exit code are unchanged. Flip the strict cell pair|SRC=inline-mcp|DEPLOYED=unowned to required with a declared refusal, add the bug-ledger row and changelog fragment. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 22, 2026 19:40
Co-authored-by: Copilot App <[email protected]>
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The architecture guard does not protect the new early-refusal delegation or its ordering before manifest writes, and the changelog exceeds the word limit and ends with the wrong reference.
2 open issues
What changed in this PR
Extends #4745’s collision protection to direct apm install --mcp commands. Conflicts involving unrecorded self-defined servers are checked before manifest or deployment writes, addressing #4759.
Changes:
- Reuses the existing collision preflight before manifest mutation, while skipping dry runs and deferring unreadable state to later validation.
- Makes the lifecycle regression required and asserts unchanged durable state on refusal.
- Adds a bug-ledger record and changelog fragment.
| File | Description |
|---|---|
tests/quality/lifecycle_obligations.json |
Promotes the inline MCP collision scenario to required coverage. |
tests/lifecycle/scenarios/test_ownership_siblings.py |
Asserts the conflict diagnostic and unchanged manifest, connection, and deployment state. |
tests/lifecycle/scenarios/_kit.py |
Declares the expected inline MCP refusal contract. |
tests/fixtures/lifecycle_bug_ledger/bugs/4759.json |
Links the state-preservation defect to its regression test. |
src/apm_cli/install/mcp/command.py |
Runs the shared collision preflight before manifest writes. |
src/apm_cli/install/mcp/collision_preflight.py |
Updates the module docstring to describe the direct-install caller. |
changelog.d/4803.fixed.md |
Documents the user-visible refusal behavior. |
Review effort: Balanced
apm-spec-waiver: install --mcp collision refusal ordering is APM CLI behaviour; no OpenAPM v0.1 requirement governs when a refused install writes the manifest. Co-authored-by: Copilot App <[email protected]>
…t route (#4759) check_mcp_ownership_migration now pins run_mcp_install delegating to _refuse_native_mcp_collision and that helper delegating to refuse_unrecorded_mcp_collisions, with a mutation case for each edge. Co-authored-by: Copilot App <[email protected]>
…t cells (#4759) The differing-collision case now asserts the refused add leaves apm.yml and the other target untouched, then declares the entry to reach the partially installed state the repeat, --force, --frozen and prune cells exercise. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The collision lifecycle test lacks recorded ownership, so the second install is refused early and all four differing cases fail before exercising the intended repeat, force, and frozen checks.
1 open issue
Review effort: Balanced
…#4759) A declared entry hits the same unrecorded-collision refusal, so the differing case now installs to the other target alone to record its claim before the repeat, --force, --frozen and prune cells. Co-authored-by: Copilot App <[email protected]>
…cp-refusal-no-write # Conflicts: # tests/lifecycle/scenarios/test_ownership_siblings.py # tests/quality/lifecycle_obligations.json
… the --mcp preflight (#4759) #4763 renamed refuse_unrecorded_mcp_collisions; the direct --mcp preflight, its architecture guard edge and mutation case now use the new owner name. Co-authored-by: Copilot App <[email protected]>
5 of 14 tasks
…s its known cell Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-p2-4759-mcp-refusal-no-write
branch
November 22, 2026 23:01
5 of 14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
apm install --mcp NAME ...refused a name that collides with a user's own.mcp.jsonentry, but only after it had already added NAME toapm.ymland written under.github/. A refused install must leave the project byte-for-byte unchanged.run_mcp_install(src/apm_cli/install/mcp/command.py) now runs #4745's existingrefuse_unrecorded_mcp_collisionson the self-defined--mcpentry before it bootstraps the user manifest or editsapm.yml. This reuses the existing preflight rather than adding a second one. The refusal message and exit code 1 are unchanged. If the lockfile or targets can't be read, the early check doesn't refuse; the later MCP stage still runs the same comparison. Dry-run skips the early check.Issue and approved scope
Issue: Fixes #4759
Human scope-approval comment: #4759 (comment)
Does this PR complete the issue, or what remains? Yes, it completes the issue.
Type of change
Testing
Not yet run: under host park mode (rule 17) the full suite, the bug-ledger test and the MCP unit and lifecycle neighbour tests run in CI only. A local neighbour run was stopped before it finished and had shown 4 unidentified failures, so CI is the verdict for those.
tests/lifecycle/scenarios/test_ownership_siblings.py::test_a_users_mcp_entry_blocks_a_server_of_the_same_name[inline-mcp]. The cellpair|SRC=inline-mcp|DEPLOYED=unownedis now a required declared refusal; it was strict known-failing. The test asserts exit 1, the conflict message, unchangedapm.ymlbytes, no.github/,.mcp.jsonkept and an empty changed set.HEAD~1source and the binary driver, the test fails withI7 ... failed install changed the manifestandfailed install changed durable files: ['project:.github'].-k mcp_entrygives 7 passed.apm.ymlgained the entry. After the fix, rc=1 and theapm.ymland.mcp.jsonhashes are unchanged. A non-colliding--mcpentry still installs (rc=0) and is recorded in the lockfile.uvx [email protected] checkandformat --check, pylint R0801,scripts/lint-auth-signals.sh, the complexity ratchet,check_test_assertions.py,tests.quality.taxonomy --changed,lint_architecture_boundaries.pyandtests.lifecycle.generator --check.Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
CONFORMANCE.{md,json}regenerated