From 3f040efd9edb0d7b68bc574c5d495611d9f580e9 Mon Sep 17 00:00:00 2001 From: Steve Kilduff Date: Tue, 22 Sep 2026 12:13:41 +0100 Subject: [PATCH] feat: search workflow executions by correlation ID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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 = ""` 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) --- CLAUDE.md | 8 ++++- README.md | 1 + cmd/execution_test.go | 70 ++++++++++++++++++++++++++++++++++++++++++- cmd/workflow.go | 65 +++++++++++++++++++++++++--------------- test/e2e/search.bats | 42 ++++++++++++++++++++++---- 5 files changed, 155 insertions(+), 31 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 51f3ae2..88a67ba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -162,7 +162,7 @@ background process on port 8080. | `workflow start --sync` | Start and wait for completion | None | `--workflow`, `--input`, `--file`, `--wait-until` | `conductor workflow start --workflow my_workflow --sync` | | `workflow status ` | Get execution status | workflow ID | | `conductor workflow status abc-123` | | `workflow get-execution ` | Get full execution details | workflow ID | `--complete` | `conductor workflow get-execution abc-123` | -| `workflow search` | Search executions | None | `--workflow`, `--status`, `--count`, `--start-time-after`, `--start-time-before`, `--json` | `conductor workflow search --workflow my_workflow --status FAILED` | +| `workflow search` | Search executions | None | `--workflow`, `--status`, `--correlation-id`, `--count`, `--start-time-after`, `--start-time-before`, `--json` | `conductor workflow search --workflow my_workflow --status FAILED` | | `workflow terminate ` | Terminate execution | workflow ID | | `conductor workflow terminate abc-123` | | `workflow pause ` | Pause execution | workflow ID | | `conductor workflow pause abc-123` | | `workflow resume ` | Resume paused execution | workflow ID | | `conductor workflow resume abc-123` | @@ -713,9 +713,14 @@ conductor workflow search --workflow my_workflow \ --start-time-after "2025-01-01" \ --start-time-before "2025-01-31" +# Find every execution tagged with a correlation ID at start time +conductor workflow start --workflow my_workflow --correlation "order-12345" +conductor workflow search --correlation-id "order-12345" + # Combine filters conductor workflow search --workflow my_workflow \ --status RUNNING \ + --correlation-id "order-12345" \ --start-time-after "2025-01-01 10:00:00" \ --count 100 ``` @@ -723,6 +728,7 @@ conductor workflow search --workflow my_workflow \ **Search flags:** - `--workflow ` - Filter by workflow name - `--status ` - Filter by status (COMPLETED, FAILED, RUNNING, PAUSED, TERMINATED, TIMED_OUT) +- `--correlation-id ` - Filter by correlation ID, the value given to `workflow start --correlation`. Matched exactly; quote ids containing spaces. - `--count ` - Number of results (max 1000, default 10) - `--start-time-after