Repository navigation
fix(install): a user LSP entry conflict that wrote nothing leaves apm.lock.yaml unchanged (#4697) - #4705
Merged
Daniel Meppiel (danielmeppiel) merged 4 commits intoNov 22, 2026
Conversation
… lockfile (#4697) Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 21, 2026 22:14
Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The conflict refusal can leave MCP writes deployed but unrecorded during service-only installs and prevent stale LSP entries and ownership claims from being cleaned up during uninstall.
2 open issues
What changed in this PR
This PR addresses #4697 by routing LSP user-entry conflicts through the install transaction’s commit-refusal mechanism when no other LSP server changed.
Changes:
- Tracks whether an LSP conflict occurred alongside server changes.
- Refuses lockfile commits for no-change conflicts while retaining partial-write handling.
- Strengthens regression coverage and records the fix in the lifecycle ledger and changelog.
| File | Description |
|---|---|
tests/unit/install/test_lsp_integration.py |
Checks commit behavior with and without server writes. |
tests/lifecycle/scenarios/test_ownership_siblings.py |
Requires unchanged lockfile bytes after normal and forced conflicts. |
tests/fixtures/lifecycle_bug_ledger/bugs/4697.json |
Records the bug and regression tests. |
src/apm_cli/integration/lsp_integrator.py |
Reports server changes on conflict errors. |
src/apm_cli/install/lsp/integration.py |
Converts no-change conflicts into commit refusals. |
src/apm_cli/install/errors.py |
Adds conflict write metadata and the refusal exception. |
changelog.d/4705.fixed.md |
Documents the lockfile-preservation fix. |
Review effort: Balanced
… needs recording (#4697) Review fold for #4705: - Uninstall and prune reconcile LSP in memory (persist=False): a user-entry conflict finishes stale cleanup and ownership updates before failing. - When the MCP stage of the same command already staged a lockfile change (an MCP connection written), the conflict commits instead of refusing, so that write stays recorded; MCP adapter writes are outside the deploy journal. Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: bug fix restoring lifecycle law I7 for a failed install on a user LSP entry conflict; OpenAPM v0.1 specifies no LSP config ownership, so no new normative surface. Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-fix-4697-lsp-conflict-lock
branch
November 22, 2026 08:43
Merged
3 of 10 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
When
apm installfails because a harness LSP config already holds a user-owned entry with the same name as a package's LSP server, the command exited 1 but still committedapm.lock.yaml. The pipeline had staged the gated package row (exec_status: gated_pending_approval -> deployed).LSPUserEntryConflictErroris not a commit refusal, so the lockfile writer scope published it, which breaks lifecycle law I7.The fix lives at the LSP install owner and follows the MCP native-conflict path (
MCPNativeConflictError.wrote_connections):LSPIntegrator.installreportswrote_serverson the conflict error (whether any other server changed a config).run_lsp_integrationre-raises a conflict that wrote no server asLSPUserEntryRefusal, before any cleanup or lock update. That class setsrefuses_commit = True, the same refusal marker the org-policy block uses. The transaction then discards the staged lockfile and restores journaled writes, and native registration does not flush. The failed install leaves the lockfile byte-identical.persist=False) finish reconciliation before failing, as before.Unchanged: the refusal message, exit code 1, the user's entry, successful installs, and MCP behavior. The local-bundle path (
run_owned_lsp_integration) is unchanged: it records the bundle's own deployed files.Composes with #4678 (E4626): this PR does not touch
tests/lifecycle/oracles.pyand does not overlap its hunks.Issue and approved scope
Issue: Fixes #4697
Human scope-approval comment: #4697 (comment)
Does this PR complete the issue, or what remains? Completes it. The strict known cell
{"I7": Known("#4282", ...)}intest_ownership_siblings.py::test_a_users_lsp_entry_is_never_taken_overis removed. The cell now asserts the lockfile is byte-identical after bothinstallandinstall --force.Type of change
Testing
Validation evidence (local, on main
488a4b1e):pytest tests/lifecycle/scenarios/test_ownership_siblings.py::test_a_users_lsp_entry_is_never_taken_over(real binary)I7 ... failed install changed the lockfilepytest tests/integration/test_lsp_user_entry_lifecycle.py(real binary, #4628 controls + MCP-write regression)pyteston 40 LSP, service-integration, uninstall and prune modules (after review fold)pyteston the 22 unit, integration and quality modules touching LSP integration, the lockfile write authority, the transaction, service integration and the ledgeruvx [email protected] check/format --check(CI paths)scripts/lint-auth-signals.sh,scripts/lint-architecture-boundaries.shscripts/check_complexity_ratchet.py --base-ref <main>python -m tests.quality.taxonomy --changedtests/spec_conformance/mode_b_detector.shBug-ledger row:
tests/fixtures/lifecycle_bug_ledger/bugs/4697.json.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)
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.