Skip to content

Fix #23445: User with Owner role unable to update Incident Status via API - #23448

Merged
ShaileshParmar11 merged 15 commits into
mainfrom
issue-23445
Sep 26, 2025
Merged

ShaileshParmar11 merged 15 commits into
mainfrom
issue-23445

Conversation

@harshach

Copy link
Copy Markdown
Collaborator

… API

Describe your changes:

Fixes

I worked on ... because ...

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

@harshach
harshach requested a review from a team as a code owner September 17, 2025 22:52
@github-actions github-actions Bot added backend safe to test Add this label to run secure Github workflows on PRs labels Sep 17, 2025
TeddyCr
TeddyCr previously approved these changes Sep 18, 2025
@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@ShaileshParmar11
ShaileshParmar11 merged commit aa7715b into main Sep 26, 2025
@ShaileshParmar11
ShaileshParmar11 deleted the issue-23445 branch September 26, 2025 09:41
@github-project-automation github-project-automation Bot moved this to Done ✅ in Roadmap Sep 26, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Failed to cherry-pick changes to the 1.9.11 branch.
Please cherry-pick the changes manually.
You can find more details here.

Ahmad986Ferdaws pushed a commit to Ahmad986Ferdaws/OpenMetadata that referenced this pull request Sep 5, 2026
…ead of a 500 (open-metadata#32492)

* fix(dq): return 404 from the incident-status by-id endpoints instead of a 500

EntityTimeSeriesRepository.getById answers a missing row with null. Both the
read and the patch handler on TestCaseResolutionStatusResource dereference that
record to resolve the test case their authorization check is scoped to, so an id
with no row threw a NullPointerException that the exception mapper rendered as a
500:

  Cannot invoke "TestCaseResolutionStatus.getTestCaseReference()"
  because "testCaseResolutionStatus" is null

The dereference arrived with open-metadata#23448, which replaced the static authorize call
with a data-driven one; before that the handler returned the null straight out
and a missing row was simply an empty body.

Two ids are in play on this resource: the record id on /{id} and the incident
stateId on /stateId/{stateId}. TestCase.incidentId carries the stateId, so any
client that feeds it to the by-id endpoint misses the record table every time
and takes the 500 rather than a 404 it could handle.

Resolve the record through one helper that throws EntityNotFoundException, and
document the 404 on the operation so the generated spec matches.

Leaves EntityTimeSeriesRepository.getById returning null: eight other resources
call it and some callers depend on the null.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013D3LpP12bP6RBF2tFo5Rmn

* refactor(dq): move the not-found guard onto EntityTimeSeriesRepository

The guard belongs in the layer that produces the null, not in one resource.
getByIdOrNotFound sits next to getById, builds its message from the repository's
own entityType through CatalogExceptionMessage, and is available to every
time-series resource that has to dereference the record it just read —
QueryCostResource.get has the same unguarded dereference today.

patch keeps its own inline check rather than routing through this. It reads the
raw JSON and deliberately skips setInheritedFields; going through getById would
populate testCaseReference on the original and change what the patch diff sees.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013D3LpP12bP6RBF2tFo5Rmn

* test(dq): cover the PATCH by-id 404 alongside GET

The PATCH handler resolves the record through the same getByIdOrNotFound guard,
so it regresses to the same 500 if that guard is dropped, but only GET was
asserted. Both new cases fail with 500 when the guard is removed from the
handler.

An empty patch is enough: the record is resolved, and the 404 thrown, before the
patch is applied.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013D3LpP12bP6RBF2tFo5Rmn

* fix(query): return 404 from the query-cost by-id endpoint instead of a 500

QueryCostResource.get has the same defect the incident-status handler had: it
reads the record with getById, which answers a missing row with null, then
dereferences it at costRecord.getQueryReference().getId() to scope the
authorization check. An id with no row was a NullPointerException rendered as a
500.

Route it through the getByIdOrNotFound guard added for the incident-status
handlers, and document the 404 on the operation.

Also renames the path-param variable from testCaseResolutionStatusId to id. The
handler was copied from TestCaseResolutionStatusResource and kept the original
name; the wire contract is unaffected since the @PathParam value is already
"id".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013D3LpP12bP6RBF2tFo5Rmn

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
test — 28def201 Deployed Sep 26, 2025 by ShaileshParmar11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch

Projects

Status: Done ✅

Development

Successfully merging this pull request may close these issues.

5 participants