Skip to content

Conversation

@alesancor1
Copy link
Member

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint && make test?
  • Have you added an entry to the changelog (docs/reference/changelog.rst)?

This PR decreases the min_length of the project title to 1.

Rationale

Some of the craft-applications (rockcraft, snapcraft, etc) set the project title equal to the name when the former is not set. However, the name allows single character values while being more restrictive (regex) meaning that setting a (valid) name with a single character would fail the validation of title.

Proposed solution: Make the title equal or less restrictive than name by reducing the min_length to 1.

@alesancor1
Copy link
Member Author

ping @canonical/starcraft-reviewers - related to github.com/canonical/rockcraft/pull/957

@lengau
Copy link
Collaborator

lengau commented Sep 15, 2025

I believe the reason we made the title require a minimum length of 2 is because the store rejects items with a title length of 1.

When looking for that, I couldn't find that declaration, but I did find that the store will reject rocks with a single-character name (https://git.launchpad.net/review-tools/tree/reviewtools/schemas/rock.json), which perhaps means we should rethink canonical/rockcraft#957? (I think at minimum a single-character name is a reason for a warning that the store will reject the rock.)

@alesancor1
Copy link
Member Author

alesancor1 commented Sep 16, 2025

I believe the reason we made the title require a minimum length of 2 is because the store rejects items with a title length of 1.

Adding to this, the snap store does have a declaration for the title and seems to allow single character titles, but not names. (https://git.launchpad.net/review-tools/tree/reviewtools/schemas/snap.json)

When looking for that, I couldn't find that declaration, but I did find that the store will reject rocks with a single-character name (https://git.launchpad.net/review-tools/tree/reviewtools/schemas/rock.json), which perhaps means we should rethink canonical/rockcraft#957?

I believe the main issue is Rockcraft setting the title equal to the name when title is not set. I believe that title is required in Snapcraft (please confirm).

At this point trying to to set title required in Rockcraft would introduce a major regression (all rocks would fail upon rebuild), while setting the name min characters to 2 in craft-application may affect Snapcraft. We can do so only for Rockcraft but doesn't really feel right to add a store limitation to the tool, as they are not necessary linked to each other.

We could think about adding a -rock suffix to the title in Rockcraft when title is not set. Though doesn't feel right to me in terms of UX.

Lmk your thoughts

@lengau
Copy link
Collaborator

lengau commented Sep 18, 2025

I believe the main issue is Rockcraft setting the title equal to the name when title is not set.

Well this is why I think it's worth revisiting canonical/rockcraft#957 - even if the user explicitly sets the title, a single-character name is something that'll be rejected by the store. So Rockcraft should be requiring a name of at least 2 characters, in line with canonical/rockcraft#943. In fact, it might be a bug in snapcraft that it allows single-character names since the store will always reject them

I believe that title is required in Snapcraft (please confirm).

The title field isn't required in any craft, though it is recommended in most.

At this point trying to to set title required in Rockcraft would introduce a major regression (all rocks would fail upon rebuild), while setting the name min characters to 2 in craft-application may affect Snapcraft.

Correct, but that's part of why I'm being such a stick-in-the-mud about this single-byte change. :-) The values here are supposed to represent the loosest definition of what would be appropriate for a future craft, but existing crafts can diverge from this standard in both direction if they must. I'm not opposed to loosening the requirements for titles in principle, but I need to determine why it was set this way to begin with, and unfortunately the guy who put that constraint into this code (me) didn't leave me any clues.

On the flip side, making the name length in Rockcraft match what the review tools require (length of 2) before the next release, wouldn't be a breaking change (it would still be looser than the current requirement of 3). So that's probably a better solution in the short term while we carefully consider this change across a variety of crafts. I made a PR to that effect here: canonical/rockcraft#972

lengau added a commit to canonical/rockcraft that referenced this pull request Sep 18, 2025
This is my solution to the impasse in
canonical/craft-application#894

ROCKS-2421

Signed-off-by: Alex Lowe <alex.lowe@canonical.com>
@lengau lengau added the Status: Needs information This issue needs more information. label Sep 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Needs information This issue needs more information.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants