Skip to content

Fixes #39154: clear AutoPilot workflow state on no-run service navigation - #39188

Open
detail-app[bot] wants to merge 2 commits into
mainfrom
detail/bug-fix/fixes-39154-clear-autopilot-workflow-state-on-no-r-4d21ca
Open

detail-app[bot] wants to merge 2 commits into
mainfrom
detail/bug-fix/fixes-39154-clear-autopilot-workflow-state-on-no-r-4d21ca

Conversation

@detail-app

@detail-app detail-app Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Detail bug report: View on Detail

Describe your changes:

Fixes #39154

I worked on clearing stale AutoPilot/Service-Insights workflow state when navigating client-side between services on the classic service details page, because once a service with an AutoPilot run was viewed, the page stayed mounted (the /service/:serviceCategory/:fqn route element has no key) and workflowStatesData was only set inside if (workflowInstanceId) — never cleared in an else or on the catch path. The next (no-run) service therefore rendered the previous service's run status/progress, gated its live stream off stale RUNNING, queried agent statuses over the wrong run window, and wrongly disabled the "Run Agents"/AutoPilot trigger with "AutoPilot already running".

Type of change:

  • Bug fix

High-level design:

N/A — small change. Mirrors the existing pattern in the sibling AI-mode hook useServiceAgents.ts (PR #38929), which already clears the state when a service has no run.

In ServiceDetailsPage.tsx fetchWorkflowInstanceStates:

  • Added an else { setWorkflowStatesData(undefined); } so a no-run service clears stale state.
  • Clear workflowStatesData on the catch path (a stale error toast is preferable to stale cross-service data).
  • Added a currentServiceFqnRef ref guard so a workflow response that resolves after navigation to another service is discarded and cannot overwrite the current service's state (and the late fetch won't clobber the current service's loading flag).

Tests:

Use cases covered

  • Viewing service A (AutoPilot RUNNING) then client-side navigating to service B (no run) shows no stale run on B and re-enables the trigger.
  • Navigating to a service whose workflow fetch errors clears stale state (trigger enabled, no stale "already running").
  • A late workflow response from service A that resolves after navigating to service B is ignored (no state overwrite).
  • Navigating between two services that both have runs overwrites A's state with B's (no regression in the happy path).
  • Per-service RUNNING / Failure / Finished / empty / loading trigger behaviour is unchanged.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files updated: ServiceDetailsPage.test.tsx — instrumented the ServiceInsightsTab mock to surface workflowStatesData and added a workflowStatesData cross-service state leak block (4 tests) covering the no-run leak, the error path, the late-response race, and the both-have-runs no-regression case. All 64 tests in the suite pass.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable — the cross-service leak is covered by the Jest suite and a new Vitest browser test (below). make playwright_affected lists the impacted specs; the full Playwright suite runs in the merge queue and requires a live server stack, which was not available locally (see Manual testing).

Manual testing performed

  • Added a real-browser Vitest test ServiceDetailsPage.workflowLeak.browser.test.tsx (real Chromium + MSW, real ServiceInsightsTab/DataAssetsHeader/BrowserRouter) that mounts service-a (RUNNING run → trigger disabled), performs a true in-mount client-side navigation (history.pushState + popstate) to service-b, and asserts the trigger goes enabled and service-b's heading renders. Confirmed RED→GREEN: the test fails on the pre-fix component (trigger stays disabled with stale state) and passes with the fix.
  • Installed Chromium + OS deps (npx playwright install chromium, npx playwright install-deps chromium) to run the browser test; it passes.
  • Routine checks: yarn test (64/64), yarn tsc:check (no errors in changed files — the 34 pre-existing errors are in unrelated SSOUtils.test.ts/ChartDetailsUtils.test.tsx), yarn lint (0 errors, 43 pre-existing warnings unchanged), license header check, and tailwind audit gates all pass.
  • Could not run the full Playwright E2E suite or a hands-on UI smoke test: no live OpenMetadata server was reachable (localhost:8585 refused connection) and the quickstart Docker images (2.0.0-SNAPSHOT) returned manifest unknown on pull; building the full mysql+elastic+server+ingestion stack from source exceeded this environment. This was attempted — the exact blocker is connect ECONNREFUSED 127.0.0.1:8585 at POST /api/v1/auth/login. The in-mount cross-service scenario those would cover is already exercised by the browser test above.

UI screen recording:

Not applicable — standalone bug fix with no new UI feature or behavior change beyond correcting stale state on navigation; the behavior is covered by the Vitest browser test.

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

Automatic Fixes PRs can be configured here.

@detail-app
detail-app Bot requested a review from a team as a code owner November 28, 2026 03:20
@detail-app
detail-app Bot requested a review from Rohit0301 November 28, 2026 03:20
@detail-app
detail-app Bot force-pushed the detail/bug-fix/fixes-39154-clear-autopilot-workflow-state-on-no-r-4d21ca branch from 6f7a946 to 11f0fbd Compare November 28, 2026 06:13

This branch has not been deployed

No deployments
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] Service Details: AutoPilot/Insights workflow state leaks between services on client-side navigation

1 participant