Skip to content

test(playwright): run MCP Chat AUT describe serially to avoid shared-app race - #29169

Merged
pmbrull merged 2 commits into
mainfrom
pmbrull/fix-mcp-chat-aut-parallel-race
Jun 18, 2026
Merged

pmbrull merged 2 commits into
mainfrom
pmbrull/fix-mcp-chat-aut-parallel-race

Conversation

@pmbrull

@pmbrull pmbrull commented Jun 18, 2026 •

Copy link
Copy Markdown
Member

Problem

The MCP Chat - Sidebar Navigation Playwright spec (McpChat.spec.ts, added in #26343) fails deterministically in the nightly AUT runs. Two of its three tests fail every night:

  • MCP Chat nav item should appear in sidebar when app is installed → expect(getByTestId('app-bar-item-mcp-chat')).toBeVisible() → element(s) not found
  • Clicking MCP Chat sidebar nav should navigate to chat page → 60s timeout waiting for the same sidebar item

The third test, Send button should enable when input has text, passes — it reaches the page via a direct page.goto('/mcp-chat') and does not depend on the sidebar item.

Root cause

The describe shares one globally-named installed app (McpChatApplication): installed in beforeAll, hard-deleted in afterAll. The project runs with fullyParallel: true (workers: 3), so:

  • The describe's tests are split across workers, and beforeAll/afterAll run once per worker.
  • The fast direct-navigation test finishes first (~4.5s); its worker's afterAll then DELETE …?hardDelete=true removes the shared app.
  • The slower sidebar-dependent tests are still running in other workers. Once the app is deleted, GET /api/v1/apps/installed no longer returns it, the UI's ApplicationsProvider builds no McpChatPlugin, and the app-bar-item-mcp-chat sidebar entry never renders.

It is deterministic (not flaky) because the direct-navigation test is always the quickest to reach its afterAll. The /mcp-chat route is registered unconditionally, which is why that test still passes.

Fix

Force the describe to run serially in a single worker:

test.describe.configure({ mode: 'serial' });

beforeAll/afterAll then run exactly once and afterAll only fires after all three tests complete, so the shared app stays installed for the whole describe. No production code change — test isolation only.

🤖 Generated with Claude Code

Greptile Summary

Fixes a deterministic nightly AUT failure in the MCP Chat - Sidebar Navigation spec by configuring the describe block to run in serial mode, preventing worker-level race conditions around the shared McpChatApplication install/teardown lifecycle.

  • Root cause fixed: Under fullyParallel: true, each worker ran its own beforeAll/afterAll — the fastest test's afterAll hard-deleted the app while slower sibling tests were still asserting the sidebar item.
  • Fix: One line — test.describe.configure({ mode: 'serial' }) — ensures beforeAll/afterAll fire exactly once and afterAll only runs after all three tests finish. No production code is touched.

Confidence Score: 5/5

Safe to merge — one-line test configuration change with no production code impact.

The change is a single test.describe.configure({ mode: 'serial' }) call that corrects a well-documented, deterministic race condition in the test suite. It does not touch any application code, only test isolation semantics. The comment accurately describes the problem, and the fix is the standard Playwright-recommended approach for describes that share global state through beforeAll/afterAll.

No files require special attention.

Important Files Changed

Filename Overview
openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/McpChat.spec.ts Adds test.describe.configure({ mode: 'serial' }) to prevent worker-level race conditions where the fast direct-navigation test's afterAll hard-deleted the shared app while sibling tests were still asserting the sidebar item.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant W1 as Worker 1
    participant W2 as Worker 2
    participant W3 as Worker 3
    participant API as OpenMetadata API

    Note over W1,W3: BEFORE (fullyParallel, no serial mode)

    W1->>API: beforeAll: POST /api/v1/apps (install McpChatApplication)
    W2->>API: beforeAll: POST /api/v1/apps (409 already installed)
    W3->>API: beforeAll: POST /api/v1/apps (409 already installed)

    W3->>W3: Test: Send button enables (page.goto, fast ~4.5s)
    W3->>API: "afterAll: DELETE McpChatApplication?hardDelete=true"

    Note over W1,W2: App deleted — sidebar item disappears
    W1--xW1: FAIL: app-bar-item-mcp-chat not found
    W2--xW2: FAIL: 60s timeout waiting for sidebar item

    Note over W1,W3: AFTER (test.describe.configure serial mode)

    W1->>API: beforeAll: POST /api/v1/apps (runs once)
    W1->>W1: Test 1: MCP Chat nav item appears in sidebar
    W1->>W1: Test 2: Clicking nav navigates to chat page
    W1->>W1: Test 3: Send button enables with text
    W1->>API: "afterAll: DELETE McpChatApplication?hardDelete=true"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant W1 as Worker 1
    participant W2 as Worker 2
    participant W3 as Worker 3
    participant API as OpenMetadata API

    Note over W1,W3: BEFORE (fullyParallel, no serial mode)

    W1->>API: beforeAll: POST /api/v1/apps (install McpChatApplication)
    W2->>API: beforeAll: POST /api/v1/apps (409 already installed)
    W3->>API: beforeAll: POST /api/v1/apps (409 already installed)

    W3->>W3: Test: Send button enables (page.goto, fast ~4.5s)
    W3->>API: "afterAll: DELETE McpChatApplication?hardDelete=true"

    Note over W1,W2: App deleted — sidebar item disappears
    W1--xW1: FAIL: app-bar-item-mcp-chat not found
    W2--xW2: FAIL: 60s timeout waiting for sidebar item

    Note over W1,W3: AFTER (test.describe.configure serial mode)

    W1->>API: beforeAll: POST /api/v1/apps (runs once)
    W1->>W1: Test 1: MCP Chat nav item appears in sidebar
    W1->>W1: Test 2: Clicking nav navigates to chat page
    W1->>W1: Test 3: Send button enables with text
    W1->>API: "afterAll: DELETE McpChatApplication?hardDelete=true"
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into pmbrull/fix-mcp..." | Re-trigger Greptile

…app race

The MCP Chat sidebar-navigation tests share one globally-named installed
app (McpChatApplication) created in beforeAll and hard-deleted in
afterAll. The project runs `fullyParallel`, so the describe's tests are
split across workers and beforeAll/afterAll execute per worker. The fast
direct-navigation test finishes first and its afterAll hardDeletes the
app while the slower sidebar-dependent tests are still polling for
`app-bar-item-mcp-chat`, so the item never renders and they time out.

Force serial execution so the shared app stays installed for the whole
describe.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@pmbrull
pmbrull requested a review from a team as a code owner June 18, 2026 09:01
Copilot AI review requested due to automatic review settings June 18, 2026 09:01

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 reached their quota limit.

@github-actions

github-actions Bot commented Jun 18, 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.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 62%
62.28% (66607/106947) 44.04% (37261/84607) 45.38% (11189/24653)

@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🔴 Playwright Results — 3 failure(s), 11 flaky

✅ 4300 passed · ❌ 3 failed · 🟡 11 flaky · ⏭️ 88 skipped

Shard Passed Failed Flaky Skipped
🟡 Shard 1 300 0 2 4
✅ Shard 2 812 0 0 9
🔴 Shard 3 811 3 2 8
🟡 Shard 4 854 0 3 12
🟡 Shard 5 732 0 1 47
🟡 Shard 6 791 0 3 8

Genuine Failures (failed on all attempts)

❌ Features/SearchExport.spec.ts › Search mode visible export downloads CSV with tab-specific row count (shard 3)
�[31mTest timeout of 180000ms exceeded.�[39m
❌ Features/SearchExport.spec.ts › Filtered search visible export downloads CSV with the filtered record count (shard 3)
Error: �[2mexpect(�[22m�[31mlocator�[39m�[2m).�[22mtoHaveCount�[2m(�[22m�[32mexpected�[39m�[2m)�[22m failed

Locator:  locator('[data-testid="loader"]')
Expected: �[32m0�[39m
Received: �[31m1�[39m
Timeout:  30000ms

Call log:
�[2m  - Expect "toHaveCount" with timeout 30000ms�[22m
�[2m  - waiting for locator('[data-testid="loader"]')�[22m
�[2m    3 × locator resolved to 1 element�[22m
�[2m      - unexpected value "1"�[22m

❌ Features/SearchExport.spec.ts › Export downloads CSV with correct filename and closes modal (shard 3)
�[31mTest timeout of 180000ms exceeded.�[39m
🟡 11 flaky test(s) (passed on retry)
  • Pages/Policies.spec.ts › Add new policy with invalid condition (shard 1, 1 retry)
  • Pages/Roles.spec.ts › Roles page should work properly (shard 1, 1 retry)
  • Features/KnowledgeCenterList.spec.ts › Knowledge Center List - Verify Recently Viewed widget (shard 3, 1 retry)
  • Features/Workflows/WorkflowOssRestrictions.spec.ts › edit-workflow-button visible; delete-workflow-button and run-workflow-button absent (shard 3, 1 retry)
  • Pages/CustomProperties.spec.ts › Sql Query (shard 4, 1 retry)
  • Pages/DataContracts.spec.ts › Create Data Contract and validate for Directory (shard 4, 1 retry)
  • Pages/DataContractsSemanticRules.spec.ts › Validate Entity Version Is (shard 4, 1 retry)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Drag and Drop Glossary Term (shard 6, 1 retry)
  • Pages/Lineage/DataAssetLineage.spec.ts › Column lineage for dashboard -> apiEndpoint (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify Impact Analysis service filter selection (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@pmbrull
pmbrull merged commit 04ec915 into main Jun 18, 2026
47 of 50 checks passed
@pmbrull
pmbrull deleted the pmbrull/fix-mcp-chat-aut-parallel-race branch June 18, 2026 16:42
@gitar-bot

gitar-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Forces Playwright MCP Chat tests to run serially to prevent worker-level race conditions from deleting the shared application prematurely. The spec now maintains the required app state throughout the test suite.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

pmbrull added a commit that referenced this pull request Jul 15, 2026
…s/Memory Agent (#30041)

* revert(ai): remove AISettings + Memory/Ontology Agent (#29201)

Removes the AISettings config plane and the Memory/Ontology Agent that
derived glossary terms and metrics from ContextMemory. Keeps the
ContextMemory entity (schemas frozen), CreateContextMemoryTool, and the
Persona AI Context feature that reads ContextMemory. Restores the base
McpApplication files #29201 had refactored away.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* revert(context): remove page knowledge-pill extraction (#29119)

Reverts the Context Center *page* extraction pipeline (generic
ContextProcessingEngine + File/Page engines, ContextMemoryReconciler,
sourceEntity generalization, ExtractedMemoriesCard UI). Keeps the frozen
ContextMemory/ContextFile/Page schemas, file-side sourceFile handling
(removed later with #28973), and all follow-on work (pinning, pagination,
attachment widget, ui-core-components migration).

This reverts commit 506c8c9.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* chore(ai): keep metric.json/createMetric.json schema frozen

Extends the D1 schema-freeze decision to the Metric schema: the AI revert
(#29201) removed the Memory/Ontology Agent *code* that populated Metric's
'derivedFrom'/'provider', but the JSON schema fields are left intact (inert)
so re-introducing the feature later needs no schema change. Verified the
service compiles with the fields present and unused.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* revert(context-center): remove file knowledge-pill extraction (#28973)

Removes the file extraction pipeline (ContextFileProcessingService,
ContextMemoryExtractor, the LLM completion-client layer, KnowledgePill,
DocumentStatusBadge UI) and restores the pre-#28973 ContextFileExtractionService
stub. Keeps the 3 MCP context tools (Get/Search/CreateContextMemory), the
object-storage upload + /system/validate stack (D3), and the frozen
ContextMemory/ContextFile schemas (D1).

This reverts commit 03530b2.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* revert(mcp): remove MCP Chat client, conversation tracking, chat UI (#26343, #29169)

Removes the MCP Chat feature: chat client service (mcpclient/*), the chat
LLM-client layer (clients/llm/* except LlmConfigHolder), McpConversation/
McpMessage entities+repos+resource+schemas, McpChatApplication, the chat UI
(McpChatPage, /mcp-chat routes) and its playwright spec (#29169), and the
mcp_conversation/mcp_message tables.

KEPT (now load-bearing for semantic-search embeddings, not chat):
llmConfiguration.json + LlmConfigHolder + OpenMetadataApplicationConfig.
llmConfiguration — the vector-embedding stack (SystemRepository, the
*EmbeddingClient family, OpenSearchBulkSink, #29678 AI Context Platform)
depends on it, so a wholesale revert would break semantic search.

Follow-up UI reconciliation (package.json deps, locale keys, ApplicationsProvider,
generated TS) lands in the codegen/i18n commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* revert(ui): reconcile MCP-chat/AI UI removal + checkstyle

Finalizes the UI side of the reverts: removes the residual MCP-chat route,
plugin, and provider state; reverse-applies #26343's UI wiring (sidebar,
constants, ApplicationsClassBase); restores getContextMemoryById (still used
by the surviving memories page); fixes the DocumentPreviewPanel status-row
JSX left by the badge removal; and runs the organize-imports + eslint +
prettier sequence. Locale files and orphaned i18n keys are intentionally left
in place (harmless, re-introduction-friendly, in-sync).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* Update generated TypeScript types

* fix(revert): keep full objectStorage config for file upload

The extraction revert (#28973) over-reverted objectStorage down to a NOOP
stub, but file upload (ContextFile) survives and needs the full
s3/azure/env-overridable config (D3). Restore it to main's version. Net conf
diff is now only the llmConfiguration comment, updated to reference its
surviving consumer (semantic-search embeddings) instead of the removed
extraction/MCP-chat.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* minor fix

* lint fix

* fixed playwright test

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Rohit0301 <[email protected]>

This branch was previously deployed

1 inactive deployment
test — 81dc590c Deployed Jun 18, 2026 by pmbrull via playwright-ci-postgresql (1, 6) #51847
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants