-
Notifications
You must be signed in to change notification settings - Fork 47
Check for slash in route #722
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
Check for slash in route #722
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor change, but LGTM otherwise.
src/taskgraph/util/verify.py
Outdated
if route.startswith(route_prefix): | ||
# Check for invalid characters in the route | ||
if "/" in route: | ||
print(f"DEBUG: Found slash in route: {route}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use logger.debug
or logger.error
instead of print
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, didn't notice tests are failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start, but it only covers the subset of cases that have the trust domain or notification prefixes. Eg: if you add a test with some other route, I expect it fail (I encourage you to add this before addressing the problem to double check me!).
Because this is meant to be a general check, you should add a brand new function with the verifications.add("full_task_graph")
decorator, and check all routes. (Which means you'll be able to remove the checks you added to the existing decorators.)
Excellent work, thank you! |
Ah; it looks like the checks I had to approve to run caught a linting issue. Once that's fixed we can get this merged. |
src/taskgraph/util/verify.py
Outdated
|
||
for route in routes: | ||
# Check for invalid / in the route | ||
if "/" in route: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late request.. but it just occurred to me that only index routes can't have a slash. Routes in general are allowed to have a slash.
So we should change this to if route.startswith("index.") and "/" in route:
. Also updating the function name to verify_index_routes..
or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
fca7df2
to
e449dae
Compare
Makes an exception be thrown if a route contains a "/" and added tests for it. Closes #254