Repository navigation
test(mcp): make removal-failure injection platform-independent - #3804
Merged
Daniel Meppiel (danielmeppiel) merged 2 commits intoNov 17, 2026
Merged
Conversation
test_unsupported_skip_keeps_the_claim_when_removal_fails made the config directory read-only (chmod 0o500) to fail the cleanup write. Windows does not enforce POSIX directory modes, so the write succeeded and the test failed on Windows x86_64 (build-release run 44160956996 on 932e45f). Patch the exact write the cleanup owner performs (apm_cli.integration.mcp_integrator.atomic_write_text) to raise OSError, and assert it was called. The assertions are unchanged: the removal raises RequiredIntegrationError and the ownership claim is kept. Refs #3736 Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 17, 2026 20:28
…gate The PR-time Windows gate selects -m windows_compat; mark this test so the platform-independent injection is exercised on Windows before merge. Refs #3736 Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression test lacks the windows_compat marker, so the existing pre-merge Windows gate will not exercise the failure-injection repair.
1 open issue
What changed in this PR
This test-only follow-up to #3789 makes MCP cleanup-failure injection platform-independent, addressing the Windows release-test failure without changing product code.
Changes:
- Replaces POSIX directory-permission manipulation with a mocked
atomic_write_textfailure. - Verifies the write was attempted while preserving assertions that cleanup raises and retains the ownership claim and config entry.
| File | Description |
|---|---|
tests/unit/install/test_mcp_retired_shape_heal.py |
Uses deterministic write-failure injection instead of platform-dependent permissions. |
Review effort: Balanced
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-t3-p1-removal-injection
branch
November 17, 2026 20:46
Merged
3 of 8 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
Main is red on Windows: build-release run 44160956996 on 932e45f (#3789) failed on Windows x86_64 unit tests with
tests/unit/install/test_mcp_retired_shape_heal.py::test_unsupported_skip_keeps_the_claim_when_removal_fails-- "Failed: DID NOT RAISE RequiredIntegrationError".Cause: the test injected the cleanup write failure by making the config directory read-only (
chmod 0o500). Windows does not enforce POSIX directory modes, so the rewrite succeeded there.Fix: patch the exact write the cleanup owner performs,
apm_cli.integration.mcp_integrator.atomic_write_text(called by_clean_json_mcp_config, which_remove_native_entryuses for Antigravity's JSON config), to raiseOSError, and assert the patched call happened. The assertions are unchanged: removal raisesRequiredIntegrationErrorand the ownership claim is kept. Test-only change; no product code touched. This was the only chmod-based failure injection #3789 added (git show 932e45ffbf -- tests src | grep chmod).Issue and approved scope
Issue: Refs #3736
Human scope-approval comment: #3736 (comment)
Does this PR complete the issue, or what remains? #3736 was completed by #3789; this repairs one of its tests on Windows.
Type of change
Testing
pytest -p no:xdist tests/unit/install/test_mcp_retired_shape_heal.pyclaims.discard(name)before the removal in_skip_unsupported_remote_transport{'antigravity': set()}!= claim kept); restoreduvx [email protected] check/format --check(src/ tests/ scripts/...)bash scripts/lint-auth-signals.sh,bash scripts/lint-architecture-boundaries.shWindows coverage: the test is now marked
windows_compat, so the PR-time Windows Compatibility Gate (-m windows_compat tests/unit tests/integrationon windows-latest) runs it before merge; without the marker no PR lane runs this file on Windows (build-release runs only on main, tags and schedule).Platform independence: the failure is injected at the Python call site (
unittest.mock.patchon the module attribute the owner calls), so it does not depend on filesystem permission semantics;write.assert_called_once()fails if the code path stops reaching that write.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.