Skip to content

fix(marketplace): a changed locked origin is advised as a lock to restore first - #4518

Merged
Daniel Meppiel (danielmeppiel) merged 1 commit into
train/0.37-final-2from
bug-sweep/p4228-advice
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 1 commit into
train/0.37-final-2from
bug-sweep/p4228-advice

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

A review follow-up on #4228 (S lead), fixed in the sweep rather than filed. When an alias now names a different catalog than apm.lock.yaml recorded (MarketplaceOriginConflictError), the advice now points first at the safe path:

... Nothing was changed. If apm.lock.yaml was not changed on purpose, restore it from version control. Otherwise, verify that source first, then run 'apm marketplace add <quoted url> --name <name>' to keep the locked marketplace (...). To switch marketplaces on purpose, ...
  • core/remediation.py: marketplace-origin-restore (the owner of this advice) gains before="verify that source first".
  • marketplace/errors.py: the restore-from-version-control sentence comes first. The locked and current origins render through utils.diagnostics.printable_ascii_text, so a lock value cannot inject terminal escapes. A locked origin that needed sanitizing is never echoed as a runnable command. The existing shlex quoting stays.
  • Tests: test_catalog_origin.py::test_conflict_advice_restores_the_lock_first_and_renders_origins_as_ascii, and the tampered source_url cell in test_marketplace_update_provenance_lifecycle.py now asserts that the output says to restore apm.lock.yaml from version control.

Base: train/0.37-final-2 (the catalog and #4475's tests are only there). Fold after #4475.

Issue and approved scope

Issue: Refs #4228 (scope record: #4228 (comment)); #4475 closes it.

Human scope-approval comment: #4228 (comment)

Does this PR complete the issue, or what remains? It folds an S-lead review follow-up into the #4228 work; #4475 completes the issue.

Type of change

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

Testing

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

One guarded run on this branch (apm 0.37.0): pytest tests/unit/marketplace/test_catalog_origin.py tests/unit/core/test_remediation_w2_marketplace_catalog.py tests/unit/core/test_remediation_block_proofs.py tests/integration/test_marketplace_update_provenance_lifecycle.py::test_update_restores_or_refuses_altered_marketplace_provenance[source_url-tamper] -> 245 passed, 1 failed. The failure is the pre-existing train red test_every_block_remediation_has_a_proof_level[test_remediation_w4_frozen_policy_catalog] ('policy-fetch-failure-blocked', from #4500), which this PR does not touch.

Changelog

Spec conformance (OpenAPM v0.1)

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

…tore first

When an alias now names a different catalog than apm.lock.yaml recorded,
the advice first says to restore apm.lock.yaml from version control if it
was not changed on purpose, and only then to verify the locked source and
re-register it. Both origins render as printable ASCII, and a locked
origin that needed sanitizing is never echoed as a runnable command.

Refs #4228

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.

1 participant