Skip to content

Fix the flaky LLM template journey's duplicate-ID check - #4485

Open
randilt wants to merge 1 commit into
wso2:mainfrom
randilt:fix/4364-snackbar-record
Open

randilt wants to merge 1 commit into
wso2:mainfrom
randilt:fix/4364-snackbar-record

Conversation

@randilt

@randilt randilt commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Purpose

Resolves #4364. The UI journey "an administrator creates LLM providers from a template" still fails intermittently after #4370: twice more in CI, on Nov 20 (job 136285853935) and Nov 21 (job 136911060357), each time at And the user sees "An LLM provider with this ID already exists." on the page.

The message is an AI Workspace snackbar that hides after 3.5 seconds (autoHideDuration: 3500 in portals/ai-workspace/src/contexts/AIWorkspaceSnackbarContext.tsx). In both failing traces:

  • The click and the 409 finish within 0.1 seconds of each other.
  • Nothing reaches the browser for the next 4.6 to 5.1 seconds.
  • The check for the message starts after the snackbar has hidden.

#4370 removed the delay caused by the request recorder, and the traces confirm that no longer happens. The remaining stall is in the test process, between two steps that make no browser calls. Whatever its cause, a test that has to resume within 3.5 seconds to see the message will keep failing on a busy runner.

Goals

  • A snackbar message is asserted no matter how late the step that checks it resumes.
  • One showing of a message satisfies one check. A message left over from an earlier action can't satisfy a later check.

Approach

This uses the same pattern as the API Portal toast recorder (reloadingSave in steps/apiportal/billing.go):

  • Recording: the page's init script (steps/browser.go) records each MUI snackbar message (.MuiSnackbar-root) as it appears.
    • Any user interaction (pointerdown, keydown, input) clears the record, so a check only matches messages shown after the last action.
  • Checking: seesOnPage (steps/aiworkspace/journey.go) passes in either of two cases:
    • the text was recorded in a snackbar; that recorded showing is then used up;
    • the text is visible on the page, the web-first assertion as before. A recorded showing of the same text is also used up, so it can't satisfy a later check.

The change covers every AI Workspace step that checks text with "the user sees".

User stories

N/A. A test stability fix.

Documentation

N/A. Test changes only.

Automation tests

  • Unit tests

    go test ./suites/ui/steps/... passes.

  • Integration tests
    • Break-check: a temporary 5-second sleep at the start of the "rejected with HTTP 409" step simulates the CI stall.
      • Without this change, the journey fails at the duplicate-ID check with "Locator expected to be visible", the same failure as CI.
      • With this change, it passes.
    • Clean runs: three runs of the whole ai-core block (-blocks ai-core -coverage, 60 scenarios each).
      • Runs 1 and 2 passed every scenario.
      • Run 3 passed every scenario except "An administrator creates an MCP proxy from the sample endpoint". It timed out waiting for the external sample MCP server's probe, before any snackbar check. That dependency is tracked separately.
      • The LLM template journey, and every other "the user sees" check, passed in all three runs.
      • No run had cleanup errors.

Security checks

Database changes

  • I have applied the same table, column, and index changes to the API Platform SaaS (Bijira Cloud) databases in all relevant environments (dev, staging, production) and regions (US, EU).

Samples

N/A

Related PRs

Test environment

  • macOS with Rancher Desktop
  • Chromium through playwright-go

The duplicate-ID message is a snackbar that hides after 3.5 seconds, and
the step checking it could resume later than that. The page now records
each snackbar message as it appears, and "the user sees" also matches a
message recorded since the user's last interaction, once per showing.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6bafa55 and 2bce6ae.

Files selected for processing: 2

  • tests/framework/suites/ui/steps/aiworkspace/journey.go
  • tests/framework/suites/ui/steps/browser.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@codecov-commenter

codecov-commenter commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.93%. Comparing base (f5a3844) to head (2bce6ae).
⚠️ Report is 102 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4485      +/-   ##
==========================================
- Coverage   68.13%   64.93%   -3.21%     
==========================================
  Files        1362     1346      -16     
  Lines      210648   219093    +8445     
  Branches     6750     6751       +1     
==========================================
- Hits       143529   142264    -1265     
- Misses      58017    67904    +9887     
+ Partials     9102     8925     -177     
Flag Coverage Δ
ai-workspace-bff-integration 11.90% <ø> (ø)
ai-workspace-bff-unit 82.44% <ø> (ø)
ai-workspace-ui-integration 28.39% <ø> (-0.27%) ⬇️
ai-workspace-ui-unit 76.83% <ø> (ø)
api-portal-server-integration 72.33% <ø> (-0.02%) ⬇️
api-portal-ui-integration 64.08% <ø> (+0.05%) ⬆️
api-portal-unit 75.33% <ø> (-0.70%) ⬇️
gateway-controller-integration 30.40% <ø> (-24.63%) ⬇️
platform-api-integration 34.07% <ø> (-16.88%) ⬇️
policy-engine-integration 26.52% <ø> (-12.22%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

[Bug]: Flaky UI test: the duplicate-ID message is not shown in the LLM provider template journey

2 participants