Skip to content

picod: allow empty file content in JSON upload - #481

Merged
volcano-sh-bot merged 1 commit into
volcano-sh:mainfrom
CapThunder19:fix/picod-empty-file-upload
Oct 19, 2026
Merged

volcano-sh-bot merged 1 commit into
volcano-sh:mainfrom
CapThunder19:fix/picod-empty-file-upload

Conversation

@CapThunder19

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it

UploadFileRequest.Content had binding:"required" on a plain string. Gin treats an empty string as missing, so a JSON upload with "content": "" was rejected with a 400. Since the base64 of an empty file is an empty string, there was no way to create an empty file this way. That breaks write_file("", ...) in the Python SDK, run_code with empty code, and the MCP server's write_file tool. Multipart upload of the same empty file already worked.

This changes Content to *string and keeps binding:"required", so:

  • "content": "" creates a zero-byte file
  • a request with no content field is still rejected with 400

Which issue(s) this PR fixes

Fixes #476

Special notes for your reviewer

Added TestHandleJSONBase64Upload_Content, which covers empty content, missing content and normal content. The empty-content case fails on main and passes with this change. I also checked it end to end with the Python SDK against a local PicoD build: write_file("", "pkg/__init__.py") returned 400 before and succeeds now.

Does this PR introduce a user-facing change?

PicoD now accepts empty content in JSON file uploads, so empty files can be created with the SDK's write_file.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 11:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

UploadFileRequest.Content used binding:required on a string, which rejects an empty string, so an empty file could not be created via JSON upload (the base64 of an empty file is an empty string). Make Content a *string so an empty value is accepted while a missing field is still rejected.

Signed-off-by: Anirudh <anirudhpatwal19@gmail.com>
@acsoto

acsoto commented Oct 19, 2026

Copy link
Copy Markdown
Member

/lgtm
/approve

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: acsoto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.42%. Comparing base (5903457) to head (828fb12).
⚠️ Report is 18 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #481      +/-   ##
==========================================
+ Coverage   59.98%   60.42%   +0.43%     
==========================================
  Files          36       35       -1     
  Lines        3589     3618      +29     
==========================================
+ Hits         2153     2186      +33     
+ Misses       1216     1212       -4     
  Partials      220      220              
Flag Coverage Δ
unittests 60.42% <100.00%> (+0.43%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@volcano-sh-bot
volcano-sh-bot merged commit ffd131a into volcano-sh:main Oct 19, 2026
15 checks passed
@CapThunder19
CapThunder19 deleted the fix/picod-empty-file-upload branch October 19, 2026 11:33
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.

PicoD rejects empty file content on JSON upload, so write_file("") fails with 400

5 participants