-
Notifications
You must be signed in to change notification settings - Fork 131
Registry package name limitations are also applied to local packages #1086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Happy to make a PR some time this week if it's an unintentional change. The 50 character limit for published packages feels legit but I could break the parser into local and remote versions. |
Thanks for reporting! I had no suspicion whatsoever that this would ever be an issue, and yet 😄 I am a bit hesitant to split the types that Spago uses from the Registry ones, especially the |
@finnhodgkin what's the longest package name you have? |
150 characters 🙈 |
I think the limit was chosen arbitrarily and could be raised. But it seems to me the more correct thing to do would be to allow local package names to be arbitrarily long. Elsewhere in the registry we use wrapper types like Perhaps you could take a similar approach in Spago. We could update the package name parser in the registry to return a structured error: data PackageNameError = TooLong Int | InvalidChar String | ...
printPackageNameError :: PackageNameError -> String
parse :: String -> Either PackageNameError PackageName Then, we can do two things. First, we can return a better parse error in the registry when a name is too long (instead of just "unexpected value"). Second, Spago can create a new This keeps Spago using the parser from the registry in general but allows some leniency for local packages, which don't have to have the same restrictions applied in the registry. Just a thought. I don't want to start relaxing restrictions on the registry types to satisfy quirks in local packages if we can help it. |
I don't think that should be allowed - there's not much point to a 4KB long package name. The reason why I'm not eager to split off the |
I don't really know what the limit should be — crates.io uses 64 characters, as one data point — I just know we need some limit. We can change it to 128 characters, that's fine with me. |
And npm uses 214 chars (funnily enough they started with 50 as well). Let's do 128 and pour some concrete in there 😄 |
Why not do 150 characters? It's not much more and doesn't cause any more work for the @finnhodgkin above. |
Sure, that works too! |
Either works for us, thanks! Bit cheeky of me to pop up and say 'we've got some funky codegen that produces ridiculously long names, can spago be the one to change?'. Really the only part that was a pain was working out where the issue actually came from. The parser error is ignored by spago, plus comes from a different repo so searching '50' or the error message doesn't work.
Also because the json parser is second in the
|
@finnhodgkin ah yes that makes sense. I think our codecs could do with some improvement and better error reporting (see #1057 as well) |
Legacy spago didn't have length validation on local package names, whereas spago@next has a strict 50-character limit.
Unfortunately in the project I'm migrating we have a bunch of generated libraries with really long names like
oa-gql-enums-author-field-response-versions-select-column
. It wouldn't be the end of the world if we had to cut the names down or merge the generated libraries, but it feels like an arbitrary limit for unpublished local packages.Seems to be caused by the spago.yaml being read using the parser from registry-dev:
Spago config parser
Registry name parser
Other than this the migration was going great, I'm really loving the new workspace features! 🎉
Minimal example:
Results in:
The text was updated successfully, but these errors were encountered: