Skip to content

feat!: lifecycle commands; remove deprecated surface#95

Open
designcode wants to merge 6 commits intomainfrom
feat/extend-life-cycle-api
Open

feat!: lifecycle commands; remove deprecated surface#95
designcode wants to merge 6 commits intomainfrom
feat/extend-life-cycle-api

Conversation

@designcode
Copy link
Copy Markdown
Collaborator

@designcode designcode commented May 7, 2026

Summary

  • Add tigris buckets lifecycle (alias lc) with list, create, edit for multi-rule lifecycle management (transitions and TTL/expiration with optional prefix filter), backed by the updated @tigrisdata/storage SDK.
  • Introduce a generic removed / replaced_by mechanism on CommandSpec and Argument so the cli-core can intercept removed entries with a clean redirect message instead of "unknown command/option". Removed entries are hidden from --help and have no implementation file.
  • Cut deprecated commands and flags from the surface; future major-version deletions are just spec edits.

Breaking changes

  • tigris buckets set-ttl and tigris buckets set-transition are removed. Use tigris buckets lifecycle create / edit instead.
  • tigris forks list and tigris forks create are removed. Use tigris buckets create --fork-of and tigris buckets list --forks-of.
  • --region and --consistency flags on tigris mk, tigris buckets create, and tigris buckets set are removed. Use --locations.

Each removed entry exits with a redirect message pointing at the replacement; nothing fails silently.

Other cleanup

  • Drop OperationSpec alias, ParsedPaths type, unused YAML anchors (consistency_options, region_options).
  • update-docs and generate-registry skip removed entries automatically.
  • bucket-info no longer renders the deprecated ttlConfig row; the TTL rule appears under Lifecycle Rules like any other rule.
  • Unexport internal-only helpers from lib/buckets/lifecycle/shared.ts.

Test plan

  • npm run lint and npm run format:check pass
  • npm test passes (636 unit tests)
  • npm run build succeeds
  • Smoke check redirect messages: tigris forks, tigris buckets set-ttl, tigris buckets set-transition, tigris mk … --region, tigris buckets create … --region, tigris buckets set … --region, tigris mk … --consistency
  • tigris buckets lifecycle --help lists only list, create, edit
  • Manually exercise tigris buckets lifecycle create / list / edit end-to-end against a bucket
  • tigris buckets get <bucket> shows TTL-shaped rules under Lifecycle Rules (no separate TTL row)

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because this introduces new lifecycle rule flows and changes CLI dispatch/help behavior (including hidden/removed commands and flags), which can break existing scripts if redirects or parsing differ from expectations.

Overview
Adds a new tigris buckets lifecycle command group (list, create, edit) to manage multi-rule bucket lifecycle configuration (transitions and TTL/expiration, optionally scoped by prefix), including shared validation/formatting helpers and updated bucket info rendering for lifecycle rules.

Introduces a generic hard-remove mechanism in the spec/types (removed, replaced_by) and updates cli-core, docs generation, and registry generation to hide removed entries from help/docs while still parsing them to emit a clear redirect-and-exit message.

Removes deprecated commands/flags and their implementations: buckets set-ttl, buckets set-transition, forks commands, plus deprecated --region/--consistency handling in bucket creation/update paths; tests are updated to assert redirect behavior and the new fork flow via buckets create --fork-of / buckets list --forks-of. Dependency @tigrisdata/storage is bumped to ^3.4.0.

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

Add tigris buckets lifecycle (alias lc) with list, create, edit for
multi-rule lifecycle management (transitions and TTL/expiration with
optional prefix filter), backed by the updated @tigrisdata/storage SDK.

Add a generic removed/replaced_by mechanism on CommandSpec and Argument
so the cli-core can intercept removed entries with a clean redirect
message instead of "unknown command/option". Removed commands are
hidden from help and have no implementation file.

Breaking changes:
- buckets set-ttl and buckets set-transition removed; use
  buckets lifecycle create/edit
- forks list and forks create removed; use buckets create --fork-of
  and buckets list --forks-of
- --region and --consistency flags on mk, buckets create, buckets set
  removed; use --locations

Other cleanup:
- drop OperationSpec alias, ParsedPaths type, unused YAML anchors
- update-docs and generate-registry skip removed entries
- bucket-info no longer renders the deprecated ttlConfig row; the TTL
  rule appears under Lifecycle Rules like any other rule

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/lib/buckets/lifecycle/edit.ts
Comment thread package.json
When editing a transition rule, transitionDeltaFromInput only emitted
the field the user set, so spreading over the existing target left
both `days` and `date` populated. The API rejects rules with both.

Same latent bug for expiration. Both helpers now explicitly emit the
unset field as `undefined` so spreading clears it. Adds regression
tests pinning the new behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/lib/buckets/lifecycle/edit.ts
Comment thread src/lib/buckets/lifecycle/create.ts
Bug 3 (high): edit's call to validateRuleFieldCombinations rejected
--days/--date without --storage-class even though the existing rule
already has a class. Validator now takes a requireStorageClassForTiming
flag (default true for create, false for edit). Edit performs the
storage-class-and-timing check post-fetch against the merged rule, so
both `--days 60` alone and `--storage-class IA` alone are accepted as
long as the result is a valid transition.

Bug 4 (medium): create accepted --storage-class without --days/--date,
producing a transition rule without timing that the SDK silently dropped.
Added the inverse check: --storage-class requires --days or --date.

Adds regression tests for both fixes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/lib/buckets/lifecycle/create.ts Outdated
Comment thread src/utils/bucket-info.ts Outdated
Bug 5: create.ts used a truthy check (input.prefix ?) while edit.ts
used input.prefix !== undefined, so --prefix "" was silently ignored
by create but applied by edit. Both now use !== undefined and the
shared validator rejects an empty --prefix.

Bug 6: utils/bucket-info.ts duplicated the transition-format string
("GLACIER after 30d") that lib/buckets/lifecycle/shared.ts also built
in formatTransitionCell. Extract describeTransition / describeExpiration
into utils/bucket-info.ts as the single source of truth; the cell
formatters now compose them with a "-" fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread src/cli-core.ts
After CommandSpec.description was made optional for the removed-entry
tombstones, three help-rendering paths in cli-core.ts still interpolated
it directly, which would print the literal string "undefined" if a
non-removed command lacked a description. Coerce with ?? '' to match
the other rendering paths in the file.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b686e1d. Configure here.

Comment thread src/specs.yaml
The original `forks` command had `alias: f`. When tombstoning the entry
the alias was dropped, so `tigris f` (and any other short-alias use)
fell through to a generic "unknown command" error instead of the
redirect message. Restore the alias so all entry points hit the
redirect.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants