Skip to content

fix: parseSecretsConfig/parseInfraConfig honor imports via config.LoadFromFile#561

Closed
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-secrets-config-bypass
Closed

fix: parseSecretsConfig/parseInfraConfig honor imports via config.LoadFromFile#561
Copilot wants to merge 3 commits into
mainfrom
copilot/fix-secrets-config-bypass

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

parseSecretsConfig and parseInfraConfig used raw yaml.Unmarshal, bypassing processImports. Any secrets.generate, secrets.entries, or infra: block declared in an imported file was silently invisible to wfctl infra bootstrap and wfctl infra apply.

Changes

  • cmd/wfctl/infra_secrets.go — Replace os.ReadFile + yaml.Unmarshal in both functions with config.LoadFromFile, which resolves imports before returning. Drops now-unused os and gopkg.in/yaml.v3 imports.

  • config/config.go — Add Infra field merge in processImports (parent-wins; fills from import when main has no infra: block), consistent with how Secrets, SecretStores, and Environments are already merged.

  • TestsTestParseSecretsConfig_HonorsImports and TestParseInfraConfig_HonorsImports in cmd/wfctl; TestProcessImports_MergesInfraFromImport in config.

Example scenario now fixed

# main.yaml
imports:
  - shared.yaml

# shared.yaml
secrets:
  generate:
    - key: STAGING_PG_PASSWORD
      type: random_hex
      length: 32

wfctl infra bootstrap --config main.yaml previously skipped STAGING_PG_PASSWORD generation. With this fix, parseSecretsConfig resolves imports first, so the generate entry is visible and the secret is created.

Copilot AI requested review from Copilot and removed request for Copilot May 6, 2026 04:42
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

⏱ Benchmark Results

No significant performance regressions detected.

benchstat comparison (baseline → PR)
## benchstat: baseline → PR
baseline-bench.txt:260: parsing iteration count: invalid syntax
baseline-bench.txt:313335: parsing iteration count: invalid syntax
baseline-bench.txt:563008: parsing iteration count: invalid syntax
baseline-bench.txt:878837: parsing iteration count: invalid syntax
baseline-bench.txt:1176606: parsing iteration count: invalid syntax
baseline-bench.txt:1459183: parsing iteration count: invalid syntax
benchmark-results.txt:260: parsing iteration count: invalid syntax
benchmark-results.txt:311562: parsing iteration count: invalid syntax
benchmark-results.txt:607444: parsing iteration count: invalid syntax
benchmark-results.txt:952670: parsing iteration count: invalid syntax
benchmark-results.txt:1247403: parsing iteration count: invalid syntax
benchmark-results.txt:1552507: parsing iteration count: invalid syntax
goos: linux
goarch: amd64
pkg: github.com/GoCodeAlone/workflow/dynamic
cpu: AMD EPYC 7763 64-Core Processor                
                            │ baseline-bench.txt │       benchmark-results.txt        │
                            │       sec/op       │    sec/op     vs base              │
InterpreterCreation-4              3.673m ± 175%   5.182m ± 98%       ~ (p=0.394 n=6)
ComponentLoad-4                    3.554m ±   1%   3.731m ±  1%  +4.99% (p=0.002 n=6)
ComponentExecute-4                 1.931µ ±   1%   1.961µ ±  0%  +1.53% (p=0.030 n=6)
PoolContention/workers-1-4         1.078µ ±   1%   1.115µ ±  3%  +3.39% (p=0.002 n=6)
PoolContention/workers-2-4         1.083µ ±   3%   1.103µ ±  2%  +1.85% (p=0.037 n=6)
PoolContention/workers-4-4         1.085µ ±   1%   1.101µ ±  6%  +1.57% (p=0.004 n=6)
PoolContention/workers-8-4         1.082µ ±   1%   1.106µ ±  4%  +2.17% (p=0.009 n=6)
PoolContention/workers-16-4        1.090µ ±   4%   1.095µ ±  5%       ~ (p=0.485 n=6)
ComponentLifecycle-4               3.573m ±   2%   3.615m ±  3%       ~ (p=0.132 n=6)
SourceValidation-4                 2.234µ ±   1%   2.294µ ±  2%  +2.71% (p=0.002 n=6)
RegistryConcurrent-4               811.1n ±   2%   795.3n ±  2%  -1.95% (p=0.026 n=6)
LoaderLoadFromString-4             3.617m ±   2%   3.641m ±  1%       ~ (p=0.310 n=6)
geomean                            17.60µ          18.39µ        +4.48%

                            │ baseline-bench.txt │        benchmark-results.txt         │
                            │        B/op        │     B/op      vs base                │
InterpreterCreation-4               2.027Mi ± 0%   2.027Mi ± 0%       ~ (p=0.909 n=6)
ComponentLoad-4                     2.180Mi ± 0%   2.180Mi ± 0%       ~ (p=0.855 n=6)
ComponentExecute-4                  1.203Ki ± 0%   1.203Ki ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-1-4          1.203Ki ± 0%   1.203Ki ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-2-4          1.203Ki ± 0%   1.203Ki ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-4-4          1.203Ki ± 0%   1.203Ki ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-8-4          1.203Ki ± 0%   1.203Ki ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-16-4         1.203Ki ± 0%   1.203Ki ± 0%       ~ (p=1.000 n=6) ¹
ComponentLifecycle-4                2.183Mi ± 0%   2.183Mi ± 0%       ~ (p=0.965 n=6)
SourceValidation-4                  1.984Ki ± 0%   1.984Ki ± 0%       ~ (p=1.000 n=6) ¹
RegistryConcurrent-4                1.133Ki ± 0%   1.133Ki ± 0%       ~ (p=1.000 n=6) ¹
LoaderLoadFromString-4              2.182Mi ± 0%   2.182Mi ± 0%       ~ (p=0.584 n=6)
geomean                             15.25Ki        15.25Ki       +0.00%
¹ all samples are equal

                            │ baseline-bench.txt │        benchmark-results.txt        │
                            │     allocs/op      │  allocs/op   vs base                │
InterpreterCreation-4                15.68k ± 0%   15.68k ± 0%       ~ (p=1.000 n=6)
ComponentLoad-4                      18.02k ± 0%   18.02k ± 0%       ~ (p=1.000 n=6)
ComponentExecute-4                    25.00 ± 0%    25.00 ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-1-4            25.00 ± 0%    25.00 ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-2-4            25.00 ± 0%    25.00 ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-4-4            25.00 ± 0%    25.00 ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-8-4            25.00 ± 0%    25.00 ± 0%       ~ (p=1.000 n=6) ¹
PoolContention/workers-16-4           25.00 ± 0%    25.00 ± 0%       ~ (p=1.000 n=6) ¹
ComponentLifecycle-4                 18.07k ± 0%   18.07k ± 0%       ~ (p=1.000 n=6) ¹
SourceValidation-4                    32.00 ± 0%    32.00 ± 0%       ~ (p=1.000 n=6) ¹
RegistryConcurrent-4                  2.000 ± 0%    2.000 ± 0%       ~ (p=1.000 n=6) ¹
LoaderLoadFromString-4               18.06k ± 0%   18.06k ± 0%       ~ (p=1.000 n=6) ¹
geomean                               183.3         183.3       +0.00%
¹ all samples are equal

pkg: github.com/GoCodeAlone/workflow/middleware
                                  │ baseline-bench.txt │       benchmark-results.txt       │
                                  │       sec/op       │   sec/op     vs base              │
CircuitBreakerDetection-4                  284.2n ± 8%   285.4n ± 6%       ~ (p=0.084 n=6)
CircuitBreakerExecution_Success-4          21.52n ± 0%   21.65n ± 5%  +0.63% (p=0.004 n=6)
CircuitBreakerExecution_Failure-4          65.80n ± 0%   66.31n ± 1%  +0.78% (p=0.002 n=6)
geomean                                    73.82n        74.28n       +0.62%

                                  │ baseline-bench.txt │       benchmark-results.txt        │
                                  │        B/op        │    B/op     vs base                │
CircuitBreakerDetection-4                 144.0 ± 0%     144.0 ± 0%       ~ (p=1.000 n=6) ¹
CircuitBreakerExecution_Success-4         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
CircuitBreakerExecution_Failure-4         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                              ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                  │ baseline-bench.txt │       benchmark-results.txt        │
                                  │     allocs/op      │ allocs/op   vs base                │
CircuitBreakerDetection-4                 1.000 ± 0%     1.000 ± 0%       ~ (p=1.000 n=6) ¹
CircuitBreakerExecution_Success-4         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
CircuitBreakerExecution_Failure-4         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                              ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/module
                                 │ baseline-bench.txt │       benchmark-results.txt        │
                                 │       sec/op       │    sec/op     vs base              │
JQTransform_Simple-4                     884.7n ± 32%   976.9n ± 16%       ~ (p=0.699 n=6)
JQTransform_ObjectConstruction-4         1.469µ ±  1%   1.470µ ±  0%       ~ (p=0.814 n=6)
JQTransform_ArraySelect-4                3.337µ ±  2%   3.312µ ±  1%  -0.73% (p=0.041 n=6)
JQTransform_Complex-4                    38.58µ ±  1%   38.90µ ±  1%  +0.82% (p=0.009 n=6)
JQTransform_Throughput-4                 1.780µ ±  1%   1.794µ ±  1%  +0.81% (p=0.004 n=6)
SSEPublishDelivery-4                     71.88n ± 42%   73.36n ±  1%       ~ (p=0.394 n=6)
geomean                                  1.666µ         1.702µ        +2.18%

                                 │ baseline-bench.txt │        benchmark-results.txt         │
                                 │        B/op        │     B/op      vs base                │
JQTransform_Simple-4                   1.273Ki ± 0%     1.273Ki ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_ObjectConstruction-4       1.773Ki ± 0%     1.773Ki ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_ArraySelect-4              2.625Ki ± 0%     2.625Ki ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_Complex-4                  16.22Ki ± 0%     16.22Ki ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_Throughput-4               1.984Ki ± 0%     1.984Ki ± 0%       ~ (p=1.000 n=6) ¹
SSEPublishDelivery-4                     0.000 ± 0%       0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                             ²                 +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                 │ baseline-bench.txt │       benchmark-results.txt        │
                                 │     allocs/op      │ allocs/op   vs base                │
JQTransform_Simple-4                     10.00 ± 0%     10.00 ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_ObjectConstruction-4         15.00 ± 0%     15.00 ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_ArraySelect-4                30.00 ± 0%     30.00 ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_Complex-4                    324.0 ± 0%     324.0 ± 0%       ~ (p=1.000 n=6) ¹
JQTransform_Throughput-4                 17.00 ± 0%     17.00 ± 0%       ~ (p=1.000 n=6) ¹
SSEPublishDelivery-4                     0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                             ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/schema
                                    │ baseline-bench.txt │       benchmark-results.txt       │
                                    │       sec/op       │   sec/op     vs base              │
SchemaValidation_Simple-4                    1.099µ ± 8%   1.099µ ± 2%       ~ (p=0.965 n=6)
SchemaValidation_AllFields-4                 1.661µ ± 1%   1.662µ ± 6%       ~ (p=0.974 n=6)
SchemaValidation_FormatValidation-4          1.573µ ± 1%   1.624µ ± 4%       ~ (p=0.084 n=6)
SchemaValidation_ManySchemas-4               1.801µ ± 2%   1.848µ ± 2%  +2.61% (p=0.026 n=6)
geomean                                      1.508µ        1.530µ       +1.48%

                                    │ baseline-bench.txt │       benchmark-results.txt        │
                                    │        B/op        │    B/op     vs base                │
SchemaValidation_Simple-4                   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
SchemaValidation_AllFields-4                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
SchemaValidation_FormatValidation-4         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
SchemaValidation_ManySchemas-4              0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                                ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

                                    │ baseline-bench.txt │       benchmark-results.txt        │
                                    │     allocs/op      │ allocs/op   vs base                │
SchemaValidation_Simple-4                   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
SchemaValidation_AllFields-4                0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
SchemaValidation_FormatValidation-4         0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
SchemaValidation_ManySchemas-4              0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=6) ¹
geomean                                                ²               +0.00%               ²
¹ all samples are equal
² summaries must be >0 to compute geomean

pkg: github.com/GoCodeAlone/workflow/store
                                   │ baseline-bench.txt │       benchmark-results.txt        │
                                   │       sec/op       │    sec/op     vs base              │
EventStoreAppend_InMemory-4                1.259µ ± 13%   1.187µ ±  8%       ~ (p=0.071 n=6)
EventStoreAppend_SQLite-4                  1.496m ± 10%   1.387m ±  8%  -7.32% (p=0.041 n=6)
GetTimeline_InMemory/events-10-4           13.74µ ±  3%   13.51µ ±  2%       ~ (p=0.093 n=6)
GetTimeline_InMemory/events-50-4           68.44µ ± 15%   74.44µ ±  3%       ~ (p=0.818 n=6)
GetTimeline_InMemory/events-100-4          123.7µ ±  2%   121.6µ ± 27%       ~ (p=0.394 n=6)
GetTimeline_InMemory/events-500-4          632.1µ ±  1%   625.4µ ±  0%  -1.06% (p=0.002 n=6)
GetTimeline_InMemory/events-1000-4         1.295m ±  1%   1.278m ±  1%  -1.34% (p=0.041 n=6)
GetTimeline_SQLite/events-10-4             107.0µ ±  1%   106.5µ ±  1%       ~ (p=0.180 n=6)
GetTimeline_SQLite/events-50-4             248.2µ ±  0%   245.3µ ±  1%  -1.15% (p=0.002 n=6)
GetTimeline_SQLite/events-100-4            417.2µ ±  0%   413.0µ ±  1%  -1.01% (p=0.041 n=6)
GetTimeline_SQLite/events-500-4            1.795m ±  0%   1.752m ±  1%  -2.39% (p=0.002 n=6)
GetTimeline_SQLite/events-1000-4           3.513m ±  1%   3.418m ±  1%  -2.70% (p=0.002 n=6)
geomean                                    219.5µ         216.1µ        -1.55%

                                   │ baseline-bench.txt │        benchmark-results.txt         │
                                   │        B/op        │     B/op      vs base                │
EventStoreAppend_InMemory-4                  810.5 ± 8%     829.0 ± 8%       ~ (p=0.699 n=6)
EventStoreAppend_SQLite-4                  1.987Ki ± 2%   1.983Ki ± 2%       ~ (p=0.522 n=6)
GetTimeline_InMemory/events-10-4           7.953Ki ± 0%   7.953Ki ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-50-4           46.62Ki ± 0%   46.62Ki ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-100-4          94.48Ki ± 0%   94.48Ki ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-500-4          472.8Ki ± 0%   472.8Ki ± 0%       ~ (p=0.080 n=6)
GetTimeline_InMemory/events-1000-4         944.3Ki ± 0%   944.3Ki ± 0%       ~ (p=0.076 n=6)
GetTimeline_SQLite/events-10-4             16.74Ki ± 0%   16.74Ki ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-50-4             87.14Ki ± 0%   87.14Ki ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-100-4            175.4Ki ± 0%   175.4Ki ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-500-4            846.1Ki ± 0%   846.1Ki ± 0%       ~ (p=0.494 n=6)
GetTimeline_SQLite/events-1000-4           1.639Mi ± 0%   1.639Mi ± 0%  +0.00% (p=0.022 n=6)
geomean                                    67.50Ki        67.61Ki       +0.17%
¹ all samples are equal

                                   │ baseline-bench.txt │        benchmark-results.txt        │
                                   │     allocs/op      │  allocs/op   vs base                │
EventStoreAppend_InMemory-4                  7.000 ± 0%    7.000 ± 0%       ~ (p=1.000 n=6) ¹
EventStoreAppend_SQLite-4                    53.00 ± 0%    53.00 ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-10-4             125.0 ± 0%    125.0 ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-50-4             653.0 ± 0%    653.0 ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-100-4           1.306k ± 0%   1.306k ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-500-4           6.514k ± 0%   6.514k ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_InMemory/events-1000-4          13.02k ± 0%   13.02k ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-10-4               382.0 ± 0%    382.0 ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-50-4              1.852k ± 0%   1.852k ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-100-4             3.681k ± 0%   3.681k ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-500-4             18.54k ± 0%   18.54k ± 0%       ~ (p=1.000 n=6) ¹
GetTimeline_SQLite/events-1000-4            37.29k ± 0%   37.29k ± 0%       ~ (p=1.000 n=6) ¹
geomean                                     1.162k        1.162k       +0.00%
¹ all samples are equal

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

@intel352 intel352 marked this pull request as ready for review May 6, 2026 06:01
Copilot AI review requested due to automatic review settings May 6, 2026 06:01
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.

Copilot wasn't able to review any files in this pull request.

Copilot AI requested review from Copilot and removed request for Copilot May 6, 2026 06:10
Copilot AI changed the title [WIP] Fix parseSecretsConfig to process imports correctly fix: parseSecretsConfig/parseInfraConfig honor imports via config.LoadFromFile May 6, 2026
Copilot AI requested a review from intel352 May 6, 2026 06:12
@intel352 intel352 closed this May 6, 2026
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.

parseSecretsConfig (cmd/wfctl/infra_bootstrap.go + cmd/wfctl/infra.go) bypasses processImports — imported secrets invisible to bootstrap/plan paths

3 participants