Skip to content

fix(wfctl): add log follow completion grace#749

Merged
intel352 merged 1 commit into
mainfrom
fix/log-capture-grace
May 21, 2026
Merged

fix(wfctl): add log follow completion grace#749
intel352 merged 1 commit into
mainfrom
fix/log-capture-grace

Conversation

@intel352
Copy link
Copy Markdown
Contributor

Summary

  • keep provider follow duration unchanged
  • add a 30s client-side grace window so bounded log captures can finish and return EOF instead of racing the RPC deadline
  • add regression coverage for the grace behavior

Verification

  • GOWORK=off go test ./cmd/wfctl -run 'TestLogsCaptureFollowContextAllowsProviderCompletionGrace|TestLogsCaptureFollowSetsDuration' -count=1
  • GOWORK=off go test ./cmd/wfctl -count=1

Copilot AI review requested due to automatic review settings May 21, 2026 05:52
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

Adds a client-side “completion grace” window to wfctl logs capture --follow --duration … so bounded log capture sessions can finish cleanly (EOF) instead of racing the RPC deadline, while keeping the provider-side follow duration unchanged.

Changes:

  • Extend the CaptureLogs call context timeout by a fixed 30s grace beyond the requested --duration.
  • Add regression test coverage asserting the provider sees a deadline that exceeds the requested follow duration, while DurationSeconds remains unchanged.

Reviewed changes

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

File Description
cmd/wfctl/logs.go Adds a 30s client-side grace to the follow context timeout without changing the provider request duration.
cmd/wfctl/logs_test.go Adds a regression test that inspects the provider’s context deadline/remaining time to validate the grace behavior.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 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:276: parsing iteration count: invalid syntax
baseline-bench.txt:300973: parsing iteration count: invalid syntax
baseline-bench.txt:594353: parsing iteration count: invalid syntax
baseline-bench.txt:907203: parsing iteration count: invalid syntax
baseline-bench.txt:1240150: parsing iteration count: invalid syntax
baseline-bench.txt:1570784: parsing iteration count: invalid syntax
benchmark-results.txt:276: parsing iteration count: invalid syntax
benchmark-results.txt:515482: parsing iteration count: invalid syntax
benchmark-results.txt:812501: parsing iteration count: invalid syntax
benchmark-results.txt:1128672: parsing iteration count: invalid syntax
benchmark-results.txt:1398901: parsing iteration count: invalid syntax
benchmark-results.txt:1702562: 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                  6.378m ± 61%
ComponentLoad-4                        3.559m ±  7%
ComponentExecute-4                     1.907µ ±  1%
PoolContention/workers-1-4             1.074µ ±  6%
PoolContention/workers-2-4             1.067µ ±  2%
PoolContention/workers-4-4             1.089µ ±  3%
PoolContention/workers-8-4             1.094µ ±  1%
PoolContention/workers-16-4            1.075µ ±  1%
ComponentLifecycle-4                   3.573m ±  0%
SourceValidation-4                     2.329µ ±  1%
RegistryConcurrent-4                   782.9n ±  3%
LoaderLoadFromString-4                 3.591m ±  0%
geomean                                18.38µ

                            │ 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               5.637m ± 84%
ComponentLoad-4                     3.531m ±  2%
ComponentExecute-4                  1.845µ ±  2%
PoolContention/workers-1-4          1.016µ ±  1%
PoolContention/workers-2-4          1.030µ ±  1%
PoolContention/workers-4-4          1.004µ ±  1%
PoolContention/workers-8-4          1.014µ ±  1%
PoolContention/workers-16-4         1.015µ ±  2%
ComponentLifecycle-4                3.536m ±  1%
SourceValidation-4                  2.106µ ±  2%
RegistryConcurrent-4                760.9n ±  4%
LoaderLoadFromString-4              3.609m ±  2%
geomean                             17.48µ

                            │ 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                     284.6n ± 6%
CircuitBreakerExecution_Success-4             21.55n ± 0%
CircuitBreakerExecution_Failure-4             66.09n ± 0%
geomean                                       74.01n

                                  │ 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                 298.3n ± 14%
CircuitBreakerExecution_Success-4         22.66n ±  2%
CircuitBreakerExecution_Failure-4         70.92n ±  0%
geomean                                   78.27n

                                  │ 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                 318.1n ± 23%
IaCStateBackend_GRPC-4                      9.418m ±  4%
JQTransform_Simple-4                        655.6n ± 38%
JQTransform_ObjectConstruction-4            1.512µ ±  1%
JQTransform_ArraySelect-4                   3.412µ ±  1%
JQTransform_Complex-4                       38.88µ ±  3%
JQTransform_Throughput-4                    1.840µ ±  0%
SSEPublishDelivery-4                        64.62n ±  1%
geomean                                     3.836µ

                                 │ benchmark-results.txt │
                                 │         B/op          │
IaCStateBackend_InProcess-4                416.0 ±  0%
IaCStateBackend_GRPC-4                   5.842Mi ± 15%
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.837k ± 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.0n ± 18%
IaCStateBackend_GRPC-4                   10.21m ±  1%
JQTransform_Simple-4                     646.8n ± 38%
JQTransform_ObjectConstruction-4         1.487µ ±  3%
JQTransform_ArraySelect-4                3.553µ ±  4%
JQTransform_Complex-4                    42.02µ ±  1%
JQTransform_Throughput-4                 1.812µ ±  0%
SSEPublishDelivery-4                     64.83n ±  2%
geomean                                  3.884µ

                                 │ baseline-bench.txt │
                                 │        B/op        │
IaCStateBackend_InProcess-4             416.0 ±  0%
IaCStateBackend_GRPC-4                5.775Mi ± 12%
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.856k ± 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.114µ ± 4%
SchemaValidation_AllFields-4                    1.670µ ± 5%
SchemaValidation_FormatValidation-4             1.579µ ± 1%
SchemaValidation_ManySchemas-4                  1.832µ ± 2%
geomean                                         1.523µ

                                    │ 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.076µ ±  2%
SchemaValidation_AllFields-4                1.615µ ± 11%
SchemaValidation_FormatValidation-4         1.565µ ±  5%
SchemaValidation_ManySchemas-4              1.590µ ±  2%
geomean                                     1.442µ

                                    │ 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.183µ ± 24%
EventStoreAppend_SQLite-4                     1.281m ±  6%
GetTimeline_InMemory/events-10-4              13.50µ ±  5%
GetTimeline_InMemory/events-50-4              74.33µ ±  4%
GetTimeline_InMemory/events-100-4             149.3µ ± 10%
GetTimeline_InMemory/events-500-4             622.8µ ±  2%
GetTimeline_InMemory/events-1000-4            1.272m ±  1%
GetTimeline_SQLite/events-10-4                104.3µ ±  1%
GetTimeline_SQLite/events-50-4                242.4µ ±  1%
GetTimeline_SQLite/events-100-4               419.4µ ±  0%
GetTimeline_SQLite/events-500-4               1.753m ±  0%
GetTimeline_SQLite/events-1000-4              3.424m ±  0%
geomean                                       217.9µ

                                   │ benchmark-results.txt │
                                   │         B/op          │
EventStoreAppend_InMemory-4                     796.5 ± 5%
EventStoreAppend_SQLite-4                     1.984Ki ± 1%
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.39Ki

                                   │ 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.093µ ± 17%
EventStoreAppend_SQLite-4                  1.043m ±  2%
GetTimeline_InMemory/events-10-4           12.44µ ±  2%
GetTimeline_InMemory/events-50-4           69.25µ ±  3%
GetTimeline_InMemory/events-100-4          110.8µ ± 25%
GetTimeline_InMemory/events-500-4          565.6µ ±  1%
GetTimeline_InMemory/events-1000-4         1.146m ±  1%
GetTimeline_SQLite/events-10-4             85.79µ ±  1%
GetTimeline_SQLite/events-50-4             221.9µ ±  1%
GetTimeline_SQLite/events-100-4            387.6µ ±  3%
GetTimeline_SQLite/events-500-4            1.667m ±  0%
GetTimeline_SQLite/events-1000-4           3.235m ±  1%
geomean                                    193.8µ

                                   │ baseline-bench.txt │
                                   │        B/op        │
EventStoreAppend_InMemory-4                 745.0 ± 14%
EventStoreAppend_SQLite-4                 1.984Ki ±  1%
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.01Ki

                                   │ 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 a4069fd into main May 21, 2026
26 checks passed
@intel352 intel352 deleted the fix/log-capture-grace branch May 21, 2026 06:04
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