Skip to content

Acknowledge an incident from the test case last-run banner - #33809

Merged
anuj-kumary merged 13 commits into
mainfrom
feat/tcd-5-acknowledge-incident
Sep 23, 2026
Merged

anuj-kumary merged 13 commits into
mainfrom
feat/tcd-5-acknowledge-incident

Conversation

@ShaileshParmar11

@ShaileshParmar11 ShaileshParmar11 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes open-metadata/openmetadata-collate#6111

TCD-5, part of epic open-metadata/openmetadata-collate#6074.

Cross-repo link form is deliberate: the tracking issue lives in the Collate repo, and a bare #6111 here would autolink an unrelated issue in this repo.

The last-run banner already showed an open incident — its id, title and status chip — but the only way to acknowledge one was to leave the page for the Incident tab. This adds Acknowledge to the incident strip, and aligns the strip's styling with the design prototype.

Demo

image image image image image image

Type of change:

  • New feature

High-level design:

One transition path, read back before it is published. transitionIncident returns the task, not the TestCaseResolutionStatus the header renders, so applyIncidentTransition in useTestCaseIncidentHeader re-reads the incident with getListTestCaseIncidentByStateId(stateId) and publishes the refreshed status through the existing onIncidentStatusUpdate. Both consumers of the hook — the strip and the header chip — update from that one write, with no page refetch.

handleAcknowledgeIncident is a one-line binding of that helper to { transitionId: 'ack' }; the helper is generic so the remaining transitions (assign, resolve) are a second binding rather than a second implementation.

Permission. The button renders only when the status is New and the caller has EditStatus, read via getPrioritizedEditPermission(permission, Operation.EditStatus) — the same gate the Incident tab uses. Passed down as hasEditStatusPermission from TestCaseDetail and IncidentManagerDetailPage.

Styling now matches the prototype. The status tint moved from the summary block to the banner container so the incident strip can carry its own wash (tw:bg-primary/55); the strip row is vertically centred (tw:lg:items-center); the accent border steps to the 600 token; the incident id is split from the title so the id keeps its mono treatment; New is red rather than grey; and the id separator is a hyphen (INC-9), not an en dash.

Tests:

Use cases covered

  • A test case with a New incident shows Acknowledge on the banner's incident strip.
  • Clicking it transitions the incident to Acknowledged, updates the strip chip and the page-header chip, and hides the button — no page refetch.
  • The button is absent for non-New statuses (Ack, Assigned, Resolved).
  • The button is absent without EditStatus permission.
  • All five banner states keep their existing colour, label and reason text after the restyle.

Unit tests

  • Added/updated unit tests for the new logic.
  • Files: IncidentManagerPageHeader/TestCaseLastRunBanner.test.tsx, IncidentManagerPageHeader/useTestCaseIncidentHeader.test.tsx
  • jest src/components/DataQuality/IncidentManager/IncidentManagerPageHeader → 42 passed, 4 suites
  • Coverage on the changed folder: 94.98% stmts / 78.24% branch / 94.77% lines; IncidentDetails.component.tsx and TestCaseLastRunBanner.constants.ts 100%, useTestCaseIncidentHeader.ts 90.37%.

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Added E2E coverage.
  • File: playwright/e2e/Features/DataQuality/TestCaseDetailsPage.spec.ts — new describe Test Case Details Page - Incident strip, test acknowledges the incident from the failed run banner. Seeds a failed run, polls testCaseIncidentStatus until the incident opens, asserts the New chip, clicks Acknowledge against POST /api/v1/tasks/{id}/resolve, then asserts Acknowledged on the strip, Ack on the header chip, and the button hidden.
  • Run: 4 passed (2.2m).

Manual testing performed

  1. yarn start against a local backend, AI app mode on.
  2. Opened /test-case/sample_data.ecommerce_db.shopify.dim_address.diff_columns — a test case with a New incident.
  3. Red banner renders with INC-<n>, its title, a red New chip and Acknowledge.
  4. Clicked Acknowledge → strip chip becomes Acknowledged, the page-header chip becomes Ack, the button disappears, no reload.
  5. Reopened the same page — the button stays hidden for the now-acknowledged incident.
  6. Compared all five banner states against the design prototype with getComputedStyle on both; remaining deltas are design-token quantisation (radius 14→12, tile 44→40, 13px→12px), not layout.

UI screen recording / screenshots:

TODO: attaching the recording before marking this ready for review.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR is linked to a GitHub issue via Fixes above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable, no schema change.
  • For UI changes: I attached a screen recording and/or screenshots above.
  • I have added tests (unit / Playwright) and listed them above.
  • The issue properly describes why the new feature is needed, what's the goal, and how we are building it.
  • I have added tests around the new logic.

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding correctness, security, or repository-rule violations remain.

Summary

This PR adds permission-gated incident acknowledgement to the test-case last-run banner and keeps the banner and header status synchronized after the transition.

  • Adds the acknowledge action for new incidents and refreshes the authoritative incident status after mutation.
  • Preserves an acknowledged fallback when the transition succeeds but status readback fails.
  • Restyles the banner and incident strip using status-specific core Button variants and semantic design tokens.
  • Centralizes incident workflow transition identifiers and adds unit and Playwright coverage.
Diagram
sequenceDiagram
  actor User
  participant Banner as Last-run banner
  participant Hook as Incident header hook
  participant TaskAPI as Task transition API
  participant IncidentAPI as Incident status API
  participant UI as Banner and header state
  User->>Banner: Click Acknowledge
  Banner->>Hook: handleAcknowledgeIncident()
  Hook->>TaskAPI: transitionIncident(stateId, ack)
  TaskAPI-->>Hook: Transition accepted
  Hook->>IncidentAPI: Read updated incident status
  alt Readback succeeds
    IncidentAPI-->>Hook: Authoritative Ack status
    Hook->>UI: Publish refreshed status
  else Readback fails or is empty
    Hook->>UI: Publish Ack fallback
  end
  UI-->>User: Show acknowledged state and hide action
Loading

Reviews (11) · Last reviewed commit: "refactor(incidents): use core Button sta..."

The last-run banner's incident strip could only link out to the incident.
Acknowledging a new incident meant leaving the page for the Incident tab.

Add an Acknowledge action to the strip, shown only while the incident is
New and the user holds EditStatus on the test case. It transitions the
incident through the task-first endpoint and republishes the refreshed
resolution status, so the strip and the header's Incident Status chip
both update without refetching the page.

useTestCaseIncidentHeader grows a shared applyIncidentTransition helper;
the assignee handler now routes through it instead of repeating the
transition-then-read-back sequence.

The banner is also aligned with the design prototype it was built from:
the status tint moves to the banner container so the incident strip can
sit a shade lighter over it, the status tile and headline grow to the
mock's scale, the accent bar uses the 600 palette step the mock
specifies, the incident id renders monospace and separate from its
title, and the New chip turns red while the Acknowledge button takes the
run status' colour. The strip's row is centred rather than top-aligned.
@ShaileshParmar11 ShaileshParmar11 added UI UI specific issues safe to test Add this label to run secure Github workflows on PRs labels Sep 22, 2026
@ShaileshParmar11
ShaileshParmar11 marked this pull request as ready for review September 22, 2026 11:27
Copilot AI lite review requested due to automatic review settings September 22, 2026 11:27

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

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Playwright impact map auto-refreshed

This PR touched specs or UI source that changed the source→spec routing map. I regenerated .github/playwright/impact-map.generated.json and pushed the diff to this branch.

- source entries: 804 → 804
- 0 added, 0 removed, 2 changed spec-list

Entries whose spec list changed:
  openmetadata-ui/src/main/resources/ui/playwright/utils/dateTime.ts
  openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/IncidentManagerPageHeader/IncidentDetails.component.tsx

What is this file? It is the auto-generated half of Playwright's PR planner. It routes "if source X changes, run specs Y" by walking spec imports and cross-referencing getByTestId strings. Hand-authored routing in impact-map.json always wins on conflict.

What if I want to regenerate locally instead? Run this before pushing your next change to skip the bot commit:

python3 .github/scripts/generate_playwright_impact_map.py
git add .github/playwright/impact-map.generated.json
git commit --amend --no-edit  # or a separate commit

Copilot AI review requested due to automatic review settings September 22, 2026 11:28

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 commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 9 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), 9 warning(s) across 3 changed file(s).

Count Rule
6 openmetadata-imports/no-lower-layer-page-imports
2 openmetadata-imports/review-sequential-api-calls
1 no-restricted-imports
All findings
Location Rule Message
🟡 src/components/DataQuality/IncidentManager/IncidentManagerPageHeader/useTestCaseIncidentHeader.ts:30: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/DataQuality/IncidentManager/IncidentManagerPageHeader/useTestCaseIncidentHeader.ts:49:3 no-restricted-imports 'getPrioritizedEditPermission' import from '../../../../utils/PermissionsUtils' is restricted from being used by a pattern. getPrioritizedEditPermission/getPrio
🟡 src/components/DataQuality/IncidentManager/IncidentManagerPageHeader/useTestCaseIncidentHeader.ts:226:27 openmetadata-imports/review-sequential-api-calls Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent
🟡 src/components/DataQuality/IncidentManager/TestCaseStatus/InlineTestCaseIncidentStatus.component.tsx:37: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/DataQuality/IncidentManager/TestCaseStatus/InlineTestCaseIncidentStatus.component.tsx:296:27 openmetadata-imports/review-sequential-api-calls Review these sequential API requests. If they are independent, start them together with Promise.all/Promise.allSettled; keep sequencing only when data-dependent
🟡 src/components/observability/TestCaseDetail/TestCaseDetail.tsx:33: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/observability/TestCaseDetail/TestCaseDetail.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/observability/TestCaseDetail/TestCaseDetail.tsx:35: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/observability/TestCaseDetail/TestCaseDetail.tsx:40: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.

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

make ui-checkstyle-changed

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 72%
72.52% (103983/143370) 57.65% (63357/109898) 58.7% (20725/35306)

…r applied

Address two review findings on the acknowledge flow:

- A read-back that fails or returns nothing left the header on the old
  status even though the transition had landed, so the banner invited the
  user to repeat it. The expected status per transition is now applied as a
  fallback, and a failed transition no longer looks the same as a failed
  read-back.
- The Playwright poll scanned an unfiltered incident window whose default
  page holds 10 rows, so a parallel worker's incidents could hide this
  test's own. It now filters by test case FQN server-side.
…ition ids for acknowledge

The Acknowledge button was a secondary Button recoloured from outside:
an important outline override for its border and an inner span for its
label. Core Button already ships secondary-destructive, -warning,
-success and -brand, which carry border, text, hover, loading and
disabled states, so each status now names one of those instead.

Transition ids were spelled out at five call sites across two files.
They are the workflow's own edge names rather than the resolution status
they produce, so they live in one typed constant beside the incident REST
types. Typing the read-back fallback against that union also drops the
empty-string index it needed.

Also drops the prefix prop ExpandableBannerText no longer has a caller
for, memoizes handleAssigneeUpdate alongside its siblings, and replaces
the status badge's raw white with the semantic background token so it
follows dark mode.
Copilot AI review requested due to automatic review settings September 23, 2026 11:23

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.

@gitar-bot

gitar-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Adds a permission-gated action for changing incident status through the existing API.

Adds an Acknowledge action to the test-case last-run incident strip, gated to New incidents with EditStatus permission. The transition reads back the authoritative incident status and updates both the strip and header chip from a single source, with no page refetch. Styling now aligns with the design prototype. Unit and Playwright tests confirm the feature works across all banner states and permission scenarios. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@sonarqubecloud

Copy link
Copy Markdown

@ShaileshParmar11
ShaileshParmar11 added this pull request to the merge queue Sep 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-23T14:26:17Z)

Blocked the queue: playwright-summary

@ShaileshParmar11
ShaileshParmar11 added this pull request to the merge queue Sep 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-23T17:11:05Z)

Blocked the queue: playwright-summary

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

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants