ShawnGarello opened a new pull request, #9061:
URL: https://github.com/apache/texera/pull/9061
### 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.
`retrievePublicWorkflow` dereferenced the row from `fetchOne()` without a
null check. It now answers 404, the same guard `getWorkflowType` already 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
a `NullPointerException` stack trace.
Two regression tests in `WorkflowResourceSpec`, under their own
`retrievePublicWorkflow` subject: 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 on `release/v1.3` and
`release/v1.2`, but the code after it differs there (no `publicCopyOf`), so the
cherry-pick may need the guard re-applied by hand. `WorkflowResourceSpec.scala`
exists on both branches.
### How was this PR tested?
With Postgres up, `sbt -batch "WorkflowExecutionService/testOnly
*WorkflowResourceSpec"`:
1. Red: the first commit adds only the two tests. 79 pass, 2 fail: exactly
those two, each with a `NullPointerException` instead of `NotFoundException`.
2. Green: with the guard, 81 pass, 0 fail (run twice). `testOnly
*WorkflowResourceSpec *WorkflowPublishSpec` (the other spec that calls the
method): 135 pass, 0 fail.
3. With only the guard reverted, exactly the two new tests fail again with
`NullPointerException`.
4. `sbt scalafmtCheckAll "scalafixAll --check"` is clean.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5.5)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]