Skip to content

[2.1] Fixes open-metadata/openmetadata-collate#9060: Show the current test case after leaving version history in AI mode (#39699) - #39796

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

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

Conversation

@ShaileshParmar11

Copy link
Copy Markdown
Contributor

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 on main.

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.1 has the same app-mode observability.module.tsx routes as main had: the details and version routes render the same TestCaseDetail element tree, so React reused one instance. The historical snapshot the version page put in useTestCaseStore survived the switch, and neither reset() nor a refetch ran.

Fix:

  • observability.module.tsx: the version routes key their TestCaseDetail apart from the details routes. Switching details ↔ version now remounts it, which resets the store and refetches, the same as the classic router's separate TestCaseVersionPage.
  • useTestCaseDetailPage.tsx: fetchCurrentVersion ignores responses that arrive after their version or page is gone, through an AbortSignal the effect aborts on cleanup.

2.0 doesn't need this backport, because it has no app-mode observability module.

Type of change:

  • Bug fix

High-level design:

N/A — backport of a small bug fix.

Tests:

Which test layer and why

Same as #39699:

  • A Jest route test renders the module's real routes through KeepAliveRoutes and resolveAppModuleRoutes, and asserts that the page remounts between details and version.
  • Hook tests run against the real useTestCaseStore and cover late version responses.

Use cases covered

  • AI mode: details → older version → close history shows the current test case.
  • A version response that arrives after leaving doesn't replace the current test case or show a toast.

Unit tests

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

Manual testing performed

Checked that 2.1 renders both details and version routes with the same <ObservabilityLayout><TestCaseDetail …/></ObservabilityLayout> tree, and has KeepAliveRoutes, resolveAppModuleRoutes and TestCaseDetail.types.ts, which the new test needs. The browser repro and fix verification are in #39699.

UI screen recording:

Not applicable — bug fix.

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: Show the current test case after leaving version history in AI mode #39699 (two REVIEW.md passes, final recommendation approve); this is a clean cherry-pick.
  • Decision check: no durable decision.

🤖 Generated with Claude Code

… 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)
@ShaileshParmar11
ShaileshParmar11 requested a review from a team as a code owner December 4, 2026 10:37
@ShaileshParmar11
ShaileshParmar11 requested review from anuj-kumary and a balanced review from Copilot and removed request for a team December 4, 2026 10:37

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.

@gitar-bot

gitar-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Changing 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.

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 abe021f into 2.1 Dec 4, 2026
42 of 44 checks passed
@ShaileshParmar11
ShaileshParmar11 deleted the ShaileshParmar11/backport-39699-2.1 branch December 4, 2026 10:56
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.

3 participants