← 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 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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Merged improvements to the snap name schema validator. The update replaces an exponential-time regex with an efficient pattern, adds missing length validation, and provides clearer error messages. Changes support broader project-wide validation unification.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1924 schema: update version regex snapcraft merged Merged update to the schema version regex, aligning validation with snapd and review tools. Approved by three reviewers, passed CI checks, and modified two files.
78%
#3303 schema: add regex to validate description is non-empty snapcraft merged Merged a schema update adding a regex pattern to validate non-empty snap descriptions. This catches metadata errors earlier in the build process. Approved by maintainer, passed CI checks, and integrated into the main branch.
74%
#1615 schema: improve invalid app, hook, and part errors snapcraft merged Merged changes improve validation error messages for invalid app, hook, and part names in snapcraft.yaml. Replaces confusing jsonschema errors with custom validation messages, resolving Launchpad bug #1606890. Approved by two reviewers and passed CI.
71%
#2609 schema: allow 'snapd' snap type snapcraft merged Merged to allow the 'snapd' snap type in the schema. Approved by one reviewer, passed CI checks, and modified three files.
70%