Skip to content

Conversation

@whoiskatrin
Copy link
Collaborator

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: c89eb09

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/sandbox Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

claude[bot]

This comment was marked as outdated.

claude[bot]

This comment was marked as outdated.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 25, 2025

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/sandbox-sdk/@cloudflare/sandbox@243

commit: c89eb09

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2025

🐳 Docker Image Published

FROM cloudflare/sandbox:0.0.0-pr-243-3caea86

Version: 0.0.0-pr-243-3caea86

You can use this Docker image with the preview package from this PR.

Copy link
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

All previous issues resolved. Nice work addressing the feedback!

What was fixed:

  • ✅ Added comprehensive test for readFileStreamOperation() with explicit verification that only 3 metadata commands run (no full file read)
  • ✅ Expanded doc comment explaining why getFileMetadata() exists
  • ✅ Added NaN validation in both getFileMetadata() and the existing read() method
  • ✅ Extracted isBinaryMimeType() helper to eliminate duplication

Code quality: Excellent. Clean abstraction, comprehensive tests, follows established patterns.

Handler simplification: The file-handler.ts change removed 31 lines by properly delegating to the service layer - good example of proper abstraction.

Minor suggestions for future consideration:

  • Could cache MIME type detection results if profiling shows repeated operations on same files as a bottleneck (unlikely)
  • Doc comment could mention session isolation behavior, though current version is clear

Neither suggestion blocks merging. Looks good.

@whoiskatrin whoiskatrin marked this pull request as ready for review November 25, 2025 11:44
Add a method to retrieve only file metadata.
Copy link
Contributor

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

All previous issues have been properly addressed. The implementation looks excellent:

  • NaN validation added with proper error handling
  • Binary detection extracted to helper method (no duplication)
  • Doc comment clearly explains optimization purpose
  • Comprehensive test coverage verifies the key optimization (no full file reads)

The tests are particularly well-done - they explicitly verify command sequences to prove getFileMetadata() doesn't read file content, and that readFileStreamOperation() correctly uses the new method instead of read().

Approved - ready to merge.

@whoiskatrin whoiskatrin merged commit 32a0dab into main Nov 25, 2025
12 checks passed
@whoiskatrin whoiskatrin deleted the metadata-files-fix branch November 25, 2025 16:34
@github-actions github-actions bot mentioned this pull request Nov 25, 2025
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