Repository navigation
fix(amber): return 404 for unavailable public workflow - #9061
Open
ShawnGarello wants to merge 2 commits into
Open
ShawnGarello wants to merge 2 commits into
ShawnGarello wants to merge 2 commits into
Conversation
retrievePublicWorkflow dereferenced the row from fetchOne() without a null check, so a wid that does not exist or names a private workflow answered 500 with a NullPointerException. It now throws NotFoundException (404), the same guard getWorkflowType already has. Closes apache#8139 Generated-by: Claude Code (Opus 5.5)
Author
|
/request-review @Yicong-Huang |
Contributor
Backport auto-label reportThis
|
Contributor
Automated Reviewer SuggestionsBased on the
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Opening a hub link to a workflow that was deleted or made private makes
GET /api/workflow/publicised/{wid}fail with a 500.retrievePublicWorkflowdereferenced the row fromfetchOne()without a null check. It now answers 404, the same guardgetWorkflowTypealready has. A private workflow gets the same 404 as a missing one, as the query (wid = ? AND is_public) already treats them alike. The hub page shows the same load error either way; what changes is the status code, and the server log no longer gets aNullPointerExceptionstack trace.Two regression tests in
WorkflowResourceSpec, under their ownretrievePublicWorkflowsubject: a private workflow, and a wid that does not exist. The public case is already covered by the makePublic and default-view tests.This picks up #8140 by @carloea2, which was closed unmerged; it applies the review on that PR (braces, the test under its own subject, the title).
Any related issues, documentation, discussions?
Closes #8139
Backport: the same unguarded
fetchOne()is onrelease/v1.3andrelease/v1.2, but the code after it differs there (nopublicCopyOf), so the cherry-pick may need the guard re-applied by hand.WorkflowResourceSpec.scalaexists on both branches.How was this PR tested?
With Postgres up,
sbt -batch "WorkflowExecutionService/testOnly *WorkflowResourceSpec":NullPointerExceptioninstead ofNotFoundException.testOnly *WorkflowResourceSpec *WorkflowPublishSpec(the other spec that calls the method): 135 pass, 0 fail.NullPointerException.sbt scalafmtCheckAll "scalafixAll --check"is clean.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5.5)