Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block simulate API calls if datasource version is missing #657

Merged
merged 5 commits into from
Mar 4, 2025

Conversation

ohltyler
Copy link
Member

@ohltyler ohltyler commented Feb 28, 2025

Description

If there is a datasource ID, but no known version found, we cannot guarantee that the simulate API will be available. This PR adds a reusable custom hook to check for that scenario, and adds conditional checks for all places where simulatePipeline() is called:

  • WorkflowInputs component
  • Configure expression modal
  • Configure multi-expression modal
  • Configure template (prompt) modal

To make this work, getEffectiveVersion() was updated slightly to return undefined instead of defaulting to the minimum version, since this undefined/empty case now needs to be handled. Audited all places where getEffectiveVersion is called, where a minimum version is wanted, and updated there. Updated the name to getDataSourceVersion() to reflect this more clearly as well.

Also moves datasource-related logic into custom hooks for readability and reusability.

Also removes unnecessary '- required' text on quick config required fields to follow consistent pattern.

Testing

  • tested for all 4 scenarios that behavior was expected, if data source version was missing or not. Used dummy data source IDs to trigger

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.

ohltyler added 2 commits March 3, 2025 10:15
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
ohltyler added 3 commits March 3, 2025 11:04
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
@ohltyler ohltyler marked this pull request as ready for review March 3, 2025 19:56
@saimedhi saimedhi merged commit 1d0fea7 into opensearch-project:2.x Mar 4, 2025
5 of 6 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 4, 2025
* Block simulate on ingest if version not foundg

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* more cleanup after rebase

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Add checks in all modals

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* Set defaults for calls of getEffectiveVesion

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

* rename fn

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>

---------

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
(cherry picked from commit 1d0fea7)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
saimedhi pushed a commit that referenced this pull request Mar 4, 2025
* Block simulate on ingest if version not foundg



* more cleanup after rebase



* Add checks in all modals



* Set defaults for calls of getEffectiveVesion



* rename fn



---------


(cherry picked from commit 1d0fea7)

Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@ohltyler ohltyler deleted the hide-simulate branch March 4, 2025 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport main enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants