← Back to issue list

schema: improve the snap name's validator

View original Github issue

Metadata

Project
snapcraft
Number
#1957
Type
pull request
State
merged
Author
chipaca
Labels
—
Created
Updated
Closed

Current evaluation

Merged as b950c66a2: snap-name validation now avoids exponential regex behavior, enforces the length limit, and provides clearer errors.

Resolution: closed resolved

Reason: PR #1957 was merged as commit b950c66a2. Its schema changes resolved slow validation, missing length checks, and unclear invalid-name messages.

Evaluated by: mr-cal-bot

No scores available.

Issue body

The name's validation in the schema had three issues: * It performed exceptionally poorly with some names, taking hours to validate. * It didn't check the length of names. * it returned an error message that was not particularly helpful: if you tried to use a name of `a--b`, for example, it would warn you that “Snap names consist of lower-case alphanumeric characters and hyphens. They cannot be all numbers. They also cannot start or end with a hyphen.” which was probably perplexing. This addresses these issues. It also is part of a unification effort of the name validation accross the project, which I go on about on https://bugs.launchpad.net/snapstore/+bug/1751447.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged as b950c66a2: snap-name validation now avoids exponential regex behavior, enforces the length limit, and provides clearer errors.
stealth/space-bunny-alpha — closed resolved Merged in snapcraft#1957 (b950c66a2): snap-name validation now avoids exponential regex behavior, checks name length, and provides clearer errors.
qwen/qwen3.6-35b-a3b — — Merged schema validator improvements. Fixed exponential regex performance, added length validation, and clarified error messages. Approved by two reviewers, modified two files, and aligns with project-wide validation unification.
qwen3.6-35b-a3b-mtp-q6 — — Merged schema improvements for snap name validation. Fixes exponential regex performance bottlenecks, adds length constraints, and replaces vague error messages with clear feedback, aligning with project-wide validation standards.

Update history

No update history recorded yet.

Related work

  • Related To: snapstore#1751447 (confidence 95%)

    The PR describes this validator change as part of a broader snap-name validation unification effort tracked there.

Related issues

Issue Project State Summary Similarity
#1751447 snapstore and review-tools use the wrong regexp for snap names snapcraft (launchpad) closed Snap-name validation was fixed by merged PR snapcraft#1957 (commit b950c66a2), removing exponential regex behavior, enforcing the 40-character limit, and improving errors.
76%
#1763048 Snap names regexes are inconsistent or too permissive snapcraft (launchpad) open Cross-project request to make snap-name validation consistent (no one-char names, no leading/trailing/double dashes). Resolved upstream: snapd added the min-length-2 check (snapd PR #6154, commit 362784dc); tracker marked fix released in 2019 but bug still shows open.
72%