Skip to content

fix(test): re-read the active editor tab in GlobalSearch test 7 - #42129

Draft
wyattwalter wants to merge 1 commit into
releasefrom
ww-flake/globalsearch-tab-race
Draft

fix(test): re-read the active editor tab in GlobalSearch test 7#42129
wyattwalter wants to merge 1 commit into
releasefrom
ww-flake/globalsearch-tab-race

Conversation

@wyattwalter

@wyattwalter wyattwalter commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Description

GlobalSearch_spec.js test 7 ("Api actions should have API as prefix") creates an API
from a datasource and then reads the active editor tab exactly once:

_.agHelper.GetObjectName().then((title) => expect(title).includes("Api"));

GetObjectName() is cy.get(".editor-tab.active .ads-v2-text").invoke("text"). Because
the value is consumed in a .then(), the read is never retried — the assertion sees
whatever the tab bar happened to render at that instant.

The tab swap after POST /api/v1/actions is not atomic:

  1. handleActionCreatedSaga (app/client/src/sagas/ApiPaneSagas.ts) pushes the new API
    route with editName=true.
  2. segmentMode only flips Add -> Edit on the next commit of useCurrentEditorState,
    so on the render right after the push, AddTab is still the active tab.
  3. The tab list itself is rewritten later still, by updateIDETabsOnRouteChangeSaga
    (app/client/src/sagas/IDESaga.tsx) via SET_IDE_QUERIES_TABS.

AddTab (app/client/src/pages/AppIDE/layouts/components/EditorTabs/AddTab.tsx) labels
itself New ${segmentName}, so inside that window the active tab reads "New Query"
which is exactly the value the failures report.

This PR re-reads the active tab until it settles on the new API. The route carries
editName=true, which mounts the tab in rename mode, and in that state ADS Text renders
an input rather than a text node (app/client/packages/design-system/ads/src/Text/Text.tsx)
— so the name is taken from data-value when present and from the text node otherwise.
Both states are covered, and the assertion retries through the whole transition.

Evidence

Mined from the last 12 test-build-docker-image runs on appsmithorg/appsmith-ee
(10 parsed, 600 shard logs) with .cursor/skills/cypress-flake-report:

Regression/ClientSide/OtherUIFeatures/GlobalSearch_spec.js — 4 retry events in 4 of 10
runs, all recovered on retry, i.e. invisible in the run status.

Two distinct signatures, both in test 7. This PR fixes the tab-name one:

run date failing command
31451657906 2026-08-11 assert expected New Query to include Api
31789468105 2026-08-14 assert expected New Query to include Api

Shard 47 in both, position 4 in the lineup, spec passed on the automatic retry. The
2026-08-14 command log shows the ordering directly — the failed assertion is logged
before new url .../edit/api/<id>?a=b&editName=true&from=datasources, so the read
happened while the editor was still routed to the add-new tab.

The other signature in that spec (data-selected on the sidebar Editor button, runs
31568260858 / 31625953107 / 31688250922) is a separate race in Sidebar.navigate and is
deliberately not touched here — that helper is called by hundreds of specs and the
mechanism is not yet proven.

Impact on existing instances

None. Test-only change, one spec file, no product code and no CI configuration.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Testing

Full Cypress suite via the automation command below. The change makes an existing
assertion auto-retrying; it does not weaken it — a tab that never reaches a name
containing Api still fails.

Automation

/ok-to-test tags="@tag.All"

Tracking: https://linear.app/appsmith/issue/APP-15705

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/31799791927
Commit: ad47fe7
Cypress dashboard.
Tags: @tag.All
Spec:


Fri, 14 Aug 2026 13:33:37 UTC

GlobalSearch_spec.js test 7 created an API from a datasource and then read
`.editor-tab.active .ads-v2-text` exactly once, through
agHelper.GetObjectName().invoke("text"). The read is not retried, so it
captured whatever the tab bar happened to be showing at that instant.

After POST /api/v1/actions the IDE does not swap the active tab atomically.
handleActionCreatedSaga pushes the new API route, but segmentMode only flips
Add -> Edit on the following commit of useCurrentEditorState, and the tab list
itself is only rewritten later still, by updateIDETabsOnRouteChangeSaga. For
that window AddTab is the active tab and its label is "New Query", so the
assertion read "New Query" and failed.

The active tab is now re-read until it settles on the new API. The route
carries editName=true, which mounts the tab in rename mode where ADS Text
renders an input instead of a text node, so the name is taken from data-value
when it is present and from the text node otherwise.
@wyattwalter wyattwalter added the ok-to-test Required label for CI label Aug 14, 2026
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d6c1a74d-205f-4ec3-823e-97c6d2e30f1f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions Bot added the Stale label Aug 21, 2026
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Warning

Your free Security trial is over. An organization admin can activate billing to continue.

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

Labels

ok-to-test Required label for CI Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant