Repository navigation
[2.1] Fixes open-metadata/openmetadata-collate#9060: Show the current test case after leaving version history in AI mode (#39699) - #39796
Conversation
… mode (#39699) * Fix stale test case after leaving version history in app-mode observability The app-mode observability routes render one mounted TestCaseDetail for both the details and version pages, so the historical snapshot the version page writes to useTestCaseStore survived navigating back to details. Re-sync the store from the query cache when isVersionPage changes, and drop version responses that resolve after the user has left that version. * Remount TestCaseDetail between details and version routes instead of re-syncing the store Re-syncing the store from the React Query cache when leaving the version page undid edits saved through mergeTestCase, which updates only the store. Key the version routes' TestCaseDetail apart from the details routes so the switch remounts it, as the classic router's separate TestCaseVersionPage does: the unmount resets the store and the new mount refetches the test case. Version fetch errors that land after leaving are no longer toasted. * Route remount test through KeepAliveRoutes and cover the version fetch error toast * Fetch the test case version with async/await and try/catch * Move fetchCurrentVersion out of the effect and cancel it with an AbortSignal (cherry picked from commit 24cfb13)
❌ 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 |
Code Review ✅ Approved 🟡 Medium riskChanging route remounting and stale-response handling affects test-case version display; regressions could show historical metadata as current. Backports the AI-mode fix that remounts the test case detail page when switching between details and version routes, so the current test case shows after leaving version history. Late version responses are also ignored via an AbortSignal. No issues found. VerificationRules 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 open-metadata/openmetadata-collate#9060
Backport of #39699 to
2.1. Cherry-picked with-x; it applies cleanly and is identical to the commit onmain.In AI mode (app-mode observability), after viewing an older version of a test case, the details page kept showing that version's display name, version, SQL query and owners as if they were current, until a full reload.
2.1has the same app-modeobservability.module.tsxroutes asmainhad: the details and version routes render the sameTestCaseDetailelement tree, so React reused one instance. The historical snapshot the version page put inuseTestCaseStoresurvived the switch, and neitherreset()nor a refetch ran.Fix:
observability.module.tsx: the version routes key theirTestCaseDetailapart from the details routes. Switching details ↔ version now remounts it, which resets the store and refetches, the same as the classic router's separateTestCaseVersionPage.useTestCaseDetailPage.tsx:fetchCurrentVersionignores responses that arrive after their version or page is gone, through anAbortSignalthe effect aborts on cleanup.2.0doesn't need this backport, because it has no app-mode observability module.Type of change:
High-level design:
N/A — backport of a small bug fix.
Tests:
Which test layer and why
Same as #39699:
KeepAliveRoutesandresolveAppModuleRoutes, and asserts that the page remounts between details and version.useTestCaseStoreand cover late version responses.Use cases covered
Unit tests
observability.module.test.tsx(new) anduseTestCaseDetailPage.test.tsx, the same as Fixes: Show the current test case after leaving version history in AI mode #39699.observability.module.test.tsxpasses.showdown, which my local install (frommain) doesn't have. This branch's CI runs them with its own install.main, Fixes: Show the current test case after leaving version history in AI mode #39699's suites passed 1614/1614 locally, and the Playwright AI-mode observability specs passed 35/35.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
Checked that
2.1renders both details and version routes with the same<ObservabilityLayout><TestCaseDetail …/></ObservabilityLayout>tree, and hasKeepAliveRoutes,resolveAppModuleRoutesandTestCaseDetail.types.ts, which the new test needs. The browser repro and fix verification are in #39699.UI screen recording:
Not applicable — bug fix.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.REVIEW.mdpasses, final recommendation approve); this is a clean cherry-pick.🤖 Generated with Claude Code