Skip to content

fix(storage): use correct header in isMigrated#84

Merged
designcode merged 2 commits intomainfrom
fix/is-migrated-method
Apr 16, 2026
Merged

fix(storage): use correct header in isMigrated#84
designcode merged 2 commits intomainfrom
fix/is-migrated-method

Conversation

@designcode
Copy link
Copy Markdown
Collaborator

@designcode designcode commented Apr 16, 2026

Note

Medium Risk
Changes the logic that decides whether an object is considered migrated, which can affect read routing/behavior for storage objects. Risk is limited in scope but could cause incorrect migration state detection if upstream header values differ from expectations.

Overview
Updates isMigrated to determine migration status by reading X-Tigris-Read-Source from the HeadObject response and treating block_shadow as not migrated, replacing the prior check that inferred migration from the presence of X-Tigris-Served-From.

Adds the new TigrisHeaders.READ_SOURCE enum value to standardize use of this header across the codebase.

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 16, 2026

Greptile Summary

This PR switches isMigrated from checking the presence of X-Tigris-Served-From to comparing the value of a new X-Tigris-Read-Source header against 'block_shadow', and adds the corresponding enum entry.

  • The header key lookup responseHeaders[TigrisHeaders.READ_SOURCE] uses the mixed-case string 'X-Tigris-Read-Source', but responseHeaders stores keys in lowercase (as snapshot.ts demonstrates with TigrisHeaders.SNAPSHOT_VERSION.toLowerCase()). This causes the lookup to always return undefined, so isMigrated will always return true regardless of actual migration state.

Confidence Score: 2/5

Not safe to merge — the header key lookup is always a miss due to missing .toLowerCase(), making isMigrated return true for all objects.

A P1 bug causes isMigrated to always return true because the mixed-case header key never matches the lowercase keys stored in responseHeaders, defeating the purpose of this fix.

packages/storage/src/lib/object/migrate.ts — the header key lookup needs .toLowerCase().

Important Files Changed

Filename Overview
packages/storage/src/lib/object/migrate.ts Switches isMigrated to check the new X-Tigris-Read-Source header, but omits .toLowerCase() on the key, causing the lookup to always miss since responseHeaders uses lowercase keys.
shared/headers.ts Adds READ_SOURCE = 'X-Tigris-Read-Source' to the TigrisHeaders enum — straightforward and correct.

Reviews (1): Last reviewed commit: "fix(storage): use correct header in isMi..." | Re-trigger Greptile

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 6251273. Configure here.

Comment thread packages/storage/src/lib/object/migrate.ts
Comment thread packages/storage/src/lib/object/migrate.ts Outdated
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@designcode designcode merged commit 0d0ba90 into main Apr 16, 2026
2 checks passed
@designcode designcode deleted the fix/is-migrated-method branch April 16, 2026 18:43
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 3.1.1 🎉

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