Skip to content

Fixes #26521: Decouple Incident Manager Permissions from Test Case Edit Permissions - #32074

Merged
TeddyCr merged 6 commits into
mainfrom
agent/issue-26521
Sep 3, 2026
Merged

TeddyCr merged 6 commits into
mainfrom
agent/issue-26521

Conversation

@TeddyCr

@TeddyCr TeddyCr commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

This pull request was opened by an olivaw agent. It is an input to review, not an approved change — read the diff, not this description.

Fixes #26521

What olivaw checked (machine-observed, §8.2/A.1)

  • diff: non-empty
  • build: not_run
  • tests: not_run
  • base: 7a64474afafab92e2550ee2c97d4a7d0e0a3da47
  • head: 44ce2099e3da39bbbb9617af0792a4ed6f179524

No build or test command is configured for this workspace, so only the diff's existence was checked. Set run_config.build_cmd/test_cmd to have olivaw verify its own work.

What the agent says it did (unverified)

Committed on agent/issue-26521.

What the problem was

Incident Manager writes were gated on test case edit rights in three places:

  • TestCaseResource.getEntitySpecificOperations() returned null, so the testCase resource descriptor never advertised EditStatus. The UI's getPrioritizedEditPermission(perm, Operation.EditStatus) (already used by the incident page header) therefore never found the key and silently fell back to EditAll (PermissionsUtils.ts:123).
  • TestCaseResolutionStatusResource.buildEditAuthRequests() only accepted EditTests/EditAll on table or test case.
  • TaskRepository.addIncidentEditRequests() — the fallback for the task-first assign/reassign/status transitions — had the same pair.

The fix

EditStatus becomes the Incident Manager grant on testCase:

Backend

  • TestCaseResource.java:124 — declare EDIT_STATUS as an entity-specific operation (same pattern PipelineResource uses).
  • TestCaseResolutionStatusResource.java:842 — accept (TEST_CASE, EDIT_STATUS) in the edit auth requests (severity PATCH, incident create, bulk).
  • TaskRepository.java:1055 — same for the incident-task transition fallback, which covers status changes and assignment.

Frontend

  • IncidentManagerTable.component.tsx — status, severity and assignee cells now go through a hasIncidentEditPermission helper using EditStatus instead of raw EditAll.
  • DataQualityTab.tsx:501 — incident status cell likewise.

The incident detail header already used EditStatus/EditOwners; it now actually resolves rather than falling back.

Backward compatible: CompiledRule.matchesBySubsumption treats EditAll as covering every Edit* operation, so existing EditAll roles are unaffected. Net result — a policy of testCase: [ViewAll, EditStatus] gives read-only test cases plus full incident status/severity/assignment.

Added TestCaseResolutionStatusAuthRequestsTest asserting EditStatus is among the accepted incident-write operations.

Verification caveat: I could not build or run tests in this environment — Maven has no network/local repo (jetty-bom, junit-bom etc. unresolvable offline) and the UI node_modules is empty, so jest, tsc, eslint and spotless were all unavailable. The changes were checked by inspection against the surrounding formatting conventions (formatJavadoc is off in the spotless config, max-len for comments is 120), and I confirmed the existing UI test mocks set EditAll: true without EditStatus, so they still pass through the EditAll fallback.

Greptile Summary

The PR separates Incident Manager actions from general test-case editing by introducing EditStatus consistently across backend authorization and frontend controls.

  • Advertises EditStatus as a test-case-specific operation.
  • Accepts it for incident status, severity, assignment, and task-transition authorization while preserving legacy edit grants.
  • Updates incident controls to use the prioritized permission helper.
  • Adds focused authorization-request tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java Adds EditStatus to the incident task fallback while retaining existing test-case and underlying-entity grants.
openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResolutionStatusResource.java Extends incident-write authorization to accept test-case EditStatus.
openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java Registers EditStatus as an entity-specific test-case operation for permission discovery.
openmetadata-ui/src/main/resources/ui/src/components/IncidentManager/IncidentManagerTable.component.tsx Gates status, severity, and assignee controls through the prioritized EditStatus permission.
openmetadata-ui/src/main/resources/ui/src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx Uses the prioritized EditStatus permission for inline incident status changes.
openmetadata-service/src/test/java/org/openmetadata/service/jdbi3/TaskRepositoryIncidentAuthRequestsTest.java Verifies the task fallback includes EditStatus and retains legacy grants.
openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResolutionStatusAuthRequestsTest.java Verifies incident-write requests accept test-case EditStatus.

Sequence Diagram

sequenceDiagram
  actor User
  participant UI as Incident Manager UI
  participant Permissions as Permission API
  participant Incident as Incident Status Resource
  participant Policy as Policy Evaluator
  participant Task as Incident Task
  UI->>Permissions: Request testCase permissions
  Permissions-->>UI: EditStatus / EditAll
  User->>UI: Change status, severity, or assignee
  UI->>Incident: Submit incident update
  Incident->>Policy: Authorize testCase EditStatus or legacy edit grant
  Policy-->>Incident: Allow
  Incident->>Task: Synchronize incident task transition
  Incident-->>UI: Updated incident
Loading

Reviews (2): Last reviewed commit: "test: cover the task incident EDIT_STATU..." | Re-trigger Greptile

…sions

Managing an incident (status, severity, assignee) required EditTests or
EditAll on the test case, so teams could not grant incident management
alongside read-only access to test cases under Data Observability.

Introduce EditStatus as the Incident Manager grant on the testCase
resource:

- TestCaseResource now advertises EditStatus, so policies can grant it and
  the permissions API returns it to clients.
- TestCaseResolutionStatusResource.buildEditAuthRequests (severity patch,
  incident create/bulk) and TaskRepository.addIncidentEditRequests (the
  task-first status/assign/reassign transitions) accept EditStatus in
  addition to the existing EditTests/EditAll grants.
- The incident list table and the data quality tab gate incident status,
  severity and assignee on EditStatus via getPrioritizedEditPermission
  instead of raw EditAll, matching what the incident page header already
  does.

EditAll subsumes every Edit* operation in the policy engine, so existing
roles keep working unchanged.

Resolves #26521

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 25, 2026 22:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Aug 25, 2026
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 7 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 7 warning(s) across 2 changed file(s).

Count Rule
3 sonarjs/cyclomatic-complexity
2 openmetadata-imports/no-lower-layer-page-imports
1 react-hooks/exhaustive-deps
1 sonarjs/no-duplicate-string
All findings
Location Rule Message
🟡 src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:48:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:137:25 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 18 which is greater than 10 authorized.","cost":8,"secondaryLocations":[{"line":137,"column":24,"endLine":137,"endColum
🟡 src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:334:57 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 11 which is greater than 10 authorized.","cost":1,"secondaryLocations":[{"line":334,"column":56,"endLine":334,"endColum
🟡 src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:455:6 react-hooks/exhaustive-deps React Hook useEffect has missing dependencies: 'collectInlineIncidentStatuses' and 'fetchTestCasePermissions'. Either include them or remove the dependency arra
🟡 src/components/Database/Profiler/DataQualityTab/DataQualityTab.tsx:568:48 sonarjs/cyclomatic-complexity {"message":"Function has a complexity of 16 which is greater than 10 authorized.","cost":6,"secondaryLocations":[{"line":568,"column":47,"endLine":568,"endColum
🟡 src/components/IncidentManager/IncidentManagerTable.component.tsx:34:1 openmetadata-imports/no-lower-layer-page-imports Pages are route-level composition modules. Move the shared implementation/type to a lower layer instead of importing a page from here.
🟡 src/components/IncidentManager/IncidentManagerTable.component.tsx:131:23 sonarjs/no-duplicate-string Define a constant instead of duplicating this literal 3 times.

Fix locally (fast - only checks files changed in this branch):

make ui-checkstyle-changed

@TeddyCr TeddyCr left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/olivaw fix the guitar-bot comment regarding coverage issue on EDIT_STATUS permission

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 67%
67.93% (88465/130212) 51.99% (54415/104657) 53.63% (16658/31057)

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit ca06d4b4b3bca51ce38e4db34f0d6c1ffa0513c3 in Playwright run 33592603907, attempt 1.

✅ 992 passed · ❌ 0 failed · 🟡 4 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 53m 42s

⏱️ Max setup 4m 29s · max shard execution 17m 45s · max shard-job elapsed before upload 21m 59s · reporting 7s

🌐 209.00 requests/attempt · 2.41 app boots/UI scenario · 19.34% common-shard skew

Optimization targets still in progress:

  • Common shard skew was 19.34% (convergence target: at most 15%).
  • Browser traffic was 209 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 2.41 per UI scenario (2525 boots / 1049 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 145 0 0 0 0 0
🟡 Shard chromium-02 157 0 2 0 0 0
✅ Shard chromium-03 159 0 0 0 0 0
🟡 Shard chromium-04 168 0 1 0 0 0
✅ Shard chromium-05 148 0 0 0 0 0
✅ Shard data-asset-rules-01 63 0 0 0 0 0
✅ Shard domain-isolation-01 16 0 0 0 0 0
✅ Shard global-state-01 34 0 0 0 0 0
✅ Shard import-export-01 26 0 0 0 0 0
🟡 Shard ingestion-01 31 0 1 0 0 0
✅ Shard reindex-01 5 0 0 0 0 0
✅ Shard search-01 11 0 0 0 0 0
✅ Shard search-rbac-01 29 0 0 0 0 0
🟡 4 flaky test(s) (passed on retry)
  • Features/DataQuality/ColumnLevelTests.spec.ts › Column Values To Be Not In Set (shard chromium-02, 1 retry)
  • Pages/Entity.spec.ts › Update description (shard chromium-02, 1 retry)
  • Features/DataQuality/TestLibrary.spec.ts › should require supported data types only when OpenMetadata platform is selected (shard chromium-04, 1 retry)
  • Features/DataQuality/DataQuality.spec.ts › Pagination functionality in test cases list (shard ingestion-01, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@TeddyCr TeddyCr left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/olivaw fix the guitar-bot comment regarding coverage issue on EDIT_STATUS permission

@TeddyCr TeddyCr left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/olivaw fix the guitar-bot comment regarding coverage issue on EDIT_STATUS permission

Copilot AI review requested due to automatic review settings September 2, 2026 04:54
@gitar-bot

gitar-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Decouples Incident Manager permissions from test case edit permissions by introducing EditStatus as a test-case-specific operation across backend authorization and frontend controls. Backend changes register EditStatus in TestCaseResource, accept it in TestCaseResolutionStatusResource and TaskRepository incident-edit paths, and frontend controls now gate status/severity/assignee through the prioritized permission helper. Backward compatible via subsumption rules. No issues found.

✅ 1 resolved
✅ Quality: TaskRepository incident-edit fallback path lacks test coverage

📄 openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:1086-1091 📄 openmetadata-service/src/test/java/org/openmetadata/service/resources/dqtests/TestCaseResolutionStatusAuthRequestsTest.java:29-43
The new test only asserts EDIT_STATUS is accepted in TestCaseResolutionStatusResource.buildEditAuthRequests. The parallel change in TaskRepository.addIncidentEditRequests (the task-first assign/reassign/status-transition fallback) is the other code path that grants incident management via EDIT_STATUS and is untested, so a future regression there would ship silently. Add a test asserting EDIT_STATUS on TEST_CASE is among the auth requests produced by the task incident fallback.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It changes authorization behavior for incident management (security-sensitive) and cannot be fully validated here without CI/build/test execution.

Review details

Suppressed comments (1)

openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TaskRepository.java:975

  • The updated Javadoc says the incident fallback allows a non-filer with EditStatus, EditTests or EditAll “on the related entity”, but the implementation only checks EditStatus on the test case (and EditTests/EditAll on both test case and the underlying entity). Please adjust the wording to reflect the actual authorization conditions so it doesn’t mislead future readers/maintainers.
   * <p>For incident-style tasks ({@code TestCaseResolution}, {@code IncidentResolution}) a
   * fallback is permitted: a non-filer user with {@code EditStatus}, {@code EditTests} or
   * {@code EditAll} on the related entity can resolve the task even if the task policy alone would
   * deny — preserving the historical behaviour that test owners can act on incidents, and letting
   * {@code EditStatus} alone grant incident management without test case edit rights. The filer
   * check is intentional:
  • Files reviewed: 7/7 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decouple Incident Manager Permissions from Test Case Edit Permissions

4 participants