Skip to content

test(wfctl): cover plugin search output formatter#720

Merged
intel352 merged 1 commit into
mainfrom
fix/wfctl-search-output-coverage
May 19, 2026
Merged

test(wfctl): cover plugin search output formatter#720
intel352 merged 1 commit into
mainfrom
fix/wfctl-search-output-coverage

Conversation

@intel352
Copy link
Copy Markdown
Contributor

Summary

  • Extract wfctl plugin search output renderer to formatPluginSearchResults helper.
  • Add 4 unit tests covering header, status fallback, description truncation, and field propagation.
  • Closes the codecov/patch gap that forced an admin-override on workflow#715.

Test plan

  • GOWORK=off go test ./cmd/wfctl/... exit 0 (60s, all tests green).
  • GOWORK=off go vet ./cmd/wfctl/... exit 0.
  • No behaviour change: runPluginSearch still prints the same table.

🤖 Generated with Claude Code

Extract the wfctl plugin search table renderer into
`formatPluginSearchResults` so it can be unit-tested without capturing
stdout. The original inline `fmt.Printf` block had zero coverage,
causing the codecov/patch gate to FAIL on workflow#715 (42.85% diff
coverage vs 63.64% target) and forcing an admin-override merge.

This PR closes that follow-up:
- Pure helper returning a string is trivially testable.
- Four tests cover: header columns, status fallback, description
  truncation, and field/order propagation.

No behaviour change: runPluginSearch still calls fmt.Print on the same
formatted output.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 19, 2026 18:17
Copy link
Copy Markdown
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 improves test coverage for the wfctl plugin search output by extracting the table rendering logic into a helper function and adding focused unit tests, closing a patch coverage gap.

Changes:

  • Extracted wfctl plugin search table rendering into formatPluginSearchResults.
  • Updated runPluginSearch to print the rendered output from the new formatter helper.
  • Added unit tests covering header output, status fallback behavior, description truncation, and field/order propagation.

Reviewed changes

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

File Description
cmd/wfctl/plugin_install.go Extracts the plugin search table renderer into formatPluginSearchResults and uses it from runPluginSearch.
cmd/wfctl/plugin_search_format_test.go Adds unit tests to validate plugin search output formatting behavior.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cmd/wfctl/plugin_install.go 75.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

⏱ Benchmark Results

No significant performance regressions detected.

benchstat comparison (baseline → PR)
## benchstat: baseline → PR
baseline-bench.txt:274: parsing iteration count: invalid syntax
baseline-bench.txt:296741: parsing iteration count: invalid syntax
baseline-bench.txt:597300: parsing iteration count: invalid syntax
baseline-bench.txt:904753: parsing iteration count: invalid syntax
baseline-bench.txt:1238807: parsing iteration count: invalid syntax
baseline-bench.txt:1567536: parsing iteration count: invalid syntax
benchmark-results.txt:274: parsing iteration count: invalid syntax
benchmark-results.txt:252572: parsing iteration count: invalid syntax
benchmark-results.txt:570540: parsing iteration count: invalid syntax
benchmark-results.txt:878395: parsing iteration count: invalid syntax
benchmark-results.txt:1159730: parsing iteration count: invalid syntax
benchmark-results.txt:1448739: parsing iteration count: invalid syntax
goos: linux
goarch: amd64
pkg: github.com/GoCodeAlone/workflow/dynamic
cpu: AMD EPYC 7763 64-Core Processor                
                            │ benchmark-results.txt │
                            │        sec/op         │
InterpreterCreation-4                  9.097m ± 65%
ComponentLoad-4                        3.740m ±  2%
ComponentExecute-4                     1.980µ ±  1%
PoolContention/workers-1-4             1.114µ ±  3%
PoolContention/workers-2-4             1.110µ ±  4%
PoolContention/workers-4-4             1.107µ ±  2%
PoolContention/workers-8-4             1.129µ ±  1%
PoolContention/workers-16-4            1.132µ ±  2%
ComponentLifecycle-4                   3.982m ±  3%
SourceValidation-4                     2.391µ ±  2%
RegistryConcurrent-4                   792.3n ±  4%
LoaderLoadFromString-4                 3.947m ±  6%
geomean                                19.74µ

                            │ benchmark-results.txt │
                            │         B/op          │
InterpreterCreation-4                  2.027Mi ± 0%
ComponentLoad-4                        2.180Mi ± 0%
ComponentExecute-4                     1.203Ki ± 0%
PoolContention/workers-1-4             1.203Ki ± 0%
PoolContention/workers-2-4             1.203Ki ± 0%
PoolContention/workers-4-4             1.203Ki ± 0%
PoolContention/workers-8-4             1.203Ki ± 0%
PoolContention/workers-16-4            1.203Ki ± 0%
ComponentLifecycle-4                   2.183Mi ± 0%
SourceValidation-4                     1.984Ki ± 0%
RegistryConcurrent-4                   1.133Ki ± 0%
LoaderLoadFromString-4                 2.182Mi ± 0%
geomean                                15.25Ki

                            │ benchmark-results.txt │
                            │       allocs/op       │
InterpreterCreation-4                   15.68k ± 0%
ComponentLoad-4                         18.02k ± 0%
ComponentExecute-4                       25.00 ± 0%
PoolContention/workers-1-4               25.00 ± 0%
PoolContention/workers-2-4               25.00 ± 0%
PoolContention/workers-4-4               25.00 ± 0%
PoolContention/workers-8-4               25.00 ± 0%
PoolContention/workers-16-4              25.00 ± 0%
ComponentLifecycle-4                    18.07k ± 0%
SourceValidation-4                       32.00 ± 0%
RegistryConcurrent-4                     2.000 ± 0%
LoaderLoadFromString-4                  18.06k ± 0%
geomean                                  183.3

cpu: AMD EPYC 9V74 80-Core Processor                
                            │ baseline-bench.txt │
                            │       sec/op       │
InterpreterCreation-4               7.537m ± 60%
ComponentLoad-4                     3.534m ±  9%
ComponentExecute-4                  1.844µ ±  1%
PoolContention/workers-1-4          1.020µ ±  1%
PoolContention/workers-2-4          1.015µ ±  1%
PoolContention/workers-4-4          1.018µ ±  2%
PoolContention/workers-8-4          1.013µ ±  1%
PoolContention/workers-16-4         1.013µ ±  2%
ComponentLifecycle-4                3.559m ±  1%
SourceValidation-4                  2.087µ ±  1%
RegistryConcurrent-4                735.5n ±  5%
LoaderLoadFromString-4              3.593m ±  1%
geomean                             17.84µ

                            │ baseline-bench.txt │
                            │        B/op        │
InterpreterCreation-4               2.027Mi ± 0%
ComponentLoad-4                     2.180Mi ± 0%
ComponentExecute-4                  1.203Ki ± 0%
PoolContention/workers-1-4          1.203Ki ± 0%
PoolContention/workers-2-4          1.203Ki ± 0%
PoolContention/workers-4-4          1.203Ki ± 0%
PoolContention/workers-8-4          1.203Ki ± 0%
PoolContention/workers-16-4         1.203Ki ± 0%
ComponentLifecycle-4                2.183Mi ± 0%
SourceValidation-4                  1.984Ki ± 0%
RegistryConcurrent-4                1.133Ki ± 0%
LoaderLoadFromString-4              2.182Mi ± 0%
geomean                             15.25Ki

                            │ baseline-bench.txt │
                            │     allocs/op      │
InterpreterCreation-4                15.68k ± 0%
ComponentLoad-4                      18.02k ± 0%
ComponentExecute-4                    25.00 ± 0%
PoolContention/workers-1-4            25.00 ± 0%
PoolContention/workers-2-4            25.00 ± 0%
PoolContention/workers-4-4            25.00 ± 0%
PoolContention/workers-8-4            25.00 ± 0%
PoolContention/workers-16-4           25.00 ± 0%
ComponentLifecycle-4                 18.07k ± 0%
SourceValidation-4                    32.00 ± 0%
RegistryConcurrent-4                  2.000 ± 0%
LoaderLoadFromString-4               18.06k ± 0%
geomean                               183.3

pkg: github.com/GoCodeAlone/workflow/middleware
cpu: AMD EPYC 7763 64-Core Processor                
                                  │ benchmark-results.txt │
                                  │        sec/op         │
CircuitBreakerDetection-4                     287.8n ± 4%
CircuitBreakerExecution_Success-4             21.44n ± 0%
CircuitBreakerExecution_Failure-4             66.82n ± 1%
geomean                                       74.43n

                                  │ benchmark-results.txt │
                                  │         B/op          │
CircuitBreakerDetection-4                    144.0 ± 0%
CircuitBreakerExecution_Success-4            0.000 ± 0%
CircuitBreakerExecution_Failure-4            0.000 ± 0%
geomean                                                 ¹
¹ summaries must be >0 to compute geomean

                                  │ benchmark-results.txt │
                                  │       allocs/op       │
CircuitBreakerDetection-4                    1.000 ± 0%
CircuitBreakerExecution_Success-4            0.000 ± 0%
CircuitBreakerExecution_Failure-4            0.000 ± 0%
geomean                                                 ¹
¹ summaries must be >0 to compute geomean

cpu: AMD EPYC 9V74 80-Core Processor                
                                  │ baseline-bench.txt │
                                  │       sec/op       │
CircuitBreakerDetection-4                  299.1n ± 7%
CircuitBreakerExecution_Success-4          22.65n ± 0%
CircuitBreakerExecution_Failure-4          70.93n ± 0%
geomean                                    78.33n

                                  │ baseline-bench.txt │
                                  │        B/op        │
CircuitBreakerDetection-4                 144.0 ± 0%
CircuitBreakerExecution_Success-4         0.000 ± 0%
CircuitBreakerExecution_Failure-4         0.000 ± 0%
geomean                                              ¹
¹ summaries must be >0 to compute geomean

                                  │ baseline-bench.txt │
                                  │     allocs/op      │
CircuitBreakerDetection-4                 1.000 ± 0%
CircuitBreakerExecution_Success-4         0.000 ± 0%
CircuitBreakerExecution_Failure-4         0.000 ± 0%
geomean                                              ¹
¹ summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/module
cpu: AMD EPYC 7763 64-Core Processor                
                                 │ benchmark-results.txt │
                                 │        sec/op         │
IaCStateBackend_InProcess-4                 315.8n ±  9%
IaCStateBackend_GRPC-4                      9.759m ±  5%
JQTransform_Simple-4                        681.8n ± 37%
JQTransform_ObjectConstruction-4            1.559µ ±  1%
JQTransform_ArraySelect-4                   3.623µ ±  3%
JQTransform_Complex-4                       40.22µ ±  2%
JQTransform_Throughput-4                    1.937µ ±  2%
SSEPublishDelivery-4                        70.15n ±  1%
geomean                                     3.995µ

                                 │ benchmark-results.txt │
                                 │         B/op          │
IaCStateBackend_InProcess-4                 416.0 ± 0%
IaCStateBackend_GRPC-4                    5.845Mi ± 9%
JQTransform_Simple-4                      1.273Ki ± 0%
JQTransform_ObjectConstruction-4          1.773Ki ± 0%
JQTransform_ArraySelect-4                 2.625Ki ± 0%
JQTransform_Complex-4                     16.22Ki ± 0%
JQTransform_Throughput-4                  1.984Ki ± 0%
SSEPublishDelivery-4                        0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

                                 │ benchmark-results.txt │
                                 │       allocs/op       │
IaCStateBackend_InProcess-4                 2.000 ± 0%
IaCStateBackend_GRPC-4                     6.838k ± 0%
JQTransform_Simple-4                        10.00 ± 0%
JQTransform_ObjectConstruction-4            15.00 ± 0%
JQTransform_ArraySelect-4                   30.00 ± 0%
JQTransform_Complex-4                       324.0 ± 0%
JQTransform_Throughput-4                    17.00 ± 0%
SSEPublishDelivery-4                        0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

cpu: AMD EPYC 9V74 80-Core Processor                
                                 │ baseline-bench.txt │
                                 │       sec/op       │
IaCStateBackend_InProcess-4              301.5n ± 25%
IaCStateBackend_GRPC-4                   10.30m ± 11%
JQTransform_Simple-4                     648.1n ± 35%
JQTransform_ObjectConstruction-4         1.484µ ±  1%
JQTransform_ArraySelect-4                3.571µ ±  3%
JQTransform_Complex-4                    42.97µ ±  2%
JQTransform_Throughput-4                 1.830µ ±  1%
SSEPublishDelivery-4                     65.03n ±  0%
geomean                                  3.909µ

                                 │ baseline-bench.txt │
                                 │        B/op        │
IaCStateBackend_InProcess-4              416.0 ± 0%
IaCStateBackend_GRPC-4                 5.791Mi ± 9%
JQTransform_Simple-4                   1.273Ki ± 0%
JQTransform_ObjectConstruction-4       1.773Ki ± 0%
JQTransform_ArraySelect-4              2.625Ki ± 0%
JQTransform_Complex-4                  16.22Ki ± 0%
JQTransform_Throughput-4               1.984Ki ± 0%
SSEPublishDelivery-4                     0.000 ± 0%
geomean                                             ¹
¹ summaries must be >0 to compute geomean

                                 │ baseline-bench.txt │
                                 │     allocs/op      │
IaCStateBackend_InProcess-4              2.000 ± 0%
IaCStateBackend_GRPC-4                  6.862k ± 0%
JQTransform_Simple-4                     10.00 ± 0%
JQTransform_ObjectConstruction-4         15.00 ± 0%
JQTransform_ArraySelect-4                30.00 ± 0%
JQTransform_Complex-4                    324.0 ± 0%
JQTransform_Throughput-4                 17.00 ± 0%
SSEPublishDelivery-4                     0.000 ± 0%
geomean                                             ¹
¹ summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/schema
cpu: AMD EPYC 7763 64-Core Processor                
                                    │ benchmark-results.txt │
                                    │        sec/op         │
SchemaValidation_Simple-4                      1.107µ ±  2%
SchemaValidation_AllFields-4                   1.667µ ± 16%
SchemaValidation_FormatValidation-4            1.607µ ±  2%
SchemaValidation_ManySchemas-4                 1.821µ ±  4%
geomean                                        1.524µ

                                    │ benchmark-results.txt │
                                    │         B/op          │
SchemaValidation_Simple-4                      0.000 ± 0%
SchemaValidation_AllFields-4                   0.000 ± 0%
SchemaValidation_FormatValidation-4            0.000 ± 0%
SchemaValidation_ManySchemas-4                 0.000 ± 0%
geomean                                                   ¹
¹ summaries must be >0 to compute geomean

                                    │ benchmark-results.txt │
                                    │       allocs/op       │
SchemaValidation_Simple-4                      0.000 ± 0%
SchemaValidation_AllFields-4                   0.000 ± 0%
SchemaValidation_FormatValidation-4            0.000 ± 0%
SchemaValidation_ManySchemas-4                 0.000 ± 0%
geomean                                                   ¹
¹ summaries must be >0 to compute geomean

cpu: AMD EPYC 9V74 80-Core Processor                
                                    │ baseline-bench.txt │
                                    │       sec/op       │
SchemaValidation_Simple-4                   1.073µ ± 19%
SchemaValidation_AllFields-4                1.653µ ±  4%
SchemaValidation_FormatValidation-4         1.565µ ±  1%
SchemaValidation_ManySchemas-4              1.593µ ±  2%
geomean                                     1.450µ

                                    │ baseline-bench.txt │
                                    │        B/op        │
SchemaValidation_Simple-4                   0.000 ± 0%
SchemaValidation_AllFields-4                0.000 ± 0%
SchemaValidation_FormatValidation-4         0.000 ± 0%
SchemaValidation_ManySchemas-4              0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

                                    │ baseline-bench.txt │
                                    │     allocs/op      │
SchemaValidation_Simple-4                   0.000 ± 0%
SchemaValidation_AllFields-4                0.000 ± 0%
SchemaValidation_FormatValidation-4         0.000 ± 0%
SchemaValidation_ManySchemas-4              0.000 ± 0%
geomean                                                ¹
¹ summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/store
cpu: AMD EPYC 7763 64-Core Processor                
                                   │ benchmark-results.txt │
                                   │        sec/op         │
EventStoreAppend_InMemory-4                   1.234µ ± 16%
EventStoreAppend_SQLite-4                     1.353m ±  3%
GetTimeline_InMemory/events-10-4              15.24µ ±  4%
GetTimeline_InMemory/events-50-4              84.37µ ±  4%
GetTimeline_InMemory/events-100-4             161.3µ ± 16%
GetTimeline_InMemory/events-500-4             694.4µ ±  1%
GetTimeline_InMemory/events-1000-4            1.418m ±  2%
GetTimeline_SQLite/events-10-4                115.0µ ±  1%
GetTimeline_SQLite/events-50-4                274.4µ ±  1%
GetTimeline_SQLite/events-100-4               468.4µ ±  2%
GetTimeline_SQLite/events-500-4               1.986m ±  3%
GetTimeline_SQLite/events-1000-4              3.843m ±  4%
geomean                                       241.0µ

                                   │ benchmark-results.txt │
                                   │         B/op          │
EventStoreAppend_InMemory-4                     825.5 ± 8%
EventStoreAppend_SQLite-4                     1.984Ki ± 2%
GetTimeline_InMemory/events-10-4              7.953Ki ± 0%
GetTimeline_InMemory/events-50-4              46.62Ki ± 0%
GetTimeline_InMemory/events-100-4             94.48Ki ± 0%
GetTimeline_InMemory/events-500-4             472.8Ki ± 0%
GetTimeline_InMemory/events-1000-4            944.3Ki ± 0%
GetTimeline_SQLite/events-10-4                16.74Ki ± 0%
GetTimeline_SQLite/events-50-4                87.14Ki ± 0%
GetTimeline_SQLite/events-100-4               175.4Ki ± 0%
GetTimeline_SQLite/events-500-4               846.1Ki ± 0%
GetTimeline_SQLite/events-1000-4              1.639Mi ± 0%
geomean                                       67.59Ki

                                   │ benchmark-results.txt │
                                   │       allocs/op       │
EventStoreAppend_InMemory-4                     7.000 ± 0%
EventStoreAppend_SQLite-4                       53.00 ± 0%
GetTimeline_InMemory/events-10-4                125.0 ± 0%
GetTimeline_InMemory/events-50-4                653.0 ± 0%
GetTimeline_InMemory/events-100-4              1.306k ± 0%
GetTimeline_InMemory/events-500-4              6.514k ± 0%
GetTimeline_InMemory/events-1000-4             13.02k ± 0%
GetTimeline_SQLite/events-10-4                  382.0 ± 0%
GetTimeline_SQLite/events-50-4                 1.852k ± 0%
GetTimeline_SQLite/events-100-4                3.681k ± 0%
GetTimeline_SQLite/events-500-4                18.54k ± 0%
GetTimeline_SQLite/events-1000-4               37.29k ± 0%
geomean                                        1.162k

cpu: AMD EPYC 9V74 80-Core Processor                
                                   │ baseline-bench.txt │
                                   │       sec/op       │
EventStoreAppend_InMemory-4                1.087µ ± 17%
EventStoreAppend_SQLite-4                  1.021m ±  1%
GetTimeline_InMemory/events-10-4           12.59µ ±  3%
GetTimeline_InMemory/events-50-4           69.76µ ± 20%
GetTimeline_InMemory/events-100-4          110.1µ ±  1%
GetTimeline_InMemory/events-500-4          562.0µ ±  6%
GetTimeline_InMemory/events-1000-4         1.143m ±  1%
GetTimeline_SQLite/events-10-4             83.60µ ±  1%
GetTimeline_SQLite/events-50-4             219.7µ ±  1%
GetTimeline_SQLite/events-100-4            382.8µ ±  1%
GetTimeline_SQLite/events-500-4            1.668m ±  1%
GetTimeline_SQLite/events-1000-4           3.241m ±  1%
geomean                                    192.7µ

                                   │ baseline-bench.txt │
                                   │        B/op        │
EventStoreAppend_InMemory-4                 782.0 ± 11%
EventStoreAppend_SQLite-4                 1.984Ki ±  2%
GetTimeline_InMemory/events-10-4          7.953Ki ±  0%
GetTimeline_InMemory/events-50-4          46.62Ki ±  0%
GetTimeline_InMemory/events-100-4         94.48Ki ±  0%
GetTimeline_InMemory/events-500-4         472.8Ki ±  0%
GetTimeline_InMemory/events-1000-4        944.3Ki ±  0%
GetTimeline_SQLite/events-10-4            16.74Ki ±  0%
GetTimeline_SQLite/events-50-4            87.14Ki ±  0%
GetTimeline_SQLite/events-100-4           175.4Ki ±  0%
GetTimeline_SQLite/events-500-4           846.1Ki ±  0%
GetTimeline_SQLite/events-1000-4          1.639Mi ±  0%
geomean                                   67.29Ki

                                   │ baseline-bench.txt │
                                   │     allocs/op      │
EventStoreAppend_InMemory-4                  7.000 ± 0%
EventStoreAppend_SQLite-4                    53.00 ± 0%
GetTimeline_InMemory/events-10-4             125.0 ± 0%
GetTimeline_InMemory/events-50-4             653.0 ± 0%
GetTimeline_InMemory/events-100-4           1.306k ± 0%
GetTimeline_InMemory/events-500-4           6.514k ± 0%
GetTimeline_InMemory/events-1000-4          13.02k ± 0%
GetTimeline_SQLite/events-10-4               382.0 ± 0%
GetTimeline_SQLite/events-50-4              1.852k ± 0%
GetTimeline_SQLite/events-100-4             3.681k ± 0%
GetTimeline_SQLite/events-500-4             18.54k ± 0%
GetTimeline_SQLite/events-1000-4            37.29k ± 0%
geomean                                     1.162k

Benchmarks run with go test -bench=. -benchmem -count=6.
Regressions ≥ 20% are flagged. Results compared via benchstat.

@intel352 intel352 merged commit d59682b into main May 19, 2026
26 checks passed
@intel352 intel352 deleted the fix/wfctl-search-output-coverage branch May 19, 2026 18:30
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