← Back to issue list

cli: allow snap-id for validate

View original Github issue

Metadata

Project
snapcraft
Number
#3349
Type
pull request
State
merged
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #3349 (commit 1fc64e4ac, LP #1902913) lets `snapcraft validate` accept a snap-id as fallback when the Info API can't resolve a name, e.g. for private snaps; shipped on edge/pr-3349.

Resolution: closed resolved

Reason: PR #3349 was approved and merged as commit 1fc64e4ac, adding a try/except SnapNotFoundError fallback in the validate command that uses the gated_snap value directly as approved_snap_id. Reviewer nessita reported a variable-name collision that broke the build; sergiusens fixed it and confirmed nessita verified it works. The logic survives in snapcraft/commands/validations.py at HEAD.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Info API can only retrieve snap-id's for what is publicly available, workaround the issue by allowing for using the snap-id as a fallback to the snap-name. LP: #1902913 Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #3349 (commit 1fc64e4ac, LP #1902913) lets `snapcraft validate` accept a snap-id as fallback when the Info API can't resolve a name, e.g. for private snaps; shipped on edge/pr-3349.
stealth/space-bunny-alpha — closed resolved Merged as commit 1fc64e4ac: 'validate' now falls back to using a snap's ID when the Info API cannot resolve a name (LP #1902913). Reviewer-reported snap_id variable collision was fixed before merge.
stealth/space-bunny-alpha — closed resolved Merged as commit 1fc64e4ac into snapcraft master: `validate` now accepts a snap-id as a fallback when the snap-name cannot be resolved via the Info API (LP #1902913). Reviewer-found snap_id name collision was fixed and re-tested.
stealth/space-bunny-alpha — closed resolved Merged as commit 1fc64e4ac: `snap validate` now falls back to the snap-id when the store Info API cannot return one for a public snap-name, fixing a snap_id variable collision.
stealth/space-bunny-alpha — closed resolved Merged as commit 1fc64e4ac, adding snap-id as a fallback to snap-name for validate and fixing a snap_id naming collision; resolves LP #1902913.
stealth/space-bunny-alpha — closed resolved Merged snapcraft PR #3349, adding snap-id as a fallback to snap-name for validate. Fixed a snap_id naming collision and confirmed the corrected implementation works, addressing LP #1902913.
qwen/qwen3.6-35b-a3b — — Merged to enable snap-id fallback for snap-name in the CLI validate command, resolving LP #1902913. Addressed reviewer feedback by fixing a variable naming collision and verified functionality.
qwen3.6-35b-a3b-mtp-q6 — — Merged change allowing snap-id as a fallback for snap-name in the validate CLI command to bypass Info API limitations. A variable naming collision was resolved during review, and the update was verified and merged.

Update history

No update history recorded yet.

Related work

  • Related To: snapcraft#6208 (confidence 55%)

    Later refactor 'migrate validate command' that carried the approved_snap_id fallback logic forward into current validations.py

  • Related To: snapcraft#5413 (confidence 45%)

    Referenced in-code as a prior problem changing validation assertion time formats; unrelated to the resolution

Related issues

Issue Project State Summary Similarity
#2115 storeapi: ensure snap ID is sane before using it snapcraft merged Merged PR #2115 in commit 12828eba2 validates snap IDs before use, preventing tracebacks when the Store registers a snap without an ID and fixing LP #1763721.
71%
#1902913 snapcraft validate does not work with snaps in stores other than Global snapcraft (launchpad) closed Fixed by snapcore/snapcraft PR #3349 (commit 1fc64e4ac, "cli: allow snap-id for validate"), which lets validate accept snap IDs directly instead of only resolving names via the Global store; released in snapcraft 4.4.1.
71%
#1775658 validate command doesn't allow specifying a channel snapcraft (launchpad) closed Closed as addressed by snapcraft PR #3349 (commit 1fc64e4ac), which lets `validate` accept a snap ID and bypass the stable-channel name lookup.
70%