Skip to content

Conversation

abhishekmadan30
Copy link
Contributor

Makes an exception be thrown if a route contains a "/" and added tests for it. Closes #254

@abhishekmadan30 abhishekmadan30 requested a review from a team as a code owner July 17, 2025 19:49
@abhishekmadan30 abhishekmadan30 requested a review from ahal July 17, 2025 19:49
Copy link
Contributor

@hneiva hneiva left a 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.

if route.startswith(route_prefix):
# Check for invalid characters in the route
if "/" in route:
print(f"DEBUG: Found slash in route: {route}")
Copy link
Contributor

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

Copy link
Contributor

@hneiva hneiva left a 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

Copy link
Contributor

@bhearsum bhearsum left a 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.)

@bhearsum
Copy link
Contributor

Excellent work, thank you!

@bhearsum
Copy link
Contributor

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.


for route in routes:
# Check for invalid / in the route
if "/" in route:
Copy link
Collaborator

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.

Copy link
Collaborator

@ahal ahal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ahal ahal force-pushed the add-exception-for-slash-in-route branch from fca7df2 to e449dae Compare July 18, 2025 15:47
@ahal ahal enabled auto-merge (rebase) July 18, 2025 15:48
@ahal ahal requested review from hneiva and removed request for hneiva July 18, 2025 18:44
@ahal ahal merged commit 4cae05e into taskcluster:main Jul 18, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

taskgraph should raise and exception if index routes have a / in them
4 participants