Skip to content

fix(tests): restore release-gate lanes for 0.36.0 - #3723

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-fix-release-gate-lanes
Nov 17, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
danielmeppiel-fix-release-gate-lanes

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

The 0.36.0 tag-gate lanes on main are red: build-release push run 43381682871, repository_dispatch 43381609442 and gate 43394173235. PR CI never runs these lanes (Windows full unit suite, macOS/Linux arm64 full integration suite), so the breakage reached main unseen. This PR restores every failing test. For each one I decided whether the test was stale or the product had regressed.

Product regressions (fixed in src/)

Failing test(s) Broken by Root cause Fix
test_hook_integrator.py::TestEndToEnd::test_full_hookify_lifecycle, ::test_multiple_packages_lifecycle (Windows) #3672 remove_stale_deployed_files looked up recorded hashes by POSIX path, but on Windows the hashes are keyed with backslashes. The content-hash proof never matched, so cleanup kept every hook file. Normalize hash keys and lookups to / in integration/cleanup.py
test_obstructed_path_diagnostics.py (2 tests, Windows) #3709 describe_path_obstruction only recognised POSIX EISDIR/ENOTDIR. Windows raises EACCES for a directory in place of a file and ENOENT for a file in place of a parent, so users got the raw OS error instead of "Move it aside". utils/file_ops.py: handle both Windows shapes, gated on the real on-disk obstruction so that a POSIX EACCES or ENOENT still returns None
test_local_shared_root_skill_cleanup.py::test_local_bundle_output_survives_an_authored_skill_coming_and_going skill preflight (#3638) Preflight refused claimed members of a populated, unclaimed skill directory. Materialization never writes into such a directory (for example apm install <bundle> output), so a valid install failed. integration/skill_preflight.py mirrors that skip

Stale tests (behavior changed intentionally; updated)

Test(s) Changed by Update
test_deep_coverage_deps_policy.py::...test_discover_policy_with_chain_no_git, test_uninstall_policy_pack_flow.py::...test_local_file_no_extends #2933 Bare MagicMock fetch results invented ancestry_parents/extends/cache_ref; the mocks now return real PolicyFetchResult values. A real local file with no extends and a real 2-level chain were checked against real files.
test_deps_coverage.py::TestBareCache::..., test_github_downloader_validation_flow.py (2), test_anonymous_https_git_suffix_e2e.py #3603 The product now reads links from the checkout's Git objects, so the fixtures build real repos instead of plain files or text-only subprocess mocks. Cache hits now assert that no clone happens.
test_commands_mcp_flow.py::TestMcpGroupHelp::test_mcp_install_help #3633 The forwarded flags are now real options under the forwarded section.
test_config_surface_lifecycle_contract.py (2) #2803 The specific registry errors now appear. On 0.35.1 a KeyError hid them behind a generic message. Both tests still check that no user state changed, and they reject the old generic message.
test_deps_why_promises_e2e.py::test_promise_h_... #3614 The -g help wording changed.
test_git_semver_install_e2e.py::...test_invalid_update_preserves_live_hook_and_lockfile #3646 The downloader stub carries carried_licenses.
test_frozen_deployed_hash_lifecycle.py::test_warm_frozen_with_kept_skill_edit_fails_closed[user] (macOS x86_64) #3672 Only apm install -g <github.com URL> validated against the live api.github.com, which returns 404 for the fixture repo. It passed locally only because the isolated environment cannot reach the API, which is inconclusive and allowed. The test now uses the generic host git.example.test, the same approach as #3719, so validation goes through git ls-remote with the insteadOf rewrite.

The new Windows-shaped regression tests carry windows_compat, so the PR-time Windows gate runs them, and each reproduces the Windows shape on POSIX. No CHANGELOG entry: per the release captain, these are fixes for regressions within the unreleased cycle.

Issue and approved scope

Issue: Refs #3649 (umbrella for the #3672 sweep). Also refs #3678, #3625, #2753, #3457, #3588, #2478, #2884 and #3556: the issues of the PRs that broke each test.

Human scope-approval comment: none for this PR. This is a release-blocking repair commissioned by the 0.36.0 coordinator to restore the tag-gate lanes of already-approved work. Each change stays within the scope of the breaking PR's own approved issue.

This PR completes the gate repair. What remains: dispatch manual-build-release after merge and loop until green.

Type of change

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

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

macOS arm64, APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm, -p no:xdist:

  • Every originally failing integration test, plus test_local_shared_root_skill_cleanup.py, test_git_semver_install_e2e.py and test_frozen_deployed_hash_lifecycle.py: 55 passed. On unmodified main, the 12 dispatch failures reproduced locally.
  • All 36 test files that touch the changed src modules (integration.cleanup, skill_preflight, utils.file_ops), -m "not live": 1478 passed, 3 skipped.
  • Changed unit files plus the frozen-hash module: 328 passed.
  • Frozen-hash root cause confirmed with --verbose: the github.com URL goes through the GitHub API pre-flight, while git.example.test goes through git ls-remote (file) rc=0.
  • Lint contract: ruff check and ruff format --check (0.15.12), pylint R0801, lint-auth-signals.sh, the architecture-boundaries lint and the file-length and ASCII guards all pass.
  • Not run locally: real Windows. The Windows fixes rest on documented Windows errno/winerror values and on POSIX tests that reproduce the Windows shapes. This PR's Windows Compatibility Gate and the post-merge manual-build-release run cover real Windows.

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

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 <[email protected]>
@danielmeppiel

Copy link
Copy Markdown
Collaborator Author

APM Review Panel: ship_with_followups

Unblocks the 0.36.0 tag by fixing three regressions (two on Windows, one in skill preflight) and updating 13 stale tests to match intentional behavior changes.

panel-mode=lean; personas=python-architect,test-coverage-expert,apm-ceo

cc Sergio Sisternes (@sergio-sisternes-epam) -- a fresh advisory pass is ready for your review.

Both panelists agree the fix is sound and release-critical. The test-coverage-expert ran each regression test and confirmed that all three would fail on the code before the fix:

  • On Windows, hook cleanup removed nothing, because recorded hashes were keyed with backslashes.
  • On Windows, describe_path_obstruction returned nothing for the EACCES and ENOENT error cases.
  • Skill preflight refused claimed files inside an unclaimed, populated skill directory.

No stale-test update loosened an assertion, and the existing refusal tests still exercise the refusal path. Moving the frozen-hash test off the live api.github.com is the right call: a release gate should not depend on an external endpoint.

The python-architect raised two follow-ups, both cases of two places owning the same decision. The normalization in cleanup.py is one more caller-side replace, when a single posix_path_key() helper at the deployed_file_hashes boundary would remove this class of bug. The user_skill_dir check in preflight copies the materialization guard in skill_integrator.py instead of sharing it. Neither follow-up was introduced by this PR; the PR works around both to unblock the release.

Orchestrator note: I checked how the new preflight skip lines up with materialization. Preflight returns () under --force. Otherwise it skips only when the directory has content and check_collision is true, plus further ownership and identity checks, and materialization also skips in those cases. The narrow gap is a directory that this same install run has already claimed (_native_skill_session_owners). That gap is the drift the shared-predicate follow-up would close.

Aligned with: Portable by manifest: Windows behavior matches the other platforms again. Multi-host: the release gate no longer depends on a live API. Pragmatic as npm: tests follow intentional product changes.

Panel summary

Persona B R N Takeaway
Python Architect 0 2 0 Two follow-ups where one decision is copied into a second place. The EACCES handling is sound. Acceptable for a release fix.
Test Coverage Expert 0 0 0 All three regression tests fail on the pre-fix code, no stale-test update weakened its test, and the refusal path is still covered.

B = blocking-severity findings, R = recommended, N = nits.
Counts are signal strength, not gates. The maintainer ships.

Top 2 follow-ups

  1. [Python Architect] Extract a posix_path_key() helper into utils/paths.py and use it where deployed_file_hashes is written and read, instead of a backslash replace in each caller. -- This removes a class of Windows-only bugs that fail silently, at their source.
  2. [Python Architect] Extract is_unclaimed_user_skill_dir() into skill_support.py, call it from both skill_preflight.py and skill_integrator.py, and add a test that the two agree. -- The preflight check and the materialization guard already differ, including for directories claimed earlier in the same run.

Recommendation

Ship now and tag 0.36.0. File the two architecture follow-ups as issues for the 0.37.0 cycle. Neither is a regression introduced by this PR, and the tag cannot ship until these lanes are green.


Full per-persona findings

Python Architect

  • [recommended] The backslash normalization in remove_stale_deployed_files happens in the caller; the code that owns path keys should guarantee POSIX keys at the boundary. At src/apm_cli/integration/cleanup.py:363.
    "Lockfile path keys use forward slashes" should have one owner, but about 30 call sites already do their own replace. This PR adds two more instead of fixing the point where backslash keys enter deployed_file_hashes. That is pragmatic for a release fix.
    Suggested: A posix_path_key() helper used where deployed_file_hashes is written and read, plus a boundary lint against new ad-hoc replace calls.
  • [recommended] user_skill_dir explicitly mirrors the materialization guard. It should live in one shared place to prevent drift. At src/apm_cli/integration/skill_preflight.py:208.
    The architecture rules say a second place computing the same decision splits authority. The two checks already differ in structure, and no test checks that they agree.
    Suggested: A shared is_unclaimed_user_skill_dir() in skill_support.py with a test that the two callers agree.

Test Coverage Expert

No findings.

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.

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.

🟡 Changes recommended

Preflight’s duplicated directory-skip logic uses inconsistent ownership rules, potentially rejecting cross-target skills that native materialization would skip.

1 open issue
What changed in this PR

This PR repairs regressions and stale fixtures behind the 0.36.0 release-gate failures, preserving APM’s existing install and cleanup behavior across platforms.

Changes:

  • Normalize cleanup hash paths and recognize Windows path obstructions.
  • Align skill preflight with materialization’s handling of unclaimed directories.
  • Refresh policy, Git, CLI and lifecycle tests to match current behavior and avoid live GitHub validation.
File Description
tests/​unit/​integration/​test_skill_preflight.py Cover claimed members inside unclaimed skill directories.
tests/​unit/​integration/​test_hook_integrator.py Verify cleanup with Windows-style hash keys.
tests/​unit/​install/​test_obstructed_path_diagnostics.py Add Windows obstruction cases and negative controls.
tests/​integration/​test_uninstall_policy_pack_flow.py Use a real policy result and assert discovery outcomes.
tests/​integration/​test_github_downloader_validation_flow.py Build committed cache fixtures and reject clone fallback.
tests/​integration/​test_git_semver_install_e2e.py Add licence records to the download stub.
tests/​integration/​test_frozen_deployed_hash_lifecycle.py Use a generic host to keep validation local.
tests/​integration/​test_deps_why_promises_e2e.py Update the global-scope help assertion.
tests/​integration/​test_deps_coverage.py Verify bare-cache materialization using real Git fixtures.
tests/​integration/​test_deep_coverage_deps_policy.py Replace a permissive mock with PolicyFetchResult.
tests/​integration/​test_config_surface_lifecycle_contract.py Assert specific registry diagnostics and parsed URLs.
tests/​integration/​test_commands_mcp_flow.py Check the forwarded-options help section.
tests/​integration/​test_anonymous_https_git_suffix_e2e.py Give the clone fixture real Git objects.
src/​apm_cli/​utils/​file_ops.py Recognize Windows directory and parent-path obstructions.
src/​apm_cli/​integration/​skill_preflight.py Skip receipt checks for directories materialization leaves alone.
src/​apm_cli/​integration/​cleanup.py Normalize recorded hash keys and lookups to forward slashes.

Review effort: Balanced

apm-spec-waiver: restores pre-existing behaviour on Windows and in skill preflight; no OpenAPM-observable change

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit e9860ee into main Nov 17, 2026
24 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-fix-release-gate-lanes branch November 17, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants