Skip to content

fix(update): restore a marketplace row to its declared alias when the origin matches - #4475

Merged
Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
bug-sweep/p4228b
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
bug-sweep/p4228b

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

apm update now restores a marketplace lock row whose discovered_via names a different alias than the one apm.yml declares, as long as the row records the origin the user registered for the declared alias. The restoration is reported. A stripped row, or a row that records a different origin, is still refused with no write.

This PR is stacked on #4338 (base danielmeppiel-bug-sweep-037-p4). It also needs #4416 (the enforce_ref_pins keyword), which precedes it in the train.

#4484: apm update --dry-run re-verified provenance through catalog reads that persisted the marketplace cache (~/.apm/cache/marketplace/<market>.meta.json). The marketplace client now has a read-only scope (catalog_cache_read_only) that skips cache writes and cache-directory creation, and update opens it on dry runs. Test: tests/lifecycle/world/test_world.py::test_marketplace_update_dry_run_writes_nothing_under_apm_home (red before: meta.json rewritten; green after).

Strict cell flipped: tests/lifecycle/security/test_origin_and_credentials.py::test_origin_row[M|update|lock-row-edited] ("update restores the recorded marketplace provenance") is required now.

Issue and approved scope

Issue: Fixes #4228 (scope record: #4228 (comment))
Issue: Fixes #4484 (scope record: #4484 (comment))

Human scope-approval comment: #4228 (comment)

Does this PR complete the issue, or what remains? It completes #4228 together with the re-verification already in #4338.

Type of change

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

Testing

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

Run locally on a scratch merge of this branch with #4416, through the host test guard:

  • pytest tests/lifecycle/security/test_origin_and_credentials.py -k origin -> 47 passed (M|update|lock-row-edited failed before this change: update exited 1).
  • pytest tests/integration/test_marketplace_update_provenance_lifecycle.py tests/quality/test_lifecycle_bug_ledger.py tests/integration/test_marketplace_explicit_refresh_lifecycle.py::test_update_follows_changed_pins_and_respects_selection tests/integration/test_approval_identity_lifecycle.py::test_deny_by_install_spec_stays_retired_through_update_and_frozen -> 19 passed.
  • python scripts/lint_architecture_boundaries.py --root . -> clean; python scripts/check_complexity_ratchet.py --base-ref 692027b5 -> clean; ruff check and format -> clean.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md:
    user-visible effect first, 25 words or fewer, ending with (#PR);
    breaking changes only under upgrade notes; no Highlights; see
    .github/instructions/changelog.instructions.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

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

…when its origin matches

A lock row whose discovered_via names another alias, while it records the
origin the user registered for the declared alias, is restored to the
declared alias and reported, as install does. A stripped row or one that
records another origin is still refused. The origin cell for an edited
lock row under update is required now.

Co-authored-by: Copilot App <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…ared alias when the origin matches

Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/lifecycle/security/test_origin_and_credentials.py
…-only

apm update --dry-run reads catalogs to re-verify locked marketplace
provenance without persisting them: the marketplace client gains a
read-only scope that skips cache writes and cache-directory creation, and
update opens it on dry runs.

Fixes #4484

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.

apm update --dry-run writes the marketplace metadata cache Trust and integrity consistency: update restores the recorded marketplace provenance

1 participant