fix(secrets): wads-secrets add shouldn't short-circuit on an existing declaration#50
Merged
Merged
Conversation
`wads-secrets add` configures three independent layers: the pyproject declaration, the ci.yml transport, and the GitHub secret value. When the env var was already declared in [tool.wads.ci.env], `add` returned early with 'nothing to add' — skipping BOTH the transport edit and the gh secret set. A half-configured secret (declared but not passed in ci.yml, or value not set on GitHub) could therefore never be completed by re-running the command. Report the existing pyproject declaration and continue to the transport + GitHub layers (each already idempotent). Add regression tests covering the pre-declared-but-not-transported case and full idempotency.
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.
Problem
wads-secrets add VARconfigures three independent layers:[tool.wads.ci.env]declarationci.ymltransport (passing the secret to the reusable workflow)gh secret set)When the var was already declared in pyproject,
addprinted "already configured … nothing to add" and returned early, skipping layers 2 and 3. So a half-configured secret (declared but not passed inci.yml, or value never set on GitHub) could never be completed by re-running the command — which is exactly what you'd expect to fix it.Hit in practice on
thorwhalen/aix:OPENAI_API_KEYwas already declared, sowads-secrets addrefused to set the GitHub secret value, and it had to be set by hand.Fix
Report the existing pyproject declaration and continue to the transport + GitHub layers (each already idempotent). Also warn when the existing bucket differs from the requested
--kind.Tests
test_add_does_not_short_circuit_when_already_declared— pre-declared var still gets theci.ymltransport.test_add_is_idempotent_when_fully_configured— running twice is a clean no-op.All 8
test_secrets_cli.pytests pass.