The GitHub Actions job "Required Checks" on texera.git/gh-readonly-queue/main/pr-6612-42027e8c38d248a60cab32871887bc754ef311b5 has succeeded. Run started by GitHub user aglinxinyuan (triggered by aglinxinyuan).
Head commit for run: 3a671c31ffe7f5a48da5b2e98841b0d55e176acc / Prateek Ganigi <[email protected]> fix(computing-unit): return 404 instead of 500 when getOwner is called for a nonexistent unit (#6612) ### What changes were proposed in this PR? ComputingUnitAccessResource.getOwner (GET /access/computing-unit/owner/{cuid}) threw a plain IllegalArgumentException when the requested unit didn't exist: if (unit == null) { throw new IllegalArgumentException("Computing unit does not exist") } The service registers no ExceptionMapper for IllegalArgumentException (only UnauthorizedExceptionMapper), so it fell through to Dropwizard's default LoggingExceptionMapper and surfaced as an opaque HTTP 500 rather than a proper client error. This PR throws jakarta.ws.rs.NotFoundException instead, so a nonexistent unit now returns a 404. This is the same unmapped-exception→500 pattern fixed for grantAccess/revokeAccess in #6446; getOwner was outside that PR's diff. The choice of 404 and the message style match the same-service convention in ComputingUnitManagingResource (throw new NotFoundException(s"Computing unit with cuid=$cuid does not exist.")). Note: getOwner also dereferences userDao.fetchOneByUid(uid).getEmail without a null-check. That path is unreachable in practice, workflow_computing_unit.uid is REFERENCES "user"(uid) ON DELETE CASCADE, so a unit cannot outlive its owner, so it's intentionally left out of this focused fix and tracked with the broader coverage work in #6490. ### Any related issues, documentation, discussions? Closes #6475 ### How was this PR tested? Added a getOwner test to ComputingUnitAccessResourceSpec (embedded Postgres via MockTexeraDB, reusing the wiring from #6446) that requests a nonexistent cuid and asserts the JAX-RS NotFoundException and its resolved 404 status: "getOwner" should "reject a nonexistent computing unit with a 404 instead of crashing" in { val ex = intercept[NotFoundException] { accessResource.getOwner(ownerSession, nonExistentCuid) } ex.getResponse.getStatus shouldEqual 404 ex.getMessage should include(s"Computing unit with cuid=$nonExistentCuid does not exist") } Verified red→green: against the old IllegalArgumentException the test fails with "Expected exception jakarta.ws.rs.NotFoundException … but java.lang.IllegalArgumentException was thrown"; after the fix all 9 tests in the spec pass. Scalafmt clean. Run: sbt "ComputingUnitManagingService/testOnly org.apache.texera.service.resource.ComputingUnitAccessResourceSpec" ### Was this PR authored or co-authored using generative AI tooling? Co-authored with Claude Opus 4.8 in compliance with ASF. Report URL: https://github.com/apache/texera/actions/runs/29772781934 With regards, GitHub Actions via GitBox
