What is the appropriate length for a title? @chipaca mentioned in a PR https://github.com/snapcore/snapcraft/pull/2412#discussion_r235383825 that it should probably be 64 bytes by reading an implementation (and not the actual string length). Is that appropriate and do we want to settle on that? I would personally much prefer for it to be string length to have more of a user friendly error when exceeded
Getting the following folks into the loop explicitly as they have existing implementations:
@jdstrand what are you doing for the review tools?
The storeâs current limit is 64 âmaximum length (in characters)â. Note this is characters, not bytes; for instance, I set the title for a snap to a 64-character string that encodes in 192 bytes and it was accepted.
Weâve just had a conversation here at the sprint, and looked at the list of long titles currently in the store. My recommendation given that conversation and the screenshots above is to cut out at 40 characters. The store should reject anything above it, and clients should truncate with ââŠâ at the end, so that we donât break any existing snaps. There are less than 100 entries above that limit in the store, and itâs almost entirely consisting of test cases and bogus snaps. The 2 or 3 cases which are not test cases or very bad titles could easily be reduced under that limit.
Please, and at the risk of teaching peopleâs grandmothers to suck eggs, if you make bugs / tasks based on this, and your client (or at least its validator suite) is written in javascript, note that 40 unicode characters is not just the length of the thing; javascript strings are utf16 and the length indicates as much. Instead of str.length you want [...str].length:
having that logic in snapd is hard right now: we have a single validation codepath for both âpackâ and âinstallâ, and what youâre saying (if I understood it correctly) is that âpackâ should fail to validate titles longer than 40 runes long, but install / info / etc should truncate it.
The suggestion was for pack to remain as-is but the store would reject new entries with excessive titles, but thinking further about it, maybe we should make both snapd and the store reject it, because until this week an upload of a snap with a title of any length at all would be flagged for manual review, and @jdstrand was surprised that the field even existed. That implies to me that we donât have snaps being uploaded with titles yet, and the titles are showing up via the UI in the store which comes into snapd via a different path.
So, @jdstrand, can we please reject any titles with more than 40 characters at review time?
Then, with snapd rejecting it at install/pack time as well, we shouldnât have any hardcoded titles like that. Then itâs just a matter of fixing the UI and APIs to reject it, so that it doesnât come into snapd via the store API.