Skip to content

fix: normalize Cloudflare R2 range metadata - #279

Merged
iamjr15 merged 1 commit into
mainfrom
fix/r2-range-runtime-shape
Aug 13, 2026
Merged

fix: normalize Cloudflare R2 range metadata#279
iamjr15 merged 1 commit into
mainfrom
fix/r2-range-runtime-shape

Conversation

@iamjr15

@iamjr15 iamjr15 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replaces structural R2 range discrimination with numeric property guards
  • handles Cloudflare's runtime object shape where optional range keys can be present with undefined values
  • prevents malformed Content-Range offsets while retaining zero-copy R2 streaming

Root cause

The deployed runtime returned an offset range object that also contained an undefined suffix key. The TypeScript union suggests those shapes are exclusive, but an in check is not a valid runtime discriminator for this platform object. A production byte-range probe exposed Content-Range: bytes NaN-....

Verification

  • full repository gate chain passed
  • production acceptance after merge: expect 206, Content-Range: bytes 0-1023/880729, and a 1,024-byte body
  • production acceptance after merge: native video metadata, playback, and seeking in the existing Deliverables card

Use numeric property guards for the runtime R2 range shape. Cloudflare includes
optional keys with undefined values, so structural union checks cannot safely
discriminate suffix and offset ranges.
@vercel

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cheatcode Skipped Skipped Aug 13, 2026 10:43am

@iamjr15
iamjr15 merged commit 21a9830 into main Aug 13, 2026
6 checks passed
@iamjr15
iamjr15 deleted the fix/r2-range-runtime-shape branch August 13, 2026 10:45
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.

1 participant