Skip to content

fix(install): name the unfetchable locked package under --frozen (#4909) - #4912

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
cloud-4909-frozen-fetch-diag
Nov 23, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
cloud-4909-frozen-fetch-diag

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

When apm install --frozen could not re-download a locked package, the
sequential acquire recorded the fetch failure only as a diagnostic (rendered
after the install). The frozen MCP-declarations check then raised first and the
[x] line blamed restored MCP declarations differ from apm.lock.yaml, hiding
the real cause.

Fix (diagnostics only, frozen semantics unchanged):

  • install/phases/integrate.py: packages whose acquire failed (no
    materialization, no terminal deltas) are passed, with their recorded error
    diagnostic, to the existing owner InstallService.enforce_frozen_restored,
    which already runs before the hydrated MCP check.
  • install/service.py: the refusal header now names the packages:
    [x] --frozen: locked dependencies could not be restored: test/pkg., followed
    by the cause line (- Failed to install test/pkg: Failed to clone ...).
  • Still fails closed with zero durable writes (project, lockfile and
    apm_modules byte-identical). Retry policy and the MCP consistency check are
    untouched.

Note for #4891: its lifecycle cell carries a strict Known citing #4909.
Whichever of this PR and #4891 lands second must flip that Known to a passing
assertion.

Lifecycle evidence

promise: P-INV-I7 -- a failed command preserves durable state and says why (source: .agents/skills/apm-lifecycle-tests/SKILL.md)
cell: OP=install-frozen SRC=git PRIM=apm-package SCOPE=project LOCK=unchanged DEPLOYED=warm CACHE=cold NET=commit-unavailable FROZEN
owner: InstallService.enforce_frozen_restored (src/apm_cli/install/service.py)
instrument: today test -> tests/integration/test_frozen_unfetchable_lock_lifecycle.py::test_frozen_names_the_locked_package_it_could_not_fetch (new: avoids conflict with #4891's edits to test_locked_source_cache_parity_lifecycle.py)
oracles: [I6, I7, snapshot-absence of project+lockfile+apm_modules]  decisive: first [x] line contains "could not be restored" and "test/pkg"; no "restored MCP declarations differ"
failing-before: APM_E2E_TESTS=1 pytest <node> -n 0 -> FAILED: assert 'could not be restored' in '[x] --frozen: restored MCP declarations differ from apm.lock.yaml.'
passing-after: same command -> 1 passed
guard+mutation: n/a (existing owner, single caller)     ledger: 4909
hints executed: none printed (the tip says "Fix the cause above and re-run")

Issue and approved scope

Issue: Fixes #4909

Human scope-approval comment: #4909 (comment)

Does this PR complete the issue, or what remains? Completes it.

Type of change

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

Testing

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

Validation (single process):

  • APM_E2E_TESTS=1 APM_BINARY_PATH=$(uv run which apm) uv run --extra dev pytest tests/integration/test_frozen_unfetchable_lock_lifecycle.py -n 0 -> failed on main (src stashed), 1 passed with fix
  • uv run --extra dev pytest tests/unit/install/ tests/unit/test_install_pipeline_orchestration.py -n 0 --deselect tests/unit/install/test_unix_install_ownership.py -> 3369 passed (the deselected module fails locally only because the sandbox runs as root)
  • Neighbouring frozen lifecycle modules (8 modules + test_locked_source_cache_parity_lifecycle.py) -> 103 passed
  • uv run --extra dev pytest tests/quality/test_lifecycle_bug_ledger.py -> 2 passed
  • Lint mirror: ruff check, ruff format --check, pylint R0801, lint-auth-signals.sh, check_complexity_ratchet.py --base-ref origin/main, lint_architecture_boundaries.py --root ., tests.quality.taxonomy --changed -> all clean

Changelog

  • One fragment per section, changelog.d/<pr>.<section>.md, holding
    one line: user-visible effect first, 25 words or fewer, ending with
    (#PR); breaking changes only under upgrade notes; no Highlights; no
    new lines under ## [Unreleased]. See changelog.d/README.md and
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • Spec edit
  • Manifest edit
  • Test edit
  • CONFORMANCE.{md,json} regenerated
  • N/A -- this PR does not change OpenAPM-observable behaviour.

apm-spec-waiver: diagnostics-only fix; the frozen refusal names the unfetchable package; no OpenAPM-observable semantics change

A failed acquire only recorded a diagnostic, rendered after the install,
so the frozen MCP-declarations check raised first and blamed restored
MCP declarations. Failed acquisitions now feed enforce_frozen_restored,
whose [x] line names each package and prints the recorded cause.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.38.0 milestone Nov 23, 2026
Copilot AI balanced review requested due to automatic review settings November 23, 2026 04:31

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 remain for the change that reports locked-package restoration failures before derived consistency errors.

No open issues 🎉

What changed in this PR

Fixes #4909 by making apm install --frozen report the locked package that could not be restored and its recorded cause before derived MCP consistency errors, without changing frozen-install semantics.

Changes:

  • Routes failed acquisitions through the existing frozen-restoration check.
  • Includes affected package names in the refusal header.
  • Adds unit and lifecycle regression coverage for diagnostics and unchanged durable state, plus a bug-ledger entry and changelog fragment.
File Description
tests/​unit/​install/​test_frozen.py Tests failure collection, package naming, and empty failures.
tests/​integration/​test_frozen_unfetchable_lock_lifecycle.py Tests an unfetchable locked package, clear diagnostics, and unchanged durable state.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​4909.json Records the bug and links its lifecycle regression test.
src/​apm_cli/​install/​service.py Adds package names to the frozen-restoration refusal header.
src/​apm_cli/​install/​phases/​integrate.py Passes failed acquisitions and their causes to the restoration check.
changelog.d/​4912.fixed.md Documents the improved frozen-install diagnostic.

Review effort: Balanced

apm-spec-waiver: diagnostics-only fix; the frozen refusal names the unfetchable package; no OpenAPM-observable semantics change

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

The review identifies no active issues with the frozen-install diagnostic changes.

No open issues 🎉

Review effort: Balanced

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 reported for the change improving frozen-install failure diagnostics.

No open issues 🎉

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 6451632 into main Nov 23, 2026
72 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the cloud-4909-frozen-fetch-diag branch November 23, 2026 08:07
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 23, 2026
Move the #4678, #4890, #4892, #4912 and #4934 lines into [0.38.1]: they merged before the v0.38.1 tag and shipped in it. [0.38.2] keeps #4920.

Co-authored-by: Copilot App <[email protected]>
Abhishek Kapoor (kapoorsunny) pushed a commit to kapoorsunny/apm that referenced this pull request Nov 23, 2026
The GATE reference expected --frozen to refuse only without a lockfile.
install.md (Frozen mode) refuses any declared direct dependency the lock
has no row for, which microsoft#4912 now enforces; the model was stale. Replays the
nightly falsifier (declare, update, declare, audit --ci).

Co-authored-by: Copilot App <[email protected]>
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.

[BUG] install --frozen hides a failed re-download behind an MCP-declarations error

2 participants