fix(infra): --refresh-outputs reconciles stale routed secrets instead of skipping them#646
Conversation
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
…ly requested Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/79783eb9-2faa-4eb2-988d-7a7d6b5e813c Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates the infra apply post-processing path so --refresh-outputs reconciles configured infra_output secrets instead of skipping existing values, helping keep routed output secrets aligned after provider/resource recreation.
Changes:
- Threads
refreshOutputsFlagfromrunInfraApplyintosyncInfraOutputSecrets. - Adds refresh-mode reconciliation behavior for readable and write-only secret providers.
- Adds unit coverage for refresh-mode update/create/unchanged/write-only cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
cmd/wfctl/infra.go |
Passes the CLI --refresh-outputs flag into infra output secret synchronization. |
cmd/wfctl/infra_output_secrets.go |
Implements refresh-mode secret reconciliation and logging semantics. |
cmd/wfctl/infra_output_secrets_test.go |
Updates existing call sites and adds refresh-mode unit tests. |
| } | ||
| } | ||
| return syncInfraOutputSecrets(ctx, secretsCfg, secretsProvider, states, wfCfg, envName, runHydrated) | ||
| return syncInfraOutputSecrets(ctx, secretsCfg, secretsProvider, states, wfCfg, envName, runHydrated, refreshOutputsFlag) |
| err := syncInfraOutputSecrets(context.Background(), cfg, p, sampleStates(), nil, "", nil, true) | ||
| if err != nil { | ||
| t.Fatalf("syncInfraOutputSecrets: %v", err) | ||
| } | ||
| if p.data["DATABASE_URL"] != current { | ||
| t.Errorf("unchanged secret should not be modified: got %q", p.data["DATABASE_URL"]) |
|
@copilot apply changes based on the comments in this thread Test coverage is also lax: #646 (comment) |
…-outputs integration tests Agent-Logs-Url: https://github.com/GoCodeAlone/workflow/sessions/185a3026-2d6d-4ef1-a04c-82efba142cb5 Co-authored-by: intel352 <77607+intel352@users.noreply.github.com>
Addressed both review items in ee2f50b:
|
Both issues are addressed in commit
|
When
wfctl infra apply --refresh-outputsran after a provider was recreated, routed secrets (e.g.COMPUTE_GITHUB_RUNNER_PROVIDER_URL) that already existed in the secrets provider were logged as"already exists — skipped"and left with their stale values, causing downstream failures.Changes
syncInfraOutputSecrets— addsrefreshOutputs boolparameter that switches from skip-if-exists to reconcile semantics:Setonly when value is identical ("unchanged"), otherwise updates ("updated from infra output")Setsince comparison is impossible ("updated from infra output")"created from infra output")refreshOutputs=false): unchanged — skips existing secrets ("already exists — skipped")runInfraApply— passesrefreshOutputsFlagthrough tosyncInfraOutputSecretsso the post-apply secret sync honours the operator's explicit intent.Log output (refresh mode)
Invariants preserved
--refresh-outputsalways reconciles managed output routes, even when the secret already exists.