OpenFn / lightning

OpenFn/Lightning ⚡️ is the newest version of the OpenFn DPG and provides a web UI to visually manage complex workflow automation projects.
https://openfn.github.io/lightning/
GNU Lesser General Public License v3.0
119 stars 32 forks source link

Render 404 page when no workflow snapshot is found #2272

Open elias-ba opened 2 weeks ago

elias-ba commented 2 weeks ago

When visiting the workflow edit page, one can pass a URL parameter to control the loaded snapshot version. That parameter is v, and it expects a positive integer value. That value is then queried in the database to find the associated workflow snapshot. When no snapshot is found, the app crashes. Instead of the app crashing we should return a 404 page.

christad92 commented 2 weeks ago

@elias-ba My recommendation for this will be to default to the latest version of the workflow rather than showing the user a 404 page. The users don't know about the lock version and showing them a 404 does not help them debug the issue.

elias-ba commented 2 weeks ago

@christad92 good point, but the only reason why I still think it's a 404 is because all of this is happening thru the URL. If we decide to default to the latest version we would be deciding to serve the user something they didn't order at all. It looks to me like I order a Bouye, and you don't have a Bouye and you serve me a Vodka. The muslim of me would be very angry 😆. Anyway I really think when the user types a non existent lock_version we should just say no ressource is associated to this URL. @taylordowns2000 @stuartc what you guys think ?

taylordowns2000 commented 2 weeks ago

Agreed. Forgetting costs for a second and trying to bring together some valid points from Stu, Elias, and Ayo:

  1. Parameters are never required. They're optional and additive. If the base URL exists, then load something and don't throw a 404.
  2. If an invalid parameter is added, it's often ignored (e.g., s="123" where there is no job "123" to show should load the canvas with no open panel.)
  3. In this particular case, if you want the workflow with snapshot "14" and there is none, we should either
    • make the snapshot part of the URL, not a parameter (I don't think we want to do this) then show a 404
    • or load the canvas and show a little modal that says, "We can't find a version 14 of this workflow. Click here to view the latest"

Either way, i'd put this fairly low on the backlog