Skip to content

[2.1] Fixes #39774: Request the schema table's test summary only for its own test suite (#39776) - #39782

Merged
ShaileshParmar11 merged 1 commit into
2.1from
ShaileshParmar11/backport-39776-2.1
Dec 4, 2026
Merged

ShaileshParmar11 merged 1 commit into
2.1from
ShaileshParmar11/backport-39776-2.1

Conversation

@ShaileshParmar11

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #39774

Backport of #39776 to 2.1. Cherry-picked with -x; it applies cleanly and is identical to the commit on main.

SchemaTable (the table page's Schema tab) called getTestCaseExecutionSummary(table?.testSuite?.id) on every table FQN change. For a table without a test suite, or before its testSuite field loaded, the request went out without testSuiteId. The server then summarised every test suite in the catalog, and the tab used that aggregate as the table's column test summary, which is an expensive catalog-wide query on each untested table page. 2.1 has the same unguarded call as main had.

The fix:

  • Fetch the summary only when the table has a test suite, passing that suite's id.
  • Refetch when the test suite changes.
  • Clear the summary when there is no test suite.

Type of change:

  • Bug fix

High-level design:

N/A — backport of a small bug fix.

Tests:

Which test layer and why

Jest at the HTTP boundary (rest/testAPI mock): the behaviour is which request the component sends.

Use cases covered

  • A table without a test suite sends no execution-summary request.
  • A table with a test suite requests that suite's summary.
  • Switching test suite requests the new suite's summary.

Unit tests

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable. Jest covers this request-level behaviour.

Manual testing performed

Checked that 2.1's SchemaTable.component.tsx had the identical unguarded getTestCaseExecutionSummary(table?.testSuite?.id) call with [tableFqn] deps, and that the backported component diff matches #39776 line for line.

UI screen recording:

Not applicable — bug fix with no visible UI change.

Checklist:

  • I have read CONTRIBUTING.md (the pre-review gate) and the contributor docs.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • 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. — N/A.
  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is not applicable). — N/A, bug fix.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: reviewed in Fixes #39774: Request the schema table's test summary only for its own test suite #39776 (no 🔴); this backport changes only the test-file conflict resolution described above.
  • Decision check: no durable decision.

🤖 Generated with Claude Code

…n test suite (#39776)

* Request the schema table's test summary only for its own test suite

SchemaTable called getTestCaseExecutionSummary(table?.testSuite?.id) on every
table FQN change. For a table without a test suite, or before the table's
testSuite field had loaded, that sent the request without testSuiteId, so the
server summarised every test suite and the page used that aggregate as the
table's column test summary. It also made AssetHealthWidget.browser.test.tsx
flaky: the unscoped request could land before its 'no test suite, nothing to
summarise' assertion. Fetch only when the table has a test suite, refetch when
that suite changes, and clear the summary otherwise.

* Cover the schema table refetching its test summary when the test suite changes

(cherry picked from commit 9904563)
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner December 4, 2026 09:40
@ShaileshParmar11
ShaileshParmar11 requested review from karthicksharan and a balanced review from Copilot and removed request for a team December 4, 2026 09:40

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 insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Dec 4, 2026

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.

Comment on lines +423 to +437
const fetchTestCaseSummary = async (id: string) => {
try {
const response = await getTestCaseExecutionSummary(table?.testSuite?.id);
const response = await getTestCaseExecutionSummary(id);
setTestCaseSummary(response);
} catch {
setTestCaseSummary(undefined);
}
};

// Without a test suite id the endpoint summarises every test suite, not
// this table's.
useEffect(() => {
void fetchTestCaseSummary();
}, [tableFqn]);
if (testSuiteId) {
void fetchTestCaseSummary(testSuiteId);
} else {

@gitar-bot gitar-bot Bot Dec 4, 2026 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Edge Case: An older summary response can overwrite the current suite's summary

The rewritten effect fires getTestCaseExecutionSummary(id) and has no cleanup or check that the response is still current. Suppose the user goes from a table with suite A to one with suite B, or to a table with no suite, where the else branch clears the summary. If A's request resolves late, setTestCaseSummary writes A's counts onto the new table's column test badges. The frontend-performance rule asks for stale responses to be cancelled or ignored. A simple fix is an ignore flag set in the effect cleanup, so only the request for the current testSuiteId updates state.

Ignore responses that arrive after testSuiteId has changed:

useEffect(() => {
  if (!testSuiteId) {
    setTestCaseSummary(undefined);

    return;
  }
  let ignore = false;
  getTestCaseExecutionSummary(testSuiteId)
    .then((response) => !ignore && setTestCaseSummary(response))
    .catch(() => !ignore && setTestCaseSummary(undefined));

  return () => {
    ignore = true;
  };
}, [testSuiteId]);

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Code Review 👍 Approved with suggestions 🟡 Medium risk 0 closed / 1 findings

Scoping schema-table summary requests to a table’s own test suite avoids catalog-wide aggregation, reducing unnecessary query load on tables without suites.

Backport of the fix that requests the schema table's test execution summary only when the table has a test suite, passing that suite's id, refetching on suite change, and clearing the summary when none exists. Consider adding an ignore flag in the effect cleanup in SchemaTable.component.tsx so a late response for a previous suite cannot overwrite the column test summary for the current table.

💡 Edge Case: An older summary response can overwrite the current suite's summary

📄 openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaTable/SchemaTable.component.tsx:423-437

The rewritten effect fires getTestCaseExecutionSummary(id) and has no cleanup or check that the response is still current. Suppose the user goes from a table with suite A to one with suite B, or to a table with no suite, where the else branch clears the summary. If A's request resolves late, setTestCaseSummary writes A's counts onto the new table's column test badges. The frontend-performance rule asks for stale responses to be cancelled or ignored. A simple fix is an ignore flag set in the effect cleanup, so only the request for the current testSuiteId updates state.

Ignore responses that arrive after testSuiteId has changed
useEffect(() => {
  if (!testSuiteId) {
    setTestCaseSummary(undefined);

    return;
  }
  let ignore = false;
  getTestCaseExecutionSummary(testSuiteId)
    .then((response) => !ignore && setTestCaseSummary(response))
    .catch(() => !ignore && setTestCaseSummary(undefined));

  return () => {
    ignore = true;
  };
}, [testSuiteId]);
🤖 Prompt for agents
Code Review: Backport of the fix that requests the schema table's test execution summary only when the table has a test suite, passing that suite's id, refetching on suite change, and clearing the summary when none exists. Consider adding an `ignore` flag in the effect cleanup in `SchemaTable.component.tsx` so a late response for a previous suite cannot overwrite the column test summary for the current table.

1. 💡 Edge Case: An older summary response can overwrite the current suite's summary
   Files: openmetadata-ui/src/main/resources/ui/src/components/Database/SchemaTable/SchemaTable.component.tsx:423-437

   The rewritten effect fires `getTestCaseExecutionSummary(id)` and has no cleanup or check that the response is still current. Suppose the user goes from a table with suite A to one with suite B, or to a table with no suite, where the `else` branch clears the summary. If A's request resolves late, `setTestCaseSummary` writes A's counts onto the new table's column test badges. The frontend-performance rule asks for stale responses to be cancelled or ignored. A simple fix is an `ignore` flag set in the effect cleanup, so only the request for the current `testSuiteId` updates state.

   Fix (Ignore responses that arrive after testSuiteId has changed):
   useEffect(() => {
     if (!testSuiteId) {
       setTestCaseSummary(undefined);
   
       return;
     }
     let ignore = false;
     getTestCaseExecutionSummary(testSuiteId)
       .then((response) => !ignore && setTestCaseSummary(response))
       .catch(() => !ignore && setTestCaseSummary(undefined));
   
     return () => {
       ignore = true;
     };
   }, [testSuiteId]);

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@ShaileshParmar11
ShaileshParmar11 merged commit 99b10e1 into 2.1 Dec 4, 2026
43 of 45 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the ShaileshParmar11/backport-39776-2.1 branch December 4, 2026 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants