Skip to content

Fixes #36960: Memory details open linked assets and documents, and name a deleted query for admins - #36991

Merged
pmbrull merged 13 commits into
mainfrom
pmbrull/memory-evidence-ux
Nov 6, 2026
Merged

pmbrull merged 13 commits into
mainfrom
pmbrull/memory-evidence-ux

Conversation

@pmbrull

@pmbrull pmbrull commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36960

In the memory details modal:

  • Links open where they should. A linked asset opens its own page and a source document opens in the Context Center. A type with no page of its own stays unlinked instead of falling back to a table route.
  • Closing on navigation. Following a link closes the modal without breaking Back, and Cmd/Ctrl/middle clicks leave it open.
  • Queries. A linked query opens only when the memory links exactly one table, and query cards show the query's name. A restricted query reference shows the existing translated permission message in Linked Data Assets instead of a blank row.
  • Deleted queries (item 26). When a supporting query has been deleted, the held memory's reason names the query instead of its id, for admins only. The server can't evaluate a non-admin's access to a query that no longer exists, so it now hides the reference from them. That also closes a leak: before, a domain-restricted reader could see a deleted query's name through /versions and the change description.

Type of change:

  • Bug fix

High-level design:

  • Link building: CreateMemoryModal.utils (getLinkedAssetPath, getQueryTableFqn), contextCenterClassBase.getDocumentPath, and entityUtilClassBase.hasEntityLink, which is false for ingestionPipeline.
  • Navigation:
    • Modal links call onNavigate only for same-tab clicks (utils/LinkClickUtils.navigatesThisTab).
    • The Memories page closes the memory without touching the URL, so Back reopens it.
    • The Documents page re-resolves its preview when ?document= changes and clears the preview when Back removes that parameter.
  • Deleted query name:
    • useMemoryStatusReason reads the deleted query's name from the memory's version history. The reason's text is shared through RETIRED_QUERY_REASON, and a Java test pins it to EVIDENCE_RETIRED.
    • ContextMemoryEvidenceAccess hides a Query reference whose row is gone from non-admins (EntityDAO.exists, cached per response).
  • Record: 2026-10-15-a-memory-cites-its-supporting-queries-and-their-retirement-holds-it-for-review gets amendment v2: the UI resolves the name at view time, and the stored reason stays id-only.

Tests:

Use cases covered

  • Clicking a linked table, dashboard, document or (single-table) query opens it, and the memory closes; Back reopens the memory.
  • A Cmd-click opens a new tab and leaves the memory open.
  • Two copies of a document: clicking the other copy switches the preview. Browser Back to the Documents list closes it.
  • An admin sees the deleted query's name in the held memory's reason. A reader outside the query's domain sees only its id, in the reason, /versions and GET.

Unit tests

  • Current head abdd2f77abf: 117 Jest tests passed in 10 touched suites; 94 planner-selected Java tests passed.
  • Added a real MemoryRouter Back-navigation regression, observed failing before the preview fix.
  • UI checkstyle import/ESLint/Prettier fixes applied; Java formatting and impact map checks passed.
  • yarn tsc:check remains blocked by two unchanged files: IngestionWorkflowForm.tsx:413 (RJSF validator type) and OntologyIriInput.test.tsx:104 (exact in ByRoleOptions). No errors were reported in changed files.

Backend integration tests

Not run locally: make java_affected selects 56 integration tests. The new ContextMemoryQueryEvidenceIT#aDeletedQueryStaysHiddenFromAReaderOutsideItsDomain is written, but the IT module does not compile against the local snapshot jars; its errors are in unrelated ontology and MCP ITs. The tests run in the merge queue.

Playwright (UI) tests

Not run: the planner selects 62 specs, plus impact-map gaps that make CI run the full suite. They need a server built from this branch.

UI screen recording:

36991-memory-links.webm

Recorded on the combined review instance (all 12 memory PRs plus the 2026-11-06 fixes):

  • The orders link opens the table and closes the memory; Back reopens it.
  • Cmd-click opens a new tab and keeps the memory open.
  • Extracted from opens the document preview; Back closes it.
  • A query shows by name with its Query badge. It is a link when the memory has one linked table.
  • A reader denied the query sees the permission message with the badge and no link.
  • Deleting a cited query holds the memory for review, with a reason that names the query.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review against REVIEW.md: fresh review of abdd2f77abf found no remaining Important findings. Fixed Back leaving the document preview open and CI checkstyle failures.
  • The versions REST helper is covered through its consumers; a direct URL/response mock would repeat the thin wrapper rather than exercise additional behavior.
  • Decision check: the amendment above.

Regression follow-up (2026-11-04)

  • Source links, query destinations, document preview/Back handling and deleted-evidence explanations are covered by the affected modal/page/router tests. Query-evidence lifecycle and restricted readers are covered by real REST.
  • 126 Jest tests passed across 10 affected memory/evidence/attribution suites in the combined UI. All 13 ContextMemoryQueryEvidenceIT cases passed on isolated MySQL/Elasticsearch.
  • Runtime evidence: all 12 pinned PR heads are present in the combined stack; source heads: OpenMetadata 7d7ac24b6e4e274b935954a067dbae7fa61007a3, AI eacb39819e854615b6eebf27b6fa486b4b9beba3, Collate f10b2d235cd4ec4f461a2db409f43a9289d4e3ae. Targeted combined runs are reported here; this does not claim that every planner-selected integration or browser suite ran.

Restricted Query label (2026-11-05)

  • An id/type-only Query reference now displays the existing translated message.no-permission-to-view text: “You do not have the necessary permissions to view this data.” It stays unlinked because it has no FQN; the reference used when editing/saving stays id/type-only. Accessible Query names and destinations keep their existing behavior.
  • Two new view/edit regressions failed on the empty row before the fix. 26 modal/utility tests passed on this branch; 59 modal/utility/list tests passed with the other memory PRs combined. ESLint, import organization, Prettier and commit-time UI/ADR checks passed. The existing two unrelated TypeScript diagnostics remain in IngestionWorkflowForm.tsx:413 and OntologyIriInput.test.tsx:104; no errors were reported in changed files.
  • The combined Collate reactor and Docker build passed. A real browser check with a fresh non-admin account and an explicit Query ViewAll deny role passed: the API returned only id/type; the panel showed the permission message with no link. Removing the role restored the full query reference, its visible name and its link. All temporary permission fixtures were removed.
  • Self-review: fresh REVIEW.md pass at 8fc99ba5ef7f25f28a11b9de559c43f79bfd7203, no Important findings. No new decision record: this renders the existing redaction contract.

Merge readiness (2026-11-06)

Merge order (12 memory PRs). OpenMetadata #36988 first, then #36990 and #36992 in any order, then #36989 (it needs #36988). Right after #36989: Collate #8241, then #8239. Until #8241 lands, Collate main starts a memory created without a stage Approved. Collate #8240 and #8242 can merge any time. OpenMetadata #36991 goes last of the OpenMetadata PRs, after one update once #36989 and #36992 land; its conflicts are already resolved. ai-platform #2035 and #2036 can merge any time. #2034 goes after Collate #8239 and #8241, with one update after #2035, also already resolved.

🤖 Generated with Claude Code

pmbrull and others added 4 commits November 3, 2026 13:05
Release testing could not open the Query a memory cites: Linked Data Assets
rows rendered no link at all, and the table's Queries tab showed only a
timestamp and the SQL, so near-identical queries were indistinguishable.

- A linked asset opens on its own page; a linked Query opens full screen on the
  table it was linked from, and stays unlinked when the memory names no table.
- A Query card names the query when it has a display name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he way out

Review of the linked-asset links found three gaps:

- A document a memory was extracted from linked to /table/<fqn>, because
  getEntityLink falls back to a table page for any type it has no route for.
  Documents now open in Context Center, previewed (contextCenterClassBase
  .getDocumentPath, shared with the "Extracted from" link), and any other type
  with no route of its own stays unlinked (entityUtilClassBase.hasEntityLink).
- In AI mode the memory modal outlives a route change, so following a linked
  asset or the "Extracted from" link left it open over the new page. Both links
  now close it, as the derived-term link already did.
- The utils file imported EntityReference twice, which failed the type check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…porting query

Review of the linked-asset links:

- A link to another document now previews it on the Documents page. The page
  stays mounted, and it skipped any ?document= change while a preview was open.
- Following a link out of a memory no longer drops ?memory from history, so Back
  from the linked page reopens the memory as before. The Memories page closes the
  modal in place (onNavigate). A new-tab click (Cmd/Ctrl/Shift/Alt or a
  non-primary button) leaves the modal open.
- A linked Query opens only when the memory links exactly one table. With
  several tables it stays unlinked instead of opening on the first.
- hasEntityLink is false for an ingestion pipeline, which is routed through its
  service and has no route without it.
- The Dashboard uses getDocumentPath. QueryCard's separators use a semantic
  token and the size prop.

A memory held because a supporting Query was deleted stores only the Query's id
in its reason. The memory list and view now name the Query when the memory's
version history gives this viewer its name. The versions endpoint already
reduces a Query reference to its id and type for a caller who may not view it.
A Query delete is always a hard delete, so the Query's own endpoint cannot name
it. The stored reason stays id-only.

ADR:2026-10-15-a-memory-cites-its-supporting-queries-and-their-retirement-holds-it-for-review

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ew-tab click

A Query that no longer exists now reads in full only to an admin. Policy
conditions that need the Query, such as hasDomain() or matchAnyTag(), cannot
be evaluated once it is gone, and they failed open. A DomainOnly reader that a
Query was hidden from then saw its name and FQN once it was deleted: in the
hold's change, in every version, and so in the Context Center's named reason.
ContextMemoryEvidenceAccess now gives any other caller {id, type} for a Query
whose row is gone. The evidence-hold ADR amendment says so: the reason is named
for admins, and every other reader keeps the id.

The derived-term link no longer closes the memory on a new-tab click. That
click left ?memory= in the URL, so the memory could not be reopened from its
row. navigatesThisTab now lives in LinkClickUtils, shared by every link in the
memory.

MemoryEvidenceHoldsTest pins the Context Center's RETIRED_QUERY_REASON to
EVIDENCE_RETIRED.

ADR:2026-10-15-a-memory-cites-its-supporting-queries-and-their-retirement-holds-it-for-review

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ UI Checkstyle passed — lint findings in changed files

🔍 ESLint findings in this PR's files — 0 error(s), 8 warning(s)

Errors block the build. Warnings do not yet — they are rules whose backlog is still
being worked down, listed so this PR does not add to it. See docs/ui-code-quality-gate.md.

0 error(s), 8 warning(s) across 4 changed file(s).

Count Rule
7 react-hooks/exhaustive-deps
1 openmetadata-imports/no-lower-layer-page-imports
All findings
Location Rule Message
🟡 src/components/Database/TableQueries/QueryCard.tsx:126:6 react-hooks/exhaustive-deps React Hook useMemo has a missing dependency: 't'. Either include it or remove the dependency array.
🟡 src/pages/ContextCenterPage/ContextCenterDashboardPage/ContextCenterDashboardPage.tsx:207:6 react-hooks/exhaustive-deps React Hook useCallback has an unnecessary dependency: 't'. Either exclude it or remove the dependency array.
🟡 src/pages/ContextCenterPage/ContextCenterMemoriesPage/ContextCenterMemoriesPage.tsx:588:6 react-hooks/exhaustive-deps React Hook useEffect has a missing dependency: 'setCurrentPage'. Either include it or remove the dependency array.
🟡 src/pages/ContextCenterPage/ContextCenterMemoriesPage/ContextCenterMemoriesPage.tsx:636:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'setCurrentPage'. Either include it or remove the dependency array.
🟡 src/pages/ContextCenterPage/ContextCenterMemoriesPage/ContextCenterMemoriesPage.tsx:645:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'setCurrentPage'. Either include it or remove the dependency array.
🟡 src/pages/ContextCenterPage/ContextCenterMemoriesPage/ContextCenterMemoriesPage.tsx:650:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'setCurrentPage'. Either include it or remove the dependency array.
🟡 src/pages/ContextCenterPage/ContextCenterMemoriesPage/ContextCenterMemoriesPage.tsx:665:6 react-hooks/exhaustive-deps React Hook useCallback has a missing dependency: 'setCurrentPage'. Either include it or remove the dependency array.
🟡 src/utils/EntityUtilClassBase.ts:29: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

…ce-ux

# Conflicts:
#	openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/CreateMemoryModal/CreateMemoryModal.component.tsx
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This 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 skip-pr-checks label.

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 Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
81.63% (141500/173336) 69.08% (51825/75011) 72.03% (29008/40270)

Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:47

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.

* The status reason a memory gets when a Query it cites is deleted, as MemoryEvidenceHolds writes
* it: the Query's id sits between the two parts.
*/
export const RETIRED_QUERY_REASON = {

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.

these text doesn't required translations ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch. These two strings are the reason text the server stores when a cited Query is deleted (MemoryEvidenceHolds), so they have to stay in English: the UI only matches them to recognise that hold and read the Query id out of it. The UI was also rebuilding the shown text from them, so viewers saw English. Fixed in 5cbe133: the hook now shows message.memory-supporting-query-deleted with the Query's name, or its id when the viewer can't see the name. The key has a translation in all 21 locales, and the constant's comment says it's matched only, never shown.

The stored reason stays the English contract the UI recognises; what the viewer reads
is message.memory-supporting-query-deleted, in every locale.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ce-ux

# Conflicts:
#	docs/decisions/2026-10-15-a-memory-cites-its-supporting-queries-and-their-retirement-holds-it-for-review.md
#	openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/CreateMemoryModal/CreateMemoryModal.component.tsx
#	openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/CreateMemoryModal/CreateMemoryModal.test.tsx
#	openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/MemoriesView/MemoriesView.component.tsx
#	openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/MemoriesView/MemoriesView.test.tsx
Copilot AI balanced review requested due to automatic review settings November 6, 2026 10:20

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.

Each held card in the memory list read and parsed the memory's full version history on
every mount. The lookup now goes through React Query, keyed by memory and Query, so a
card, its panel and a remount share one result.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 6, 2026 10:26

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.

Copilot AI balanced review requested due to automatic review settings November 6, 2026 10:39

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.

@gitar-bot

gitar-bot Bot commented Nov 6, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Restricting deleted-query details to admins changes authorization; an incorrect existence or admin decision could expose restricted query names in memory histories.

Memory details modal now links assets, documents and single-table queries to their own pages, closes on same-tab navigation, and names deleted queries for admins. Resolved the finding where the memory list fetched full version history once per held card, so each card now uses one shared cached lookup. No open issues remain.

✅ 1 closed
✅ Performance: Memory list fetches full version history once per held card

📄 openmetadata-ui/src/main/resources/ui/src/components/ContextCenter/MemoriesView/MemoriesView.component.tsx:377-391 📄 openmetadata-ui/src/main/resources/ui/src/hooks/discovery/context-center/useMemoryStatusReason.ts:79-93
EntityStatusReason in MemoriesView now calls useMemoryStatusReason for every listed memory. Each card whose reason is a retired-query hold makes its own getContextMemoryVersions(memoryId) call, then JSON-parses every version. Nothing caches these calls, so every remount or re-list fetches them again. Item 6 of the ADR says deleting one Query holds every memory that cites it, so a widely cited Query can fill the held-Draft queue with cards that each pull a full history. Fix: move the lookup into useQuery keyed by ['contextMemoryVersions', memoryId] with a staleTime, so results are shared and cached. Better still, resolve the names once for the visible page with useQueries, or limit the lookup to the open memory view.

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

@pmbrull
pmbrull enabled auto-merge (squash) November 6, 2026 10:42
@pmbrull
pmbrull merged commit 46c39d5 into main Nov 6, 2026
65 of 66 checks passed
@pmbrull
pmbrull deleted the pmbrull/memory-evidence-ux branch November 6, 2026 11:06
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.1 Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory details: linked queries, assets and documents do not open, and a deleted query reason shows only its id

4 participants