Skip to content

feat: search workflow executions by correlation ID - #125

Open
liketed wants to merge 1 commit into
mainfrom
feat/enable-search-with-correlation-id
Open

liketed wants to merge 1 commit into
mainfrom
feat/enable-search-with-correlation-id

Conversation

@liketed

@liketed liketed commented Sep 22, 2026

Copy link
Copy Markdown

workflow start --correlation tags an execution, but there was no way to find those executions again — search filtered on name, status and start time only. Add workflow search --correlation-id, which emits a correlationId = "<value>" clause ANDed with the existing filters.

The value is quoted so ids containing spaces reach the server as a single term rather than being split by its query parser.

Filter assembly moves out of the command handler into buildWorkflowSearchQuery so it can be unit tested directly; the e2e search suite now tags its fixture execution and searches for it by correlation ID.

`workflow start --correlation` tags an execution, but there was no way to
find those executions again — search filtered on name, status and start
time only. Add `workflow search --correlation-id`, which emits a
`correlationId = "<value>"` clause ANDed with the existing filters.

The value is quoted so ids containing spaces reach the server as a single
term rather than being split by its query parser.

Filter assembly moves out of the command handler into
buildWorkflowSearchQuery so it can be unit tested directly; the e2e search
suite now tags its fixture execution and searches for it by correlation ID.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@liketed
liketed requested a review from mp-orkes September 25, 2026 10:14

@mp-orkes mp-orkes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ready to merge after fixes.

  • Works for normal ids. Existing filters produce the same query as before. Build and unit tests pass.
  • Should fix: the correlation id is inserted into the query unescaped (cmd/workflow.go:836-838). Results depend on the backend:
    • Elasticsearch/OpenSearch: an id containing " cuts the value short, and \ is dropped.
    • Postgres/SQLite: a comma causes an SQL error or no match, * becomes a wildcard, quotes and brackets are stripped, and AND adds a bogus condition.
    • Orkes: an apostrophe ends the value early and the parse fails.
    • Suggested fix: reject ", ', \, ,, (, ) and AND in the CLI with a clear error, and add unit tests for each.
  • Should fix: CLAUDE.md says "Matched exactly", but * acts as a wildcard on some backends. Update the wording to match the validation.
  • Minor: --correlation-id "" is silently ignored, so the search returns everything.
  • Minor: no unit test pins the old query strings for a single filter.
  • Minor: the e2e fixture uses a fixed correlation id. A run-unique suffix would avoid matching leftovers on the shared server.
  • Minor: missing blank line before TestBuildWorkflowSearchQuery (cmd/execution_test.go:182).

@mp-orkes

mp-orkes commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

And ready to merge once CI is green as well Failing bats test "not ok 104 5. Update secret with new value" seems to be unrelated.

@liketed let me know if the requested changes make sense and ping when it's ready for review again.

@liketed

liketed commented Oct 7, 2026

Copy link
Copy Markdown
Author

Requested changes make sense, need to convert feedback to code which may take some time

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.

2 participants