Skip to content

fix(install): --frozen replays plugins from a local marketplace (#4639) - #4655

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-p1-4639-local-mkt-frozen
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
danielmeppiel-p1-4639-local-mkt-frozen

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

A plugin installed from a local marketplace (a catalog directory or a direct marketplace.json file) converged under apm install, but apm install --frozen exited 1 on the same project ("declared source, ref, host provider, or transport differs from apm.lock.yaml"), and apm audit --ci disagreed with the converged state too.

Root cause: the lock row already records the marketplace identity (discovered_via, marketplace_plugin_name), but the owner of the locked-selection comparison, drift.marketplace_ref_mismatch, demanded a full locked commit. A local catalog row has no commit, so every consumer (frozen plan, audit ref-consistency, lock-first replay) treated it as under-evidenced.

Fix, in the owners (single-owner rule):

  • drift.py (owner marketplace-locked-selection): a local-source marketplace row is locked by its content (local_path + content_hash), not a commit; a manifest version or ref still fails, since a local catalog selects none. locked_marketplace_replay returns a new local-catalog decision for such rows, so plain apm install keeps reading the catalog from disk (catalog edits still apply, no behavior change), and local_catalog_refusal makes --frozen refuse when the catalog no longer selects the locked plugin directory.
  • deps/apm_resolver.py: consumes the decision (applies the refusal under --frozen only).
  • install/local_content_verdict.py (the one local-content verdict): also checks local catalog plugins, so a changed plugin content fails --frozen before any write and fails audit --ci alike (without it, frozen deployed the changed files and only withheld the lock write).

No new lockfile fields and no change in meaning of existing ones; rows for other sources are byte-identical. Local catalogs still record no source_url/source_digest (machine-specific paths, as documented in lockfile-spec).

Dependency order: none. Note for Q&L: the M-SOURCE strict cells X|install|local-mkt|FROZEN=on and X|install|file-mkt|FROZEN=on are not on main yet (they live in the unpublished ql-w1-t2-drain-4-wip branch, no known cell recorded). If this lands first, the T-2 drain-4 batch records them as required instead of strict-known.

Lifecycle evidence:

promise: P-INV-I3 -- install --frozen and audit --ci agree with the state install converged (source: #4639 scope record)
cell: OP=install SRC=marketplace-local|marketplace-file PRIM=instruction SCOPE=project FROZEN=on   owner: marketplace-locked-selection (drift.py)
instrument: today test -> tests/integration/test_marketplace_local_catalog_frozen_lifecycle.py::test_local_catalog_plugin_passes_frozen_and_refuses_changes_without_writes[local-mkt|file-mkt] (new: no local-catalog frozen coverage existed)
oracles: [I2, I3, I6, I8, I9, snapshot-absence on refusals]  decisive: install --frozen exits 0 and LifecycleStateSnapshot == converged
failing-before: (fix reverted) pytest <node> -> exit=1 "[x] --frozen: apm.lock.yaml is out of sync with apm.yml." at the decisive step, both params
passing-after: pytest <node> -> 2 passed
guard+mutation: n/a (no new caller bypass; existing marketplace-locked-evidence guard passes)     ledger: 4639
hints executed: "Run 'apm install' to lock the marketplace dependency" -> install exits 0, then --frozen exits 0

Issue and approved scope

Issue: Fixes #4639

Human scope-approval comment: #4639 (comment)

Does this PR complete the issue, or what remains? Completes it. Controls from the record: git-backed marketplace, git and local-path dependencies keep passing frozen (existing suites green); a changed local catalog entry still fails frozen ("declared source differs from apm.lock.yaml: the local catalog now selects X, but apm.lock.yaml pins Y. Run 'apm install' to lock the marketplace dependency, then commit apm.lock.yaml."), now writing nothing; other sources' lock rows unchanged.

Type of change

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

Testing

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

Results (local, host-guarded, sequential):

  • env -u GIT_EXEC_PATH "PATH=/usr/bin:/bin:$PATH" APM_E2E_TESTS=1 APM_BINARY_PATH=$PWD/.venv/bin/apm .venv/bin/python -m pytest tests/integration/test_marketplace_local_catalog_frozen_lifecycle.py -n 0 -q -> before fix: 2 failed (frozen exit 1); after: 2 passed
  • .venv/bin/python -m pytest tests/unit/marketplace tests/unit/test_drift_detection.py tests/unit/test_drift_registry.py tests/unit/install tests/unit/deps tests/unit/policy tests/integration/test_architecture_marketplace_locked_evidence.py tests/quality/test_lifecycle_bug_ledger.py -n 2 -q -> 8573 passed, 1 skipped
  • .venv/bin/python -m pytest tests/unit/scripts/test_architecture_runner.py tests/integration/test_architecture_marketplace_locked_evidence.py tests/quality/test_lifecycle_bug_ledger.py tests/unit/marketplace/test_locked_selection_evidence.py -n 0 -q -> 161 passed
  • Lint: uvx [email protected] check / format --check -> clean; pylint R0801 -> 10.00/10; bash scripts/lint-auth-signals.sh -> clean; python scripts/check_complexity_ratchet.py --base-ref origin/main -> clean; python -m tests.quality.taxonomy --changed -> clean; python scripts/check_test_assertions.py -> clean; python scripts/lint_architecture_boundaries.py --root . -> exit 0
  • Manual repro from the issue (catalog dir and direct file): install, install, install --frozen -> exit 0, lock bytes unchanged; audit --ci -> 15 checks passed

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: 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. (Marketplace references are non-normative in v0.1.)

…ozen (#4639)

Lock local catalog rows by content in the marketplace-locked-selection owner,
re-read the catalog on install, refuse a changed selection under --frozen, and
apply the local-content verdict to local catalog plugins so frozen and
audit --ci refuse changed content before any write.

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

🟡 Changes recommended

Frozen installs can run scripts or deploy changed content before refusing, and nested local-catalog plugins bypass content checks, leaving audit drift detection incomplete.

2 open issues
What changed in this PR

This PR addresses #4639 by allowing frozen installs to accept unchanged local-path plugins from local marketplaces, using content hashes rather than commit evidence.

Changes:

  • Adds local-catalog replay handling and rejects changed selections during frozen resolution.
  • Extends the shared frozen-install and audit content check to root-level local marketplace plugins.
  • Adds regression coverage, documentation, and a changelog entry.
File Description
tests/​unit/​marketplace/​test_locked_selection_evidence.py Tests content-backed lock evidence and catalog selection changes.
tests/​integration/​test_marketplace_local_catalog_frozen_lifecycle.py Exercises frozen replay and refusal for directory and file catalogs.
tests/​fixtures/​lifecycle_bug_ledger/​bugs/​4639.json Records the bug and regression tests.
src/​apm_cli/​install/​local_content_verdict.py Includes root-level local marketplace plugins in content verification.
src/​apm_cli/​drift.py Owns local-catalog lock evidence and selection refusal.
src/​apm_cli/​deps/​apm_resolver.py Applies local-catalog selection refusal during frozen resolution.
docs/​src/​content/​docs/​consumer/​installing-from-marketplaces.md Documents local-catalog replay behavior.
changelog.d/​4655.fixed.md Announces the frozen-install and audit fix.
.apm/​architecture/​owners/​marketplace-plugins.json Updates the locked-selection owner description.

Review effort: Balanced

Comment thread src/apm_cli/deps/apm_resolver.py Resolved
…verify nested local-catalog plugins (#4639)

- InstallService checks local-catalog selections under --frozen inside the
  marketplace scope before pre-install scripts fire
  (local_catalog_selection_reasons, an origin-checked, admission-checked
  entry point registered in marketplace_locked_evidence); the resolver check
  stays as a safeguard
- local_content_reasons enqueues a verified local package's marketplace
  children that resolved through a local catalog

apm-spec-waiver: frozen-install refusal ordering for local marketplace catalogs; no OpenAPM-observable change

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit f8b2b1c into main Nov 21, 2026
72 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-p1-4639-local-mkt-frozen branch November 21, 2026 20:29
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
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 refuses a converged project that declares a plugin from a local marketplace

2 participants