Skip to content

fix(test): enable snapshots --json on a fresh bucket#114

Merged
designcode merged 1 commit into
mainfrom
fix/enable-snapshots-toggle-test
Jun 22, 2026
Merged

fix(test): enable snapshots --json on a fresh bucket#114
designcode merged 1 commit into
mainfrom
fix/enable-snapshots-toggle-test

Conversation

@designcode

@designcode designcode commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Problem

The bucket snapshot toggle > should output JSON with --json on enable-snapshots integration test fails with expected 1 to be +0 — the CLI exits 1 instead of 0.

The test before it (should enable snapshots on an existing regular bucket) already turns toggleBucket into a snapshot bucket. The --json test then re-enables the same bucket. Setting the bucket type to Snapshot when it's already Snapshot is rejected by the server, so the CLI exits 1.

The bug is pre-existing on main (from #111). It only surfaces on push/workflow_dispatch runs, since the integration job doesn't run on PR events.

Fix

Give the --json test its own fresh regular bucket, matching how the storage SDK's own setBucketType/enableSnapshot tests always enable on a newly-created bucket.

Verification

  • tsc --noEmit, npm run lint, npm run format:check all pass.
  • Integration behavior is validated by the main integration run (not PR CI).

🤖 Generated with Claude Code


Note

Low Risk
Test-only change in test/cli.test.ts; no production CLI or API behavior is modified.

Overview
Fixes a flaky bucket snapshot toggle integration test where buckets enable-snapshots … --json ran on the same bucket as the prior “enable snapshots” case. After that first test, the bucket is already snapshot-enabled; enabling again is rejected by the API and the CLI exits 1, so the JSON assertion failed.

The PR adds a dedicated regular bucket (toggleJsonBucket) for the --json test, created and torn down alongside the existing toggle bucket, so enable-snapshots runs on a fresh bucket and can succeed with action: 'snapshots-enabled' in stdout.

Reviewed by Cursor Bugbot for commit 8e64e10. Bugbot is set up for automated code reviews on this repo. Configure here.

The --json enable-snapshots test re-enabled the same bucket the previous
test had already turned into a snapshot bucket. Setting the bucket type to
Snapshot when it is already Snapshot is rejected, so the CLI exited 1.

Give the --json test its own fresh regular bucket, matching how the
storage SDK's own tests always enable on a newly-created bucket.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@designcode designcode merged commit 558391d into main Jun 22, 2026
3 checks passed
@designcode designcode deleted the fix/enable-snapshots-toggle-test branch June 22, 2026 17:18
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 3.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants