Repository navigation
Fixes #32981: let the class base suppress the shared test-result graph - #32982
Conversation
`TestCaseResultTab` renders `TestSummary` for every test case, and `TestCaseResultTabClassBase` exposes no way to say otherwise. A downstream build that needs to plot a test type the shared chart reads wrongly can therefore only append its own chart through `getAdditionalComponents` and hide the shared one with CSS - which leaves `TestSummary` mounted, so the page issues `getListTestCaseResults` twice and renders a full recharts tree into a hidden container. Add `shouldRenderDefaultGraph(testCaseData)` to the class base, defaulting to `true` so OSS behaviour is unchanged, surface it through `useTestCaseResultTab`, and gate the `TestSummary` block on it. An override that returns `false` unmounts the chart rather than hiding it, so its fetch never fires. The gate goes through `shouldRenderTestSummary` in `TestCaseResultTab.utils` rather than inline: it is a type predicate, so `TestSummary` still gets a narrowed `TestCase`, and it keeps the component under the cyclomatic complexity ceiling. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_019Z6H2Crk88aujoBtrELGJK
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
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 |
There was a problem hiding this comment.
🟢 Approval recommended
The change is additive with a safe default and includes focused unit test coverage for both default and suppressed rendering paths.
Pull request overview
This PR adds an extension point to let downstream builds suppress the shared TestSummary graph in TestCaseResultTab (without CSS hacks), so incorrect default visualizations can be replaced cleanly and the extra getListTestCaseResults fetch is avoided when suppressed.
Changes:
- Added
shouldRenderDefaultGraph(testCaseData?: TestCase)toTestCaseResultTabClassBase(defaulttrue) and surfaced it throughuseTestCaseResultTab. - Gated rendering of
TestSummaryinTestCaseResultTabvia a newshouldRenderTestSummarytype-predicate helper. - Added/updated unit tests to cover default behavior and suppression behavior (including ensuring the graph is not mounted when suppressed).
File summaries
| File | Description |
|---|---|
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/useTestCaseResultTab.tsx | Exposes shouldRenderDefaultGraph from the class base to the tab renderer. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/useTestCaseResultTab.test.tsx | Verifies the hook forwards the class-base decision for the current test case. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTabClassBase.ts | Adds the new overridable shouldRenderDefaultGraph hook (defaulting to OSS behavior). |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTabClassBase.test.ts | Adds coverage for default behavior and subclass suppression per test type. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.utils.ts | Introduces shouldRenderTestSummary type predicate to keep TestSummary callsites typed and lint-complexity compliant. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.test.tsx | Adds test ensuring TestSummary is absent when the class base suppresses the default graph. |
| openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx | Applies the render gate so the shared graph can be unmounted when suppressed. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
|
| Count | Rule |
|---|---|
| 2 | openmetadata-imports/no-lower-layer-page-imports |
| 1 | react-hooks/exhaustive-deps |
All findings
| Location | Rule | Message | |
|---|---|---|---|
| 🟡 | src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx:26: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/TestCaseResultTab/TestCaseResultTab.component.tsx:325:6 |
react-hooks/exhaustive-deps |
React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array. |
| 🟡 | src/components/DataQuality/IncidentManager/TestCaseResultTab/useTestCaseResultTab.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. |
Fix locally (fast - only checks files changed in this branch):
make ui-checkstyle-changed
Code Review ✅ ApprovedAdds OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
There was a problem hiding this comment.
🟢 Approval recommended
The change is additive with a safe default, cleanly gates the problematic render path, and includes focused unit tests covering both default and suppressed behavior.
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
All three warnings are pre-existing on I linted the
This branch: the same 3, at On fixing them here rather than flagging them:
Blocking checkstyle status is green: 0 errors, and the |
|
Conflicts came from #32982, which added a class-base gate on the shared test-result graph while this branch moved that same graph to the top of the main column. * `TestCaseResultTab.component.tsx` — the graph keeps this branch's position and takes main's gate: `shouldRenderTestSummary(testCaseData, shouldRenderDefaultGraph)`. Git saw main "adding" the block at the old location only because this branch had removed it there, so that copy is dropped rather than duplicated — one `TestSummary` remains. * `TestCaseResultTab.test.tsx` — both sides added a declaration and a reset in the same two places; both are kept. One thing the textual merge could not see: #32982 moved the class base behind a `default` export, so `jest.requireMock('./TestCaseResultTabClassBase')` in the extension-components suite now resolves one level higher than the mock. It is repointed at `.default`, which the tests would otherwise fail on despite a clean merge. Co-Authored-By: Claude Opus 5 <[email protected]>
…uration-card Brings main (via TCD-0's merge) into the stack. The component auto-merged: the class-base graph gate from #32982 landed on the card-reflowed layout without a conflict, because TCD-0 resolved it to the identical text. Two things the textual merge got wrong: * `TestCaseResultTab.utils.ts` — this branch deleted `shouldShowSqlParamsSection` and with it the now-unused `isUndefined` import, while main added `shouldRenderTestSummary`, which uses `isUndefined`. Different lines, so no conflict was reported and the module threw `isUndefined is not defined` at runtime. The import is restored. * The one real conflict was the `afterEach` reset: this branch sets `isTabExpanded` to `true` to match `useTestCase.store`'s default, main added a graph-gate reset in the same place. Both are kept. Co-Authored-By: Claude Opus 5 <[email protected]>



Describe your changes:
Fixes #32981
TestCaseResultTabrenders the sharedTestSummarychart for every test case, andTestCaseResultTabClassBaseexposes no way to say otherwise — onlygetAdditionalComponentsandgetAlertBanner, neither of which can suppress that render.A downstream build that needs to plot a test type the shared chart reads wrongly (a freshness result stores signed slack rather than a measured delay, so the shared chart draws it as a descending line into negative durations) can therefore append its own chart, but cannot take the wrong one off the page. The only lever left is a CSS
:has()rule, which does not unmountTestSummary— so the page issuesgetListTestCaseResultstwice, renders a full recharts tree into adisplay: nonecontainer, and couples to class names owned by this repo.This adds
shouldRenderDefaultGraph(testCaseData)to the class base, defaulting totrueso OSS behaviour is unchanged, surfaces it throughuseTestCaseResultTab, and gates theTestSummaryblock on it. An override that returnsfalseunmounts the chart rather than hiding it, so its fetch never fires.The gate goes through
shouldRenderTestSummaryinTestCaseResultTab.utilsrather than inline. It is a type predicate, soTestSummarystill receives a narrowedTestCase, and it keepsTestCaseResultTabunder thesonarjs/cyclomatic-complexityceiling of 10 — the inlinetestCaseData && shouldRenderDefaultGraph &&form pushed it to 11 and failed lint.Downstream consumer: openmetadata-collate#6385 overrides this hook in
TestCaseResultTabClassCollateto returnfalsefortableDataToBeFresh, where it supplies a replacementFreshnessGraph. That PR is blocked on this one — its override is inert until this lands and the submodule pointer moves.Type of change:
High-level design:
N/A — small change. Three files touched plus their tests; the hook is additive with a
truedefault, so no existing caller changes behaviour.Tests:
Use cases covered
TestSummarychart (unchanged default)falsefor a test type unmounts the chart, so it neither renders nor fetchesUnit tests
TestCaseResultTabClassBase.test.ts— the default returnstruefor no argument,undefined, and a real test case; a subclass can suppress per test typeuseTestCaseResultTab.test.tsx— the hook calls the class base with the current test case and surfaces bothtrueandfalseTestCaseResultTab.test.tsx—TestSummaryis not in the document when the class base suppresses itVerified locally:
yarn test --testPathPattern TestCaseResultTab→ 53 passed, and the new tab assertion fails onmainwithout the gate (checked by reverting the condition).npx tsc --noEmitreports nothing on the changed files;ui-checkstylesequence (organize-imports → eslint --fix → prettier) leaves them clean with 0 errors.Integration tests
N/A — UI-only change.
Playwright tests
N/A — no user-visible change in OSS; the default keeps the current behaviour.
🤖 Generated with Claude Code
https://claude.ai/code/session_019Z6H2Crk88aujoBtrELGJK