Skip to content

feat(storage): object migration methods#82

Merged
designcode merged 4 commits intomainfrom
feat/list-bucket-source
Apr 14, 2026
Merged

feat(storage): object migration methods#82
designcode merged 4 commits intomainfrom
feat/list-bucket-source

Conversation

@designcode
Copy link
Copy Markdown
Collaborator

@designcode designcode commented Apr 13, 2026

Note

Medium Risk
Adds new storage API methods that trigger and detect object migration via custom headers, which could change runtime behavior when used. Also centralizes error handling across object ops and tweaks build/dev scripts, so regressions would mostly be in SDK responses and build pipelines.

Overview
Adds object migration support to the storage SDK via new migrate() and isMigrated() helpers that issue HeadObject requests with/inspect new X-Tigris-* headers, and exports these methods from server.ts.

Extends object listing to optionally request results from a specified source (tigris vs shadow) and now returns commonPrefixes alongside items.

Unifies error handling by removing per-function handleError implementations in storage object ops and using the shared handleError, updates config typing to allow partial env maps, and changes workspace build/dev scripts to run tsc --noEmit before tsup (and makes root dev ignore missing scripts).

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

@designcode designcode requested a review from efirs April 13, 2026 17:56
Comment thread packages/storage/src/lib/object/migrate.ts Outdated
@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 13, 2026

Greptile Summary

This PR adds migrate() and isMigrated() object-level migration helpers, extends list with a source filter and commonPrefixes in the response, centralises handleError into shared/utils.ts, and makes generateSignatureHeaders module-private.

  • isMigrated header check (migrate.ts:87): !!responseHeaders[TigrisHeaders.SERVED_FROM] treats any non-empty header value as "migrated". If the server echoes X-Tigris-Served-From: shadow for objects not yet migrated (consistent with the "tigris or shadow" pattern used by X-Tigris-List-Source), the function will incorrectly return true. Confirm the exact server contract and consider comparing against === 'tigris'.

Confidence Score: 4/5

Safe to merge after confirming the X-Tigris-Served-From header contract for isMigrated.

One P1 logic concern in the new isMigrated function — if X-Tigris-Served-From can carry a "shadow" value (as the analogous X-Tigris-List-Source does), the presence-only check will silently return wrong data for non-migrated objects. All other changes are refactoring/centralisation with no functional regressions.

packages/storage/src/lib/object/migrate.ts — specifically the isMigrated return value at line 87.

Important Files Changed

Filename Overview
packages/storage/src/lib/object/migrate.ts New file adding migrate() and isMigrated() using HeadObjectCommand; isMigrated may incorrectly report shadow-served objects as migrated due to a presence-only header check.
packages/storage/src/lib/object/list.ts Adds source filter option and commonPrefixes to list response; new middleware is missing name/override options unlike the existing snapshotVersion middleware.
shared/utils.ts Centralises handleError previously duplicated across get.ts, remove.ts, and utils.ts; no logic changes.
shared/headers.ts Adds three new headers: BUCKET_LIST_SOURCE, SCHEDULE_MIGRATION, and SERVED_FROM.
shared/http-client.ts generateSignatureHeaders made module-private and removed from public exports; no behavioural change.
packages/storage/src/lib/config.ts configMap type relaxed to Partial<Record<...>> to allow keys without env-var mappings; missingConfigError handles the undefined case gracefully.
packages/storage/src/server.ts Exports isMigrated and migrate; reorders bundle export; no issues.
packages/storage/src/lib/object/remove.ts Switches to the centralised handleError from @shared/utils; no logic change.
packages/storage/src/lib/object/update.ts Switches to the centralised handleError from @shared/utils; no logic change.

Reviews (1): Last reviewed commit: "feat(storage): object migration methods" | Re-trigger Greptile

Comment thread packages/storage/src/lib/object/migrate.ts Outdated
Comment thread packages/storage/src/lib/object/list.ts
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 29161e2. Configure here.

Comment thread packages/storage/src/lib/object/migrate.ts Outdated
@designcode designcode force-pushed the feat/list-bucket-source branch from 29161e2 to 9010792 Compare April 14, 2026 10:16
@designcode designcode merged commit 25bffdb into main Apr 14, 2026
2 checks passed
@designcode designcode deleted the feat/list-bucket-source branch April 14, 2026 10:56
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 3.1.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