Skip to content

fix(amber): return 404 for unavailable public workflow - #9061

Open
ShawnGarello wants to merge 2 commits into
apache:mainfrom
ShawnGarello:fix/public-workflow-404
Open

ShawnGarello wants to merge 2 commits into
apache:mainfrom
ShawnGarello:fix/public-workflow-404

Conversation

@ShawnGarello

Copy link
Copy Markdown

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)

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)
@ShawnGarello

Copy link
Copy Markdown
Author

/request-review @Yicong-Huang

@Yicong-Huang Yicong-Huang added the release/v1.3 back porting to release/v1.3 label Oct 21, 2026
@github-actions
github-actions Bot requested a review from Yicong-Huang October 21, 2026 00:17
@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Oct 21, 2026
@github-actions
github-actions Bot requested review from mengw15 and xuang7 October 21, 2026 00:17
@github-actions

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
✅ release/v1.3 Change detected on this branch — label added; this fix is queued to backport here. @mengw15 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other. Review requested.
✅ release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. @xuang7 decides: approving sends the fix here, removing this label declines it. The merge waits on one or the other. Review requested.

Auto-label run.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @yangzhang75
    You can notify them by mentioning @yangzhang75 in a comment.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engine fix release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public workflow retrieval returns 500 when unavailable

2 participants