Skip to content

Fixes #38348: normalize pipeline query key so hover-prefetch warms detail page slot - #38385

Merged
Rohit0301 merged 2 commits into
mainfrom
detail/bug-fix/fixes-38348-normalize-pipeline-query-key-so-hover-b2b70e
Nov 23, 2026
Merged

Rohit0301 merged 2 commits into
mainfrom
detail/bug-fix/fixes-38348-normalize-pipeline-query-key-so-hover-b2b70e

Conversation

@detail-app

@detail-app detail-app Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Fixes #38348

I worked on the dead pipeline hover-prefetch in Explore because the prefetch and the pipeline detail page were building React Query cache keys with different whitespace in the fields element, so the slot the prefetch populated was never the slot the page read — every hover fired a GET /pipelines/name/{fqn}?fields=... whose response was never consumed, and the detail page always painted from a cold cache instead of the warmed one.

Type of change:

  • Bug fix

High-level design:

N/A — small change.

The fix is one normalization step at the cache-key boundary in rest/queries/pipelineQuery.ts. pipelineQueryKey(fqn, fields) now applies normalizeFields(fields) = fields.replace(/\s+/g, '') to the third key element, so two fields strings that differ only in whitespace (the prefetch's bare-comma followers,tags,... vs the page's stray-space followers, tags, owners,tasks, ...) collapse to the same React Query slot. pipelineQueryFn still passes the original (un-normalized) fields to getPipelineByFqn, so request payloads are unchanged — the backend already strips whitespace (EntityUtil.Fields), so only the client cache key needed fixing. PREFETCH_PIPELINE_FIELDS is now exported so a unit test can enforce the previously comment-only "keep in sync with PipelineDetailsUtils.defaultFields" contract.

Alternatives considered: importing defaultFields directly into pipelineQuery.ts to share one source of truth — rejected because the file documents a circular-import concern (see dashboardQuery.ts), and normalizing at the key boundary is robust against any future caller-side formatting drift, not just the current one.

Tests:

Use cases covered

  • Hovering a pipeline card in Explore warms the exact React Query cache slot the pipeline detail page reads (for a viewer with ViewUsage permission), so the detail page paints from the warm cache on click.
  • The prefetch still fires exactly one GET /pipelines/name/{fqn}?fields=... per hover.
  • A viewer without ViewUsage permission intentionally does not consume the prefetch slot (the prefetch requests the maximal field set; the page narrows) — this matches the documented best-effort Table prefetch behavior and is not regressed by the fix.
  • The "keep in sync" comment between the prefetch field list and PipelineDetailsUtils.defaultFields is now enforced by a test, so future edits to either side that drop a field will fail CI.
  • The ['pipeline', fqn, ...] key-shape prefix used by SuggestionsProvider cache invalidation is preserved.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated:
    • openmetadata-ui/src/main/resources/ui/src/rest/queries/pipelineQuery.test.ts (new) — 15 tests covering normalizeFields, pipelineQueryKey normalization + shape, a real-QueryClient prefetch↔page slot-synchronization integration (mocking only getPipelineByFqn at the API boundary), and a keep-in-sync guard comparing the prefetch field list against PipelineDetailsUtils.defaultFields.
  • Coverage on changed classes: not run to a final % (host has 3.6 GB RAM; UI coverage runs are resource-heavy). The new test file exercises every exported code path in pipelineQuery.ts: normalizeFields, pipelineQueryKey, pipelineQueryFn (indirectly via the QueryClient integration), prefetchPipelineByFqn, and prefetchPipeline.

Backend integration tests

  • Not applicable (no backend API changes).
  • No backend code touched; the request payload and response shapes are byte-identical before and after the fix.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no versioned Playwright spec added).
  • A self-contained Playwright spec (PipelineHoverPrefetch.spec.ts) was written and run during verification against a live local stack (see Manual testing) to confirm the prefetch fires and the detail page renders the entity header from the warm slot. It was not versioned because it requires a bespoke auth-bypass config (the standard suite's auth.setup project seeds eight test users and is too heavyweight to fold into this single-file fix without a broader fixture story); the Jest integration tests in pipelineQuery.test.ts use a real QueryClient and stand as the regression guard that fails if the fix is reverted.

Manual testing performed

  1. Brought up the full local stack via ./docker/run_local_docker.sh -m ui -d mysql -s false -i true -r true (with MAVEN_OPTS='-Xmx768m -XX:+UseSerialGC' to fit the 3.6 GB host). Verified curl http://localhost:8585/api/v1/system/version → HTTP 200 and the UI → HTTP 200.
  2. Confirmed the served bundle includes the fix: the minified chunk dist/assets/pipelineQuery-seg02ImL.js contains S=r=>r.replace(/\s+/g,"") and n=(r,i)=>["pipeline",r,S(i)] — i.e. normalizeFields applied inside pipelineQueryKey.
  3. Live-API byte-diff: fetched sample_airflow.customer_profiles_pipeline with both the prefetch-side fields string (bare commas) and the page-side fields string (stray spaces from PipelineDetailsUtils.defaultFields + ,usageSummary). Both return HTTP 200, 1644 bytes, identical SHA-256 — confirming the backend tolerates whitespace and the cache key was the only gap.
  4. Real-QueryClient check: a throwaway Jest integration test (now removed) called prefetchPipeline(queryClient, FQN), then read queryClient.getQueryData(pipelineQueryKey(FQN, defaultFields + ',usageSummary')) and got the prefetched fixture back; getPipelineByFqn was called exactly once; the page key .toEqualed pipelineQueryKey(FQN, PREFETCH_PIPELINE_FIELDS). This is the same shape as the versioned pipelineQuery.test.ts integration tests but driven against the live API contract.
  5. Playwright E2E against the live UI (after npx playwright install chromium + npx playwright install-deps chromium to provision the browser and OS libs): signed in as admin, navigated to Explore → Pipelines tab, hovered a pipeline card, asserted the prefetch fired a GET .../pipelines/name/{fqn}?fields=followers,tags,owners,tasks,pipelineStatus,domains,dataProducts,votes,extension,usageSummary, then clicked the card and asserted entity-header-display-name rendered — the warm-cache instant-paint signal. Test passed. (Spec not versioned; see Playwright section above.)
  6. Confirmed the pre-fix state would fail the new Jest guard by inspecting the un-fixed pipelineQueryKey (no normalizeFields): the prefetch key's third element was followers,tags,... while the page key's was followers, tags, owners,tasks, ... — .toEqual between them returns false, so the versioned pipelineQueryKey test and the keep-in-sync guard both fail on main. A full negative-case validation against a rebuilt un-fixed Docker image was attempted but deferred — the server container serves from the JAR baked into its image (built with the fix), and serving an un-fixed bundle would require a full Maven package + docker compose build openmetadata_server rebuild that exceeded the time budget; the Jest guard covers the negative case directly.

Routine gates all pass on the changed files: ESLint (--no-error-on-unmatched-pattern), Prettier (--check), and yarn test (32/32 — the new pipelineQuery.test.ts plus the existing entityDetailQueryKeys.test.ts shape guard). yarn tsc:check reports only a pre-existing error in utils/queryBuilderWidgets/OMSelectWidget.tsx (unrelated; not touched by this PR; confirmed pre-existing by stashing the fix and re-running tsc).

UI screen recording:

Not applicable — this is a standalone performance bug fix with no user-visible UI surface change (no new UI element, layout, styling, or interaction). The fix restores an already-shipped hover-prefetch optimization; the visible effect is perceived-latency only. Per CONTRIBUTING.md and the template, standalone fixes may use "Not applicable — ".

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 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.
  • 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).
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.
  • Decision check: if this PR decides something the next contributor could undo — a schema field, REST path or format another component or repo must agree with, a new default or limit, an ordering that must hold, or a rule stated only in this description — it adds a record under docs/decisions/ (see its README.md). This description is gone from git log after the squash-merge.

The new normalizeFields-at-the-key-boundary choice is a self-contained local convention for pipelineQuery.ts (mirrors the documented sibling dashboardQuery.ts twin case noted in the issue); it is not a durable cross-component contract that another repo must agree with, so no ADR is needed. The sibling Dashboard prefetch has the same whitespace mismatch and is out of scope per the bug report; a follow-up issue is recommended for it.

  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

Automatic Fixes PRs can be configured here.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with the previous test gap addressed and no new actionable issues found.

Summary

Normalizes whitespace in pipeline query keys so hover-prefetched data can be read by the detail page.

  • Pipeline hover-prefetch and detail pages share a cache slot despite different field-list spacing.

No new actionable issues were found. Previous finding #1 is fully addressed. Tests were not run during this review.

Reviews (2) · Last reviewed commit: "test(pipelineQuery): assert warm-cache p..." · Reviewed by Greptile

@detail-app
detail-app Bot requested a review from a team as a code owner November 21, 2026 04:06
… runs

Replace the fetchQuery-based 'does not refetch' assertion with a mounted
useQuery test using the app's real QueryClient settings (staleTime: 0).
The new test asserts the prefetched cached data renders synchronously
while a background refetch is in flight, matching the shipping page's
stale-while-revalidate behavior the fix is meant to preserve.
@Rohit0301
Rohit0301 merged commit 9cfa30c into main Nov 23, 2026
55 checks passed
@Rohit0301
Rohit0301 deleted the detail/bug-fix/fixes-38348-normalize-pipeline-query-key-so-hover-b2b70e branch November 23, 2026 05:36
Rohit0301 added a commit that referenced this pull request Nov 23, 2026
…tail page slot (#38385) (#38429)

* fix(ui): normalize pipeline query key so hover-prefetch warms detail page

* test(pipelineQuery): assert warm-cache paint while background refetch runs

Replace the fetchQuery-based 'does not refetch' assertion with a mounted
useQuery test using the app's real QueryClient settings (staleTime: 0).
The new test asserts the prefetched cached data renders synchronously
while a background refetch is in flight, matching the shipping page's
stale-while-revalidate behavior the fix is meant to preserve.

---------


(cherry picked from commit 9cfa30c)

Co-authored-by: detail-app[bot] <180357370+detail-app[bot]@users.noreply.github.com>
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.

[Detail Bug] Explore: pipeline hover-prefetch never warms detail-page cache due to mismatched fields string formatting

2 participants