Skip to content

feat(cli): full-scope closers — s3 rb --force, aws --help, destroy --purge-data, generated-cred pusher - #96

Merged
gustavobertoi merged 1 commit into
mainfrom
feat/quickwin-closers
Jul 1, 2026
Merged

feat(cli): full-scope closers — s3 rb --force, aws --help, destroy --purge-data, generated-cred pusher#96
gustavobertoi merged 1 commit into
mainfrom
feat/quickwin-closers

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

What

Four small, independently-correct Full-scope closers, each with table-driven tests.

1. s3 rb --force (spec 27/29)

The --force flag existed but was inert. The MinIO provisioner now recursively empties a bucket (paginated ListObjectsV2 + batched DeleteObjects) before DeleteBucket, so a non-empty bucket can be removed. Added ListObjectsV2/DeleteObjects to the S3API seam and its fake; the CLI wires --force via Params. Without --force, a non-empty bucket still fails (BucketNotEmpty).

2. aws --help / bare aws (spec 29)

DisableFlagParsing meant cobra was forwarding the help token to the real endpoint — so devstack aws --help tried 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's aws.

3. workspace destroy --purge-data (spec 13)

--purge-data already dropped provisioned resources; it now 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 destroys data a still-live workspace depends on. DestroyResult gains PurgedVolumes. The default path still never drops volumes.

4. Generated-credential Pusher path (spec 04/27)

secrets.RandomPassword is now crypto/rand alphanumeric (unbiased rejection sampling, no -/_) and is routed through secrets.Pusher (new injectable UpDeps.CredPusher) in both the imperative CreateResource and 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 ./... — clean
  • CGO_ENABLED=1 go test ./internal/... — all green
  • gofmt -l clean, go vet ./... clean
  • New tests: force-empty bucket drop; aws --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/generate or templates/, so determinism artifacts are unaffected.

🤖 Generated with Claude Code

…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>
@gustavobertoi
gustavobertoi merged commit 3059672 into main Jul 1, 2026
4 checks passed
@gustavobertoi
gustavobertoi deleted the feat/quickwin-closers branch July 1, 2026 12:40
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.

1 participant