← Back to issue list

validate architecture scalars

View original Github issue

Metadata

Project
snapcraft
Number
#4340
Type
issue
State
closed
Author
mr-cal
Labels
—
Created
Updated
Closed

Current evaluation

Closed without a dedicated fix: maintainer mr-cal noted on 2025-04-24 that Pydantic validation errors were now usable, making the bespoke architecture check obsolete.

Resolution: closed not a bug

Reason: The closing comment by @mr-cal states that Pydantic errors are more usable and the request is no longer relevant. No resolving PR or commit was cited for #4340.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### What needs to get done Validate that architectures only contain alphanumeric characters and recommend using brackets for multiple architectures. ```yaml archictectures: - build-on: amd64 build-for: bad, value ``` ```shell > snapcraft Error: Architecture 'bad, value' must only contain alphanumeric characters. Use brackets to list multiple architectures: '[arch1, arch2]'. For more information, check out: https://snapcraft.io/docs/architectures ``` This validation can be done during yaml validation and should be similar for the core20 and core22 implementations. This issue is referenced in the documentation and should be updated when completed. (both [readthedocs](https://canonical-snapcraft.readthedocs-hosted.com/en/latest/explanation/index.html) and snapcraft.io/docs) #### Breaking changes This can break previously working core20 snap builds. However the snap themselves are useless; `snap install "my-snap_1.0_amd64, arm64.snap"` always fails. ### Why it needs to get done Consider the following snapcraft.yaml: ```yaml base: core20 architectures: - build-on: amd64 run-on: amd64, arm64 # problematic: this is a scalar, not a list ``` This scenario happens during iterative development. A user starts with a single scalar architecture `amd64` and later adds another architecture without adding brackets. So `amd64, arm64` is still treated as a scalar. The correct syntax is a yaml list: `[amd64, arm64]`. In core20, this is allowed. It would produce a snap named `my-snap_1.0_amd64, arm64.snap`. In core22, this is not allowed but the error could be improved. It may not be obvious that the square brackets are missing. source: https://bugs.launchpad.net/snapcraft/+bug/2009520

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed without a dedicated fix: maintainer mr-cal noted on 2025-04-24 that Pydantic validation errors were now usable, making the bespoke architecture check obsolete.
stealth/space-bunny-alpha — closed stale Closed as no longer relevant because Pydantic validation errors are now more usable; no dedicated architecture-scalar validation change was identified.
stealth/space-bunny-alpha — closed not a bug Closed as no longer relevant after Pydantic validation errors became more usable; no dedicated architecture-scalar fix was identified.
stealth/space-bunny-alpha — closed not a bug Closed as no longer relevant after improved Pydantic validation made its proposed architecture-scalar validation and guidance obsolete.
qwen/qwen3.6-35b-a3b — — Closed as no longer relevant. Enhanced Pydantic validation now surfaces clear, actionable errors for malformed architecture fields, rendering custom scalar checks unnecessary.
qwen/qwen3.6-35b-a3b — — Superseded by improved Pydantic error handling, which now provides clearer feedback for invalid architecture scalars. Closed as obsolete.
qwen/qwen3.6-35b-a3b — — Closed as superseded. Maintainer noted that improved Pydantic error handling now provides clearer validation messages for architecture scalars, rendering custom validation unnecessary. No code changes were implemented.
qwen3.6-35b-a3b-mtp-q6 — — Closed as no longer relevant. Enhanced Pydantic error handling now provides clearer validation messages for architecture scalars, rendering custom snapcraft checks unnecessary.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#5818 (confidence 90%)

    Added a core20 warning for architecture shorthand, overlapping the requested behavior but not implementing the proposed validation error.

  • Related To: canonical/snapcraft#5730 (confidence 85%)

    Merged Pydantic validation and schema work that improved project-model errors, though it was not cited directly in the closure.

Related issues

No related issues found above the similarity threshold.