The GitHub Actions job "Release Auditing" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
8f30d823fbb96e9ad2921063cb506f4c86e7b72a / Shawn <[email protected]>
fix(amber): return 404 for unavailable public workflow (#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)

Report URL: https://github.com/apache/texera/actions/runs/40493741115

With regards,
GitHub Actions via GitBox

Reply via email to