Skip to content

Resolve TOCTOU race condition in daily forecaster chart control click - #2127

Merged
peterzhuamazon merged 1 commit into
opensearch-project:3.8from
shreyah963:fix/daily-forecaster-race-condition
Aug 1, 2026
Merged

Resolve TOCTOU race condition in daily forecaster chart control click#2127
peterzhuamazon merged 1 commit into
opensearch-project:3.8from
shreyah963:fix/daily-forecaster-race-condition

Conversation

@shreyah963

Copy link
Copy Markdown
Contributor

Description

Fixes a race condition in daily_forecaster_spec.js where clickControlAndVerifyChartUpdate fails with cy.click() failed because this element is disabled on the "Zoom out" button.

The outer $body.find(":not(:disabled)") guard (line 32) is a synchronous jQuery snapshot. Between that check and the actual cy.get().click() (line 39), the async echChartStatus render-count fetch allows time for the chart to re-render and disable the button. Cypress then retries .click() on the disabled element until it times out.

Fix: Re-check :disabled state immediately before clicking using cy.get().then($btn), and only proceed with the click and render-count assertion if the button is still enabled. This eliminates the TOCTOU (time-of-check-to-time-of-use) gap.

Issues Resolved

opensearch-project/anomaly-detection-dashboards-plugin#1224

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…click

Signed-off-by: shreyah963 <shreyab963@gmail.com>
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@shreyah963
shreyah963 marked this pull request as ready for review August 1, 2026 04:00
@peterzhuamazon
peterzhuamazon merged commit 31219c6 into opensearch-project:3.8 Aug 1, 2026
59 of 60 checks passed
peterzhuamazon pushed a commit that referenced this pull request Aug 1, 2026
…click (#2127) (#2128)

(cherry picked from commit 31219c6)

Signed-off-by: shreyah963 <shreyab963@gmail.com>
Signed-off-by: opensearch-ci-bot <opensearch-infra@amazon.com>
Co-authored-by: Shreya Bhatta <shreyab963@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants