Skip to content

test: update cleanup test doubles for deployment evidence - #4250

Merged
Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
danielmeppiel-cleanup-test-doubles
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
danielmeppiel-cleanup-test-doubles

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

Since #4049 (req-lk-024), every lockfile-driven deletion needs deployment evidence. Eight integration tests on main (72ccb23e, Shard 4) still drove cleanup with stale test doubles. Each one is a stale double, not a production regression, and the production paths are unchanged:

Test Failure on main Fix (test double only)
test_skipped_integration_preserves_deployments SimpleNamespace has no apm_dir (phases/cleanup.py:57 reads the lock root) The ctx gains apm_dir. The evidence render is lazy, and nothing is dropped, so the assertions are unchanged.
test_skill_integrator_hermetic::TestSyncIntegration::test_managed_files_removes_tracked_skill_dir startswith given a MagicMock (get_integration_prefixes reads target.prefix) The fake target gains prefix=".github/" and managed_deploy_root=None. An empty recorded skill directory holds no bytes, so the deferred skill-directory pass removes it without evidence.
test_wave6_integrators_coverage::TestSyncIntegrationHooks::test_removes_tracked_hook_files 0 == 1: no evidence, so the file is kept The sync supplies receipted_evidence for the hook, modelling APM's own write.
test_wave6_integrators_coverage::TestSkillIntegratorSyncIntegration::test_removes_tracked_skill_directories 0 >= 1: SKILL.md untracked, so the directory is kept The claim lists the member, as real installs record it, and supplies receipts.
test_uninstall_hook_cleanup_failure x4 Uninstall stops at the target-cleanup preflight ("Kept ... no local deployment receipt or render") and also tries to clone github.com/owner/installed _prepare_hook_install seeds the real local deployment receipt (through DeploymentMaterializationSession) that the installing machine holds, and stubs _render_locked to None (the package is not fetchable), so the tests reach the hook-cleanup failure paths they cover.

The uninstall behavior seen in the failing output is correct under req-lk-024: with no receipt and no render, the hook is kept and uninstall stops. So these are not production regressions, and the deletion-evidence rule is unchanged.

Issue and approved scope

Issue: Refs #3701 (Part of #3701)

Human scope-approval comment: #3701 (comment). The 0.37 Stream H lead requested this fix (main regression traced by lane bcb09e24).

Does this PR complete the issue, or what remains? Nothing remains. This PR repairs test doubles only.

Type of change

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

Testing

  • Tested locally. Static only (ruff on changed files); this host has no test guard. Full integration runs in CI via the full-integration label.
  • All existing tests pass (CI)
  • Added tests for new functionality (if applicable). N/A.

Changelog

  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

#4049 (req-lk-024) requires deployment evidence for every lockfile-driven
deletion. Eight integration tests still drove cleanup with stale doubles:
- skipped-integration ctx gains apm_dir (evidence reads the lock root);
- the hermetic skill-sync fake target gains a string prefix;
- wave6 hook and skill syncs supply receipts, and the skill lockfile
  claim lists its member as real installs record it;
- the uninstall hook-cleanup fixture seeds the local deployment receipt
  the installing machine holds, with no render of the unfetchable
  locked package.

Part of #3701

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Copilot AI balanced review requested due to automatic review settings November 20, 2026 10:37
@danielmeppiel Daniel Meppiel (danielmeppiel) added the full-integration Run the full integration suite (ci-integration.yml) on this PR before merge label Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[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.

🟢 Approval recommended

No active review issues are recorded for the cleanup integration-test fixture updates.

No open issues 🎉

What changed in this PR

Updates cleanup integration-test doubles to match the deployment-evidence requirement introduced by #4049 for #3701. Production behavior and deletion safeguards remain unchanged.

Changes:

  • Supplies deployment receipts and tracked skill members so cleanup tests can exercise authorized deletion.
  • Seeds uninstall receipts and disables unavailable render fallback so tests reach their intended failure paths.
  • Adds missing context and target attributes required by cleanup validation.
File Description
tests/​integration/​test_wave6_integrators_coverage.py Adds receipt evidence for hook and skill cleanup, plus the tracked skill member.
tests/​integration/​test_uninstall_hook_cleanup_failure.py Seeds local receipts and stubs render fallback for uninstall failure tests.
tests/​integration/​test_skipped_integration_preserves_deployments.py Adds apm_dir to the fake install context.
tests/​integration/​test_skill_integrator_hermetic.py Adds prefix and managed-root attributes to the fake target.

Review effort: Balanced

Five sync tests still expected deletion on a lockfile hash alone. They now
supply local deployment receipts (hook syncs, the skill sync with its
member claim) and call the evidence-taking sync_for_target instead of the
legacy agent and prompt shims, which carry no evidence and so keep files
(req-lk-024).

Part of #3701

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… cowork oracles

More test doubles for the deletion-evidence API (req-lk-024):
- seed_receipts() records the receipt the installing machine holds, for
  fixtures that forge a lockfile and its deployed files (uninstall of
  agent-skills and grok-bot, the uninstall hook fixture);
- Gemini command and skill syncs supply receipts; skill claims list
  their members as real installs record them;
- the cross-package collision ctx gains apm_dir;
- the local-bundle cleanup oracle supplies evidence (same change as
  #4222);
- the cowork lifecycle case declares its dependency instead of a
  positional github.com package, which validation probes via REST.

Part of #3701

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…d's filter message

9e93d20 added root apm_modules to EXCLUDED_ROOTS (18 entries). The
orphan guard (#4011) now reports a lock-row filter mutation as
'Removal sites must not filter installed or locked sets'; it still
catches renamed-evidence-predicate.

Part of #3701

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

Landing under the infra-only plus known-red exemption (0.37 PM, 12:41). Full-integration run 44724951473: the only non-infra red is Integration Tests Shard 2. All its failures are tests/integration/test_gitlab_sparse_transport_mutations.py and tests/unit/deps/test_gitlab_sparse_transport_contract.py (family N), fixed on main by #4269; this run's merge ref predates that fix. The other reds are infra: CodeQL rate limit, NOTICE Drift Check, eligibility evidence.

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 2fd92f2 into main Nov 20, 2026
27 of 39 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-cleanup-test-doubles branch November 20, 2026 11:42
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-integration Run the full integration suite (ci-integration.yml) on this PR before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants