Skip to content
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

Validate request paths routing when submitting a new job #72

Open
Manfred opened this issue Nov 8, 2019 · 4 comments
Open

Validate request paths routing when submitting a new job #72

Manfred opened this issue Nov 8, 2019 · 4 comments

Comments

@Manfred
Copy link
Collaborator

Manfred commented Nov 8, 2019

  • As a user I want to see an error when I try to create a job with request paths that are not matched by the target application routes.

Show validation error for the request path that doesn't route.

@Manfred
Copy link
Collaborator Author

Manfred commented Nov 9, 2019

Routes are defined in Ruby source so people are prone to include lots of ‘necessary’ code to do all sorts of perverted things with routes. Loading a lean process that recognizes routes is almost impossible. The least amount of work is to run code using rails runner.

echo "JSON.dump(Rails.application.routes.recognize_path('/sessions/new'))" | rails runner -

Another solution could be to write a little Rack server that accepts a POST with a route and returns the matched route, we can keep that running on the master branch. This is also useful for querying other details about the target application.

@sudara
Copy link
Member

sudara commented Nov 9, 2019

The least amount of work is to run code using rails runner.

Doesn't rails runner take a fairly long time to run on the target app? Are you imagining this happening in the request cycle?

Would it be possible to run something in a job every 15 min and cache a full json dump of available routes?

I like this kind of UI assistance/guidance, but wondering if we should "aim low" on this feature, given there's risk that

  1. people will introduce new routes on a branch
  2. those new routes won't be able to be validated without a pretty big delay with a new call out to routes on the feature branch

Perhaps we can just provide confirmation against a master cache/process (✅ route recognized from recent master) that a route is accepted but if it's not confirmed, still allow the job to proceed but display a warning (❔ route not recognized on recent master)

That would mean the feature would be useful 90% of the time without interrupting the 10% where it's a newer / recent / feature branch route.

@Manfred
Copy link
Collaborator Author

Manfred commented Nov 9, 2019

Perhaps we can just provide confirmation against a master […]

Yes, that's probably better than blocking the job entirely.

@Manfred
Copy link
Collaborator Author

Manfred commented Nov 10, 2019

Doesn't rails runner take a fairly long time to run on the target app?

It only has to load the bundle and boot the app when you're running this in development mode. So it would take anywhere between a few seconds to a minute. It's probably best to create a little service for this.

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

No branches or pull requests

2 participants