Skip to content

Conversation

@skynetigor
Copy link
Contributor

Summary

closes: https://github.com/elastic/security-team/issues/14414

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

Identify risks

Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging.

@skynetigor skynetigor requested a review from Copilot October 31, 2025 18:05
@skynetigor skynetigor added backport This PR is a backport of another PR release_note:skip Skip the PR/issue when compiling release notes Team:One Workflow Team label for One Workflow (Workflow automation) labels Oct 31, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements persistence for all workflow executions by introducing a distinction between test runs and production runs. The key change is adding an isTestRun boolean field to workflow executions instead of using the executionType field, allowing both test and production executions to be persisted in the database.

Key Changes

  • Modified filtering logic to use isTestRun field instead of executionType for distinguishing test and production workflow executions
  • Added support for testing workflows either by ID or YAML content
  • Updated the UI to intelligently choose between test execution (for modified workflows) and production execution (for unmodified workflows)

Reviewed Changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workflows_management_service.ts Updated execution filtering to use isTestRun boolean field instead of executionType
workflows_management_service.test.ts Added comprehensive tests for the new filtering logic
workflows_management_api.ts Enhanced testWorkflow to accept either workflowId or workflowYaml parameters
workflows_management_api.test.ts Added extensive test coverage for the updated test workflow functionality
routes/types.ts Added parseExecutionTypes helper function for parsing execution type query parameters
route_error_handlers.ts Added handling for WorkflowNotFoundError
post_test_workflow.ts Updated route validation to accept optional workflowId and workflowYaml
post_test_workflow.test.ts Updated tests to match new API signature
get_workflow_executions.ts Enabled execution type filtering
test_workflow_thunk.ts Modified to include workflowId when available
test_workflow_thunk.test.ts Added tests for workflow ID inclusion
run_workflow_thunk.ts New file implementing production workflow execution
run_workflow_thunk.test.ts New file with tests for production workflow execution
workflow_detail_test_modal.tsx Updated to conditionally use test or run workflow based on changes
workflow_detail_test_modal.test.tsx Updated tests for conditional execution logic
workflow_execution_repository.ts Changed to use createOrUpdateIndex for index management
workflows_execution_engine/common/index.ts Added isTestRun field to execution index mappings
workflow_not_found_error.ts New error class for missing workflows
errors/index.ts New index file exporting workflow error classes

type: 'text',
index: false,
},
isTestRun: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding isTestRun to mapping so that we can filter on in

if (this.indexInitialized) return; // Only 1 boolean check after first time

await createIndexWithMappings({
await createOrUpdateIndex({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing create with createOrUpdateIndex so that we can update index mapping with newly added fields.
It will fail upon attempt to change mapping type of an existing mapping field. Just FYI

@skynetigor skynetigor marked this pull request as ready for review October 31, 2025 18:10
@skynetigor skynetigor requested a review from a team as a code owner October 31, 2025 18:10
@skynetigor skynetigor changed the title [One Workflow] feat: Persist all workflow execution [One Workflow] feat: Link test executions to workflow Oct 31, 2025
@elasticmachine
Copy link
Contributor

💔 Build Failed

Failed CI Steps

History

cc @skynetigor

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

Labels

backport This PR is a backport of another PR release_note:skip Skip the PR/issue when compiling release notes Team:One Workflow Team label for One Workflow (Workflow automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants