Skip to content

fix(infra): context propagation + audit plan doc#325

Merged
intel352 merged 3 commits intomainfrom
feat/audit-fix-final
Mar 13, 2026
Merged

fix(infra): context propagation + audit plan doc#325
intel352 merged 3 commits intomainfrom
feat/audit-fix-final

Conversation

@intel352
Copy link
Contributor

Summary

  • fix(infra): Thread ctx through provisionResource/destroyResource so cancellation propagates to providers. Change context.TODO()context.Background() in BuildFromConfig infra call.
  • docs: Add the audit fix implementation plan (docs/plans/2026-03-13-audit-fix-design.md)

This is the final piece of the comprehensive workflow repo audit fix. The bulk of the work (18 commits) was landed directly on main:

What was done (full audit)

  • Anti-staleness: Deleted 435-line hardcoded knownStepTypeDescriptions(), replaced with schema registry lookups. Created TemplateFuncRegistry with all 40 functions + drift tests.
  • Schema fixes: step.db_query default fixed to "list", step.conditional routes marked required, 11 missing step schemas added, ~86 step types added to coreModuleTypes.
  • Interface extraction: PipelineStep/StepResult/PipelineContext moved to interfaces/ package, engine.stepRegistry uses StepRegistrar abstraction (closes TODO phase5).
  • Infra provisioner: ResourceProvider interface + MemoryProvider, wired into BuildFromConfig via optional infrastructure: config block.
  • Dead code: Deleted unused ErrNotImplemented.
  • Unit tests: 40+ pipeline step test files + 8 plugin test files.
  • CI guard: consistency_test.go drift-detection across schema, coreModuleTypes, template funcs, and engine registrations.

Test plan

  • go build ./... passes
  • go test ./infra/ -v — all 23 tests pass including TestApplyCancelledContext
  • go test ./... -count=1 — full suite passes
  • Drift-detection tests: TestCoreStepTypesHaveSchemas, TestSchemaRegistryTypesInCoreModuleTypes, TestTemplateFuncDescriptionsCoversFuncMap, TestRegistryConsistency all pass

🤖 Generated with Claude Code

intel352 and others added 2 commits March 13, 2026 04:39
… context.Background() in engine

- engine.go: replace context.TODO() with context.Background() in BuildFromConfig infra wiring
- infra/provisioner.go: provisionResource and destroyResource now accept ctx and forward it to
  provider calls so cancellation propagates correctly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Design document for the comprehensive workflow repo audit fix covering
anti-staleness, interface extraction, infra provisioner, dead code cleanup,
missing schemas, drift-detection tests, and unit test coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 13, 2026 08:48
Copy link
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 finishes the infra context-plumbing work by propagating context.Context through the infrastructure provisioner’s internal operations so provider implementations can observe cancellation, and it adds an audit fix implementation plan document for reference.

Changes:

  • Thread ctx through Provisioner.provisionResource / Provisioner.destroyResource and use that context when invoking providers.
  • Replace context.TODO() with context.Background() for infra provisioning in StdEngine.BuildFromConfig.
  • Add docs/plans/2026-03-13-audit-fix-design.md (audit fix implementation plan).

Reviewed changes

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

File Description
infra/provisioner.go Passes ctx into provision/destroy helpers and into provider provisioning calls.
engine.go Uses context.Background() for infra plan application during build.
docs/plans/2026-03-13-audit-fix-design.md Adds a detailed implementation plan for the broader audit work.

@@ -0,0 +1,1245 @@
# Workflow Audit Fix Implementation Plan

> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an internal execution plan in docs/plans/ — not contributor documentation. Plan docs in this repo include agent instructions by convention.

@github-actions
Copy link

github-actions bot commented Mar 13, 2026

⏱ Benchmark Results

No significant performance regressions detected.

benchstat comparison (baseline → PR)
## benchstat: baseline → PR
baseline-bench.txt:244: parsing iteration count: invalid syntax
baseline-bench.txt:346967: parsing iteration count: invalid syntax
baseline-bench.txt:686982: parsing iteration count: invalid syntax
baseline-bench.txt:979657: parsing iteration count: invalid syntax
baseline-bench.txt:1318343: parsing iteration count: invalid syntax
baseline-bench.txt:1672218: parsing iteration count: invalid syntax
benchmark-results.txt:244: parsing iteration count: invalid syntax
benchmark-results.txt:283754: parsing iteration count: invalid syntax
benchmark-results.txt:583863: parsing iteration count: invalid syntax
benchmark-results.txt:866719: parsing iteration count: invalid syntax
benchmark-results.txt:1171958: parsing iteration count: invalid syntax
benchmark-results.txt:1463820: 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                  8.719m ± 65%
ComponentLoad-4                        3.506m ±  9%
ComponentExecute-4                     2.021µ ±  0%
PoolContention/workers-1-4             1.113µ ±  2%
PoolContention/workers-2-4             1.103µ ±  4%
PoolContention/workers-4-4             1.107µ ±  1%
PoolContention/workers-8-4             1.112µ ±  1%
PoolContention/workers-16-4            1.113µ ±  0%
ComponentLifecycle-4                   3.529m ±  1%
SourceValidation-4                     2.313µ ±  0%
RegistryConcurrent-4                   810.1n ±  3%
LoaderLoadFromString-4                 3.553m ±  3%
geomean                                19.15µ

                            │ benchmark-results.txt │
                            │         B/op          │
InterpreterCreation-4                  1.944Mi ± 0%
ComponentLoad-4                        2.097Mi ± 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.099Mi ± 0%
SourceValidation-4                     1.984Ki ± 0%
RegistryConcurrent-4                   1.133Ki ± 0%
LoaderLoadFromString-4                 2.099Mi ± 0%
geomean                                15.05Ki

                            │ benchmark-results.txt │
                            │       allocs/op       │
InterpreterCreation-4                   15.09k ± 0%
ComponentLoad-4                         17.43k ± 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                    17.48k ± 0%
SourceValidation-4                       32.00 ± 0%
RegistryConcurrent-4                     2.000 ± 0%
LoaderLoadFromString-4                  17.47k ± 0%
geomean                                  181.2

cpu: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                            │ baseline-bench.txt │
                            │       sec/op       │
InterpreterCreation-4               10.23m ± 67%
ComponentLoad-4                     3.883m ±  2%
ComponentExecute-4                  2.079µ ±  1%
PoolContention/workers-1-4          1.296µ ±  3%
PoolContention/workers-2-4          1.295µ ±  1%
PoolContention/workers-4-4          1.291µ ±  1%
PoolContention/workers-8-4          1.297µ ±  1%
PoolContention/workers-16-4         1.300µ ±  1%
ComponentLifecycle-4                3.951m ±  1%
SourceValidation-4                  2.389µ ±  1%
RegistryConcurrent-4                1.028µ ±  6%
LoaderLoadFromString-4              3.995m ±  2%
geomean                             21.82µ

                            │ baseline-bench.txt │
                            │        B/op        │
InterpreterCreation-4               1.944Mi ± 0%
ComponentLoad-4                     2.097Mi ± 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.099Mi ± 0%
SourceValidation-4                  1.984Ki ± 0%
RegistryConcurrent-4                1.133Ki ± 0%
LoaderLoadFromString-4              2.099Mi ± 0%
geomean                             15.05Ki

                            │ baseline-bench.txt │
                            │     allocs/op      │
InterpreterCreation-4                15.09k ± 0%
ComponentLoad-4                      17.43k ± 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                 17.48k ± 0%
SourceValidation-4                    32.00 ± 0%
RegistryConcurrent-4                  2.000 ± 0%
LoaderLoadFromString-4               17.47k ± 0%
geomean                               181.2

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

                                  │ 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: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                                  │ baseline-bench.txt │
                                  │       sec/op       │
CircuitBreakerDetection-4                  462.1n ± 0%
CircuitBreakerExecution_Success-4          59.99n ± 3%
CircuitBreakerExecution_Failure-4          64.78n ± 0%
geomean                                    121.5n

                                  │ 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         │
JQTransform_Simple-4                        887.0n ± 31%
JQTransform_ObjectConstruction-4            1.471µ ±  8%
JQTransform_ArraySelect-4                   3.393µ ±  2%
JQTransform_Complex-4                       39.72µ ±  1%
JQTransform_Throughput-4                    1.811µ ±  1%
SSEPublishDelivery-4                        65.61n ±  1%
geomean                                     1.660µ

                                 │ benchmark-results.txt │
                                 │         B/op          │
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       │
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: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                                 │ baseline-bench.txt │
                                 │       sec/op       │
JQTransform_Simple-4                     1.104µ ± 16%
JQTransform_ObjectConstruction-4         1.658µ ±  3%
JQTransform_ArraySelect-4                3.533µ ±  2%
JQTransform_Complex-4                    37.67µ ±  2%
JQTransform_Throughput-4                 1.984µ ±  3%
SSEPublishDelivery-4                     72.85n ±  7%
geomean                                  1.810µ

                                 │ baseline-bench.txt │
                                 │        B/op        │
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      │
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.130µ ± 10%
SchemaValidation_AllFields-4                   1.706µ ±  4%
SchemaValidation_FormatValidation-4            1.599µ ±  2%
SchemaValidation_ManySchemas-4                 1.841µ ±  3%
geomean                                        1.543µ

                                    │ 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: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                                    │ baseline-bench.txt │
                                    │       sec/op       │
SchemaValidation_Simple-4                    1.022µ ± 9%
SchemaValidation_AllFields-4                 1.524µ ± 3%
SchemaValidation_FormatValidation-4          1.498µ ± 2%
SchemaValidation_ManySchemas-4               1.523µ ± 2%
geomean                                      1.373µ

                                    │ 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.281µ ± 16%
EventStoreAppend_SQLite-4                     1.372m ±  7%
GetTimeline_InMemory/events-10-4              14.30µ ±  3%
GetTimeline_InMemory/events-50-4              62.80µ ± 28%
GetTimeline_InMemory/events-100-4             125.7µ ±  2%
GetTimeline_InMemory/events-500-4             646.2µ ±  1%
GetTimeline_InMemory/events-1000-4            1.318m ±  1%
GetTimeline_SQLite/events-10-4                110.4µ ±  0%
GetTimeline_SQLite/events-50-4                253.6µ ±  1%
GetTimeline_SQLite/events-100-4               426.5µ ±  1%
GetTimeline_SQLite/events-500-4               1.802m ±  1%
GetTimeline_SQLite/events-1000-4              3.512m ±  0%
geomean                                       219.9µ

                                   │ benchmark-results.txt │
                                   │         B/op          │
EventStoreAppend_InMemory-4                     842.5 ± 9%
EventStoreAppend_SQLite-4                     1.985Ki ± 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.71Ki

                                   │ 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: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz
                                   │ baseline-bench.txt │
                                   │       sec/op       │
EventStoreAppend_InMemory-4                1.180µ ±  8%
EventStoreAppend_SQLite-4                  1.121m ±  6%
GetTimeline_InMemory/events-10-4           14.14µ ±  4%
GetTimeline_InMemory/events-50-4           68.09µ ± 17%
GetTimeline_InMemory/events-100-4          133.3µ ±  2%
GetTimeline_InMemory/events-500-4          678.0µ ±  2%
GetTimeline_InMemory/events-1000-4         1.370m ±  5%
GetTimeline_SQLite/events-10-4             88.68µ ±  4%
GetTimeline_SQLite/events-50-4             260.7µ ±  1%
GetTimeline_SQLite/events-100-4            471.3µ ±  2%
GetTimeline_SQLite/events-500-4            2.093m ±  1%
GetTimeline_SQLite/events-1000-4           4.175m ±  1%
geomean                                    222.9µ

                                   │ baseline-bench.txt │
                                   │        B/op        │
EventStoreAppend_InMemory-4                  806.0 ± 7%
EventStoreAppend_SQLite-4                  1.985Ki ± 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.46Ki

                                   │ 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.

destroyResource now calls prov.Destroy(ctx, name) for the matching
provider before removing the resource from the internal map. Mirrors
the provisionResource pattern. On provider error, the resource is
retained with status "failed" instead of being silently dropped.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@intel352 intel352 merged commit 66fe69a into main Mar 13, 2026
11 checks passed
@intel352 intel352 deleted the feat/audit-fix-final branch March 13, 2026 09:39
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