You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "PG1204 (via GitHub)" <gi...@apache.org> on 2026/07/20 18:46:48 UTC
[PR] fix(computing-unit): return 404 instead of 500 when getOwner is called for a nonexistent unit [texera]
PG1204 opened a new pull request, #6612:
URL: https://github.com/apache/texera/pull/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.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(computing-unit): return 404 instead of 500 when getOwner is called for a nonexistent unit [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #6612:
URL: https://github.com/apache/texera/pull/6612#issuecomment-5025935172
<!-- texera-reviewer-suggestion -->
### Automated Reviewer Suggestions
Based on the `git blame` history of the changed files, we recommend the following reviewers:
- No candidates found from `git blame` history.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(computing-unit): return 404 instead of 500 when getOwner is called for a nonexistent unit [texera]
Posted by "PG1204 (via GitHub)" <gi...@apache.org>.
PG1204 commented on PR #6612:
URL: https://github.com/apache/texera/pull/6612#issuecomment-5025950340
/request-review @Ma77Ball
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(computing-unit): return 404 instead of 500 when getOwner is called for a nonexistent unit [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6612:
URL: https://github.com/apache/texera/pull/6612#issuecomment-5025964582
## [Codecov](https://app.codecov.io/gh/apache/texera/pull/6612?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 73.99%. Comparing base ([`c543d77`](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8a3b1a3`](https://app.codecov.io/gh/apache/texera/commit/8a3b1a30112a66c82b23e44763342325d7ddeb09?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #6612 +/- ##
=========================================
Coverage 73.99% 73.99%
Complexity 3435 3435
=========================================
Files 1157 1157
Lines 45621 45621
Branches 5031 5031
=========================================
Hits 33757 33757
Misses 10184 10184
Partials 1680 1680
```
| [Flag](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
|---|---|---|---|
| [access-control-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.00% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [agent-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `76.76% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [amber](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.79% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `17.72% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [config-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.66% <ø> (ø)` | | |
| [file-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `66.80% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [frontend](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.12% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `78.94% <ø> (ø)` | | |
| [pyamber](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `91.79% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/6612/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.14% <ø> (ø)` | | Carriedforward from [c543d77](https://app.codecov.io/gh/apache/texera/commit/c543d7796a027382828648826266a0e45232934c?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/6612?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(computing-unit): return 404 instead of 500 when getOwner is called for a nonexistent unit [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #6612:
URL: https://github.com/apache/texera/pull/6612
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org