fix(wfctl): scope infra output secret sync#718
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR scopes post-apply infra_output secret generation during wfctl infra apply so that when an apply is scoped (via --include or a scoped --plan), only infra_output generators whose source module is within the applied include set are synced, avoiding failures for out-of-scope modules.
Changes:
- Thread an include-set-derived scope through
runInfraApplyinto a newsyncInfraOutputSecretsScopedhelper. - Filter
infra_outputsecret generators by applied include set before resolving outputs from state. - Add regression tests covering scoped plan applies where unrelated
infra_outputgenerators exist.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cmd/wfctl/infra.go | Passes an include-derived module scope into post-apply infra output secret syncing (including --plan path). |
| cmd/wfctl/infra_output_secrets.go | Introduces scoped syncing and a scope predicate for infra output generator sources. |
| cmd/wfctl/infra_output_secrets_test.go | Adds unit tests ensuring out-of-scope generators are skipped during scoped syncing. |
| cmd/wfctl/infra_apply_plan_test.go | Adds end-to-end regression test ensuring scoped plan apply doesn’t attempt to sync unrelated infra_output secrets. |
bf4a0c6 to
54c8fb3
Compare
⏱ Benchmark Results✅ No significant performance regressions detected. benchstat comparison (baseline → PR)
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
infra_outputsecret generation to the applied include setVerification
GOWORK=off go test ./cmd/wfctl -run 'TestInfraApplyScopedPlanSyncsOnlyScopedInfraOutputSecrets|TestSyncInfraOutputSecretsScoped|TestInfraOutputSourceInScope' -count=1\n-GOWORK=off go test ./cmd/wfctl -run 'TestInfraApplyScopedPlanSyncsOnlyScopedInfraOutputSecrets|TestSyncInfraOutputSecrets|TestInfraOutputSourceInScope|TestInfraApplyConsumesScopedPlan|TestInfraApplyConsumesPlan|TestInfraApplyPlanSkipBootstrap|TestApplyInclude|TestPlanInclude' -count=1\n-GOWORK=off go build ./cmd/wfctl\n-git diff --check\n-GOWORK=off go test ./cmd/wfctl -count=1\n\n## Regression proof\nWith the production scope filter disabled:\nGOWORK=off go test ./cmd/wfctl -run 'TestInfraApplyScopedPlanSyncsOnlyScopedInfraOutputSecrets' -count=1\nfailed withgenerate infra_output secret "DATABASE_URL": infra_output: module "bmw-database" not found in state (available: bmw-dns).\n\nWith the fix restored, the same test passed.