wf: faster list, IDs-only output, and quieter port-forward teardown#1643
wf: faster list, IDs-only output, and quieter port-forward teardown#1643JoshVanL wants to merge 3 commits into
Conversation
- 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>
There was a problem hiding this comment.
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 listby fetching per-instance workflow metadata concurrently (errgroup with a concurrency cap). - Add
workflow list -o idsto 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
listOutputis built concurrently, its initial order is nondeterministic. The subsequentsort.SliceStableonly comparesCreated, so workflows with identicalCreatedtimestamps will appear in a random order run-to-run. Add a deterministic tie-breaker (e.g., compareInstanceIDwhenCreatedis 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.
Signed-off-by: joshvanl <me@joshvanl.dev>
| return nil, err | ||
| } | ||
|
|
||
| sort.Strings(ids) |
There was a problem hiding this comment.
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.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1643 +/- ##
==========================================
+ Coverage 15.15% 15.57% +0.41%
==========================================
Files 64 64
Lines 7191 7244 +53
==========================================
+ Hits 1090 1128 +38
- Misses 6016 6028 +12
- Partials 85 88 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
-o idsoutput, which skips the metadata fetch entirely and prints one instance ID per line. Errors out if combined with filters since those require metadata.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.