feat(storage): add copy, move, and setObjectAccess; deprecate updateObject#97
Conversation
Splits the ACL-flip behavior out of `updateObject` into a dedicated `setObjectAccess` helper under `lib/object/set/`, mirroring the `bucket/set/*` layout. `updateObject` is marked `@deprecated` and will be removed in a future major version. Assisted-by: Claude Opus 4.7 via Claude Code
`copy(src, dest, options?)` and `move(src, dest, options?)` both share a single `copyOrMove` implementation in `lib/object/copy.ts`; `move` is a thin wrapper that flips the `X-Tigris-Rename` header. Cross-bucket is supported via `srcBucket` / `destBucket` options (default to `config.bucket`). Response includes full `src` and `dest` paths (`bucket/key`) so cross-bucket results are unambiguous. Replaces `updateObject`'s rename branch (still exported for backward compatibility, marked `@deprecated`). Integration tests cover same-bucket copy/move, identical-key rejection, and `setObjectAccess` public/private (replacing the deprecated `updateObject` test block). Assisted-by: Claude Opus 4.7 via Claude Code
Assisted-by: Claude Opus 4.7 via Claude Code
Greptile SummaryThis PR adds
Confidence Score: 3/5Safe to merge after addressing the missing path guard in
Important Files Changed
Reviews (1): Last reviewed commit: "chore(storage): add changeset for copy/m..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d2e363a. Configure here.
| return missingConfigError('bucket'); | ||
| } | ||
|
|
||
| const destBucket = options?.destBucket ?? srcBucket; |
There was a problem hiding this comment.
Empty destBucket string bypasses bucket validation
Low Severity
The srcBucket value is validated for emptiness with if (!srcBucket), but destBucket has no equivalent check. If a caller explicitly passes destBucket: '', the nullish coalescing operator (??) won't fall through to srcBucket because empty string isn't nullish. This results in a malformed request path like //${encodeURIComponent(dest)}?x-id=CopyObject instead of a clear validation error.
Reviewed by Cursor Bugbot for commit d2e363a. Configure here.
Adds an Agent Behavior section clarifying that AI agents must not run `git commit`, `git push`, or open a PR without an explicit in-the-moment user instruction; approval for one such action does not extend to the next. Assisted-by: Claude Opus 4.7 via Claude Code


Summary
copy(src, dest, options?)andmove(src, dest, options?)for copying/moving objects within or across buckets, sharing a singlecopyOrMoveimplementation (move sets theX-Tigris-Renameheader). Cross-bucket viasrcBucket/destBucket(default toconfig.bucket); response returns fullbucket/keypaths for bothsrcanddest.setObjectAccess(path, { access })extracted fromupdateObject, mirroring thebucket/set/*layout underlib/object/set/.updateObject@deprecated(still exported for backward compatibility) — usesetObjectAccessfor ACL changes andmovefor renames.updateObjectintegration test block with focusedsetObjectAccess,copy, andmovetests.@tigrisdata/storage).Test plan
pnpm --filter @tigrisdata/storage exec tsc --noEmit— cleanpnpm test— 148 tests pass (8 new integration tests against a real bucket)biome check— clean (runs in pre-commit hook)🤖 Generated with Claude Code
Note
Medium Risk
Adds new object mutation APIs (copy/move and ACL updates) that can affect data placement and permissions; behavior is validated by integration tests but relies on correct header/path handling.
Overview
Adds new object operations to
@tigrisdata/storage:copy(src, dest, options?)andmove(src, dest, options?), including optional cross-bucket support viasrcBucket/destBucketand a shared implementation that drivesCopyObjectrequests (with rename viaX-Tigris-Rename).Introduces
setObjectAccess(path, { access })for ACL changes and marksupdateObjectas@deprecated, steering renames tomoveand ACL updates tosetObjectAccess. Updates public exports and replacesupdateObjectintegration coverage with targeted tests for the new APIs, and includes a changeset for a minor release.Reviewed by Cursor Bugbot for commit 8390715. Bugbot is set up for automated code reviews on this repo. Configure here.