Skip to content

wf: faster list, IDs-only output, and quieter port-forward teardown#1643

Open
JoshVanL wants to merge 2 commits into
dapr:masterfrom
JoshVanL:wf-list-faster
Open

wf: faster list, IDs-only output, and quieter port-forward teardown#1643
JoshVanL wants to merge 2 commits into
dapr:masterfrom
JoshVanL:wf-list-faster

Conversation

@JoshVanL
Copy link
Copy Markdown
Contributor

  • workflow list: fetch per-instance metadata concurrently via errgroup (cap 32 in-flight) instead of serially, which was the bottleneck for apps with many instances.
  • workflow list: add -o ids output, which skips the metadata fetch entirely and prints one instance ID per line. Errors out if combined with filters since those require metadata.
  • portforward: filter out the noisy klog "Unhandled Error" lines emitted
    by client-go during teardown for benign "broken pipe", "connection reset by peer", and "use of closed network connection" cases, while letting all other errors fall through to the default handlers.

- workflow list: fetch per-instance metadata concurrently via errgroup
  (cap 32 in-flight) instead of serially, which was the bottleneck for
  apps with many instances.
- workflow list: add `-o ids` output, which skips the metadata fetch
  entirely and prints one instance ID per line. Errors out if combined
  with filters since those require metadata.
- portforward: filter out the noisy klog "Unhandled Error" lines
emitted
  by client-go during teardown for benign "broken pipe", "connection
  reset by peer", and "use of closed network connection" cases, while
  letting all other errors fall through to the default handlers.

Signed-off-by: joshvanl <me@joshvanl.dev>
Copilot AI review requested due to automatic review settings May 12, 2026 20:25
@JoshVanL JoshVanL requested review from a team as code owners May 12, 2026 20:25
Copy link
Copy Markdown

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 improves workflow instance listing performance and ergonomics, and reduces noisy Kubernetes port-forward teardown logs in the CLI.

Changes:

  • Speed up workflow list by fetching per-instance workflow metadata concurrently (errgroup with a concurrency cap).
  • Add workflow list -o ids to print instance IDs only (skipping metadata fetch) and reject filters that require metadata.
  • Filter out known-benign “Unhandled Error” klog lines emitted by client-go during port-forward teardown, while preserving default handling for other errors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/workflow/list.go Adds ListIDs, introduces concurrent metadata fetch with an errgroup limit, and keeps output sorted.
pkg/kubernetes/portforward.go Wraps apimachinery global error handlers to suppress known-benign teardown error strings.
cmd/workflow/workflow.go Extends --output validation/usage to support additional formats (including ids).
cmd/workflow/list.go Implements -o ids output path and blocks combining it with metadata-dependent filters.
go.mod Promotes golang.org/x/sync to a direct dependency for errgroup usage.
Comments suppressed due to low confidence (1)

pkg/workflow/list.go:234

  • Because listOutput is built concurrently, its initial order is nondeterministic. The subsequent sort.SliceStable only compares Created, so workflows with identical Created timestamps will appear in a random order run-to-run. Add a deterministic tie-breaker (e.g., compare InstanceID when Created is equal) or preserve the original index when collecting results.
	sort.SliceStable(listOutput, func(i, j int) bool {
		if listOutput[i].Created.IsZero() {
			return false
		}
		if listOutput[j].Created.IsZero() {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/workflow/list.go
Comment thread pkg/kubernetes/portforward.go Outdated
Signed-off-by: joshvanl <me@joshvanl.dev>
Comment thread pkg/workflow/list.go
return nil, err
}

sort.Strings(ids)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it the default order by creation time? I think I'd keep it in whatever order we receive, the user can always sort if they need it sorted for any reason.

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.

3 participants