feat(cli): full-scope closers — s3 rb --force, aws --help, destroy --purge-data, generated-cred pusher - #96
Merged
Merged
Conversation
…purge-data, generated-cred pusher - s3 rb --force: MinIO provisioner recursively empties a bucket (paginated ListObjectsV2 + batched DeleteObjects) before DeleteBucket, so a non-empty bucket can be removed; the --force CLI flag is now wired via Params. Adds ListObjectsV2/DeleteObjects to the S3API seam + fake, with a table test. - aws --help / bare aws: short-circuits to the shim's own help BEFORE any docker/S3 client construction or daemon access (DisableFlagParsing meant cobra was forwarding the help token to the real endpoint). A help flag AFTER a subcommand still passes through. Tested that it exits 0 with no client build. - workspace destroy --purge-data: also removes the shared stack's named volumes via compose down -v, gated on the shared stack being fully orphaned (AllRefs empty after reconcile/GC) so it never drops data another live workspace uses. DestroyResult gains PurgedVolumes; default path still never drops volumes. - generated credential: RandomPassword is now crypto/rand ALPHANUMERIC (unbiased rejection sampling) and is routed through the secrets.Pusher (new UpDeps .CredPusher) for both the imperative and saga provision paths, so the value reaches a backend and never a generated file. Adds a leak-test asserting the generated value appears in no file under the workspace. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Four small, independently-correct Full-scope closers, each with table-driven tests.
1.
s3 rb --force(spec 27/29)The
--forceflag existed but was inert. The MinIO provisioner now recursively empties a bucket (paginatedListObjectsV2+ batchedDeleteObjects) beforeDeleteBucket, so a non-empty bucket can be removed. AddedListObjectsV2/DeleteObjectsto theS3APIseam and its fake; the CLI wires--forceviaParams. Without--force, a non-empty bucket still fails (BucketNotEmpty).2.
aws --help/ bareaws(spec 29)DisableFlagParsingmeant cobra was forwarding the help token to the real endpoint — sodevstack aws --helptried to reach the daemon. It now short-circuits to the shim's own help before constructing any docker/S3 client or touching the daemon. A help flag after a subcommand (aws -- s3 --help) still passes through to the user'saws.3.
workspace destroy --purge-data(spec 13)--purge-dataalready dropped provisioned resources; it now also removes the shared stack's named volumes viacompose down -v, gated on the shared stack being fully orphaned (AllRefsempty after reconcile/GC) so it never destroys data a still-live workspace depends on.DestroyResultgainsPurgedVolumes. The default path still never drops volumes.4. Generated-credential Pusher path (spec 04/27)
secrets.RandomPasswordis now crypto/rand alphanumeric (unbiased rejection sampling, no-/_) and is routed throughsecrets.Pusher(new injectableUpDeps.CredPusher) in both the imperativeCreateResourceand the up-saga provision paths, so a generated value reaches a secrets backend and never a generated file (spec-04 valueless-env coupling).Why
Closes the remaining quick-win gaps left as "Full scope" TODOs across the resource, teardown, and secrets layers.
Testing
CGO_ENABLED=0 go build ./...— cleanCGO_ENABLED=1 go test ./internal/...— all greengofmt -lclean,go vet ./...cleanaws --help/-h/bare exit-0-no-client; purge-data removes shared volumes + the negative case (a live foreign consumer keeps them); alphanumeric RandomPassword; a leak-test asserting the generated credential appears in no file under the workspace.No changes to
internal/generateortemplates/, so determinism artifacts are unaffected.🤖 Generated with Claude Code