-
Notifications
You must be signed in to change notification settings - Fork 391
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
function of validateRegex in repoproviders #1920
Comments
the validation for gists appears to be missing a |
The original goal for putting them in the API and doing this in the frontend was to support URL parsing in other frontends, such as jupyterhub-fancy-profiles so they can have compatible URLs. I also want to explore a potentially different model for federation where the frontend makes routing choices, both for better resilience and the ability to credit federation members better. So the frontend app would be a separate app that simply talks to binderhub almost on API only mode. This is how I had actually written it, and only had to add the provider specific handlers back to support opengraph cards and couldn't see a way to do it without that :( I also felt that one of the reasons the frontend got complicated last time was because it got a little more entangled than I'd like, between the frontend and the backend. So, I agree that we should try to consolidate all routing in one place. However, my preference is that we consolidate that all in the frontend. In the longer run, I want us to do a So here are what I think are possible paths forward:
Happy for you to actually take any of these paths forward @minrk! |
Thanks for writing down your goals! That makes a lot of sense. I'm not 100% sure I know precisely what you mean by 'routing', but I'm going to take it to mean the URL/path handling, which is done in the React Router, but also the tornado Handler list. If I've understood correctly, it's actually not the backend routing (splitting on provider id) that I see a problem with, but rather the restrictive spec parsing in I see a substantial difference between the two error URLs: but right now, both are treated the same: HTTP status 200, rendering a 404 page, which is not ideal. Removing If we remove So my inclination based on what I can see so far is to take option 3 and remove I think the detect regex serves a more clearly useful purpose, and should stick around (though I fully share your v3 goal of moving URL->builder to the server side without any regexes). |
After writing all that, I'm actually okay with keeping I see that there is an error message using validateRegex in LoadingPage, but I'm pretty sure this condition can never be triggered, specifically because LoadingPage is prohibited from handling a page that doesn't match Here is what a user sees for the 3 cases, visiting the invalid
![]()
![]()
![]() The backend clearly has the best chance to present a useful error, because it can run arbitrary code to prepare the error message in a provider-specific and mistake-specific way. The frontend can only present either a totally uninformative error, or make understanding regular expressions the user's problem (we could address this with an additional invalidSpecMessage field to present, instead of showing the regex to the user). WDYT about these two choices, now:
|
repoproviders have a
validateRegex
field, which can apparently be used in the frontend to validate specs. This means specs are validated twice: once in the frontend for rendering purposes, and a second time with a different implementation for actual build errors. But since these implementations are not shared, different invalid specs may present differently.As it is, the result is some inconsistency in handling different invalid specs:
As far as I can tell, validateRegex is used exclusively for react page routing. I think the error messages from server-side resolving is clearer, so I propose removing validateRegex, and replace the per-provider
?<buildSpec>
regex here with?<buildSpec>.+
? I think that would result in more consistent error handling and clearer error messages, because there would be only one source of errors.Does that make sense @yuvipanda ? Is there another use for the duplicate validateRegex I'm missing?
The text was updated successfully, but these errors were encountered: