Repository navigation
[2.1] Fixes #39774: Request the schema table's test summary only for its own test suite (#39776) - #39782
Conversation
…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)
❌ 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 |
| 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 { |
There was a problem hiding this comment.
💡 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 👍 / 👎
Code Review 👍 Approved with suggestions 🟡 Medium risk 0 closed / 1 findingsScoping 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 💡 Edge Case: An older summary response can overwrite the current suite's summaryThe rewritten effect fires Ignore responses that arrive after testSuiteId has changed🤖 Prompt for agentsVerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #39774
Backport of #39776 to
2.1. Cherry-picked with-x; it applies cleanly and is identical to the commit onmain.SchemaTable(the table page's Schema tab) calledgetTestCaseExecutionSummary(table?.testSuite?.id)on every table FQN change. For a table without a test suite, or before itstestSuitefield loaded, the request went out withouttestSuiteId. 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.1has the same unguarded call asmainhad.The fix:
Type of change:
High-level design:
N/A — backport of a small bug fix.
Tests:
Which test layer and why
Jest at the HTTP boundary (
rest/testAPImock): the behaviour is which request the component sends.Use cases covered
Unit tests
SchemaTable.test.tsxadds thecolumn test summaryblock (3 tests), the same as Fixes #39774: Request the schema table's test summary only for its own test suite #39776.main, Fixes #39774: Request the schema table's test summary only for its own test suite #39776's suite passed 26/26, and the no-test-suite test fails without the fix. I didn't run this branch's Jest locally because its dependencies (antd,ts-jest) differ frommain's install; the PR's CI runs it.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Checked that
2.1'sSchemaTable.component.tsxhad the identical unguardedgetTestCaseExecutionSummary(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:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.🤖 Generated with Claude Code