Skip to content

[codex] Fix build upload HEAD probes#2055

Merged
riderx merged 2 commits into
mainfrom
codex/fix-build-upload-head
May 6, 2026
Merged

[codex] Fix build upload HEAD probes#2055
riderx merged 2 commits into
mainfrom
codex/fix-build-upload-head

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 6, 2026

Summary (AI generated)

  • Added explicit HEAD routes for native build TUS upload URLs.
  • Forwarded build upload HEAD probes to the builder without a request body.
  • Covered production-style tiny-router HEAD routing and bodyless proxy forwarding in tests.

Motivation (AI generated)

Standard TUS clients use HEAD to discover the current upload offset before resuming. The build upload proxy could return 404 for active upload URLs even when PATCH continued successfully, breaking resumable uploads.

Business Impact (AI generated)

This reduces failed or restarted native build uploads, avoids unnecessary bandwidth use, and keeps build pipeline resume behavior compatible with standard TUS clients.

Test Plan (AI generated)

  • bun lint:backend
  • bunx eslint tests/build-upload-security.test.ts tests/build-upload-head-routing.test.ts
  • bunx vitest run tests/build-upload-head-routing.test.ts tests/build-upload-security.test.ts
  • Commit hook: bun run cli:build && vue-tsc --noEmit

Generated with AI

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved HEAD request handling for upload operations, ensuring proper body and streaming behavior for different request types.
  • Tests

    • Added test coverage for HEAD probe forwarding without request bodies.
    • Updated test suite for enhanced reliability.
  • Documentation

    • Added guidance on Hono v4 HEAD routing best practices.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 156392dd-c04a-4d68-8e37-755585eb8de5

📥 Commits

Reviewing files that changed from the base of the PR and between 879e0a1 and 428ecdb.

📒 Files selected for processing (4)
  • AGENTS.md
  • supabase/functions/_backend/public/build/upload.ts
  • tests/build-upload-head-routing.test.ts
  • tests/build-upload-security.test.ts

📝 Walkthrough

Walkthrough

This PR implements Hono v4 HEAD request handling in the TUS upload proxy, including documentation guidance, conditional refactoring of request initialization to omit body and duplex for HEAD requests, test configuration updates, and new HEAD probe verification tests.

Changes

Hono v4 HEAD Request Handling in TUS Proxy

Layer / File(s) Summary
Documentation
AGENTS.md
Added guidance under AI Workflow Notes that Hono v4 removed app.head() and GET handlers serve HEAD implicitly; recommends keeping shared logic in app.get(...) with c.req.raw.method branching only when behavior differs.
Core Implementation
supabase/functions/_backend/public/build/upload.ts
Refactored TUS proxy fetch to build explicit forwardInit RequestInit object and conditionally attach body and duplex fields only for non-GET/HEAD methods, preserving streaming while simplifying request construction.
Test Configuration
tests/build-upload-head-routing.test.ts
Updated Hono import from hono to hono/tiny in mounted routing test.
Tests
tests/build-upload-security.test.ts
Renamed three concurrent tests to standard execution and added new test case "forwards HEAD probes to builder without a request body" with fetch mocking and assertions for HEAD method handling without request body.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Cap-go/capgo#1959: Both PRs modify TUS upload proxy handling and HEAD/GET request forwarding logic in the same file.

Poem

🐰 A HEAD request hops in clean,
No body baggage on the scene,
Hono v4 says: "GET's enough!"
Simpler streams, less fluffy stuff. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title '[codex] Fix build upload HEAD probes' clearly summarizes the main change: fixing HEAD probe handling for build uploads, which is the primary objective of this PR.
Description check ✅ Passed The PR description includes a summary, motivation, business impact, and a test plan with all items marked as completed, covering most template sections.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-build-upload-head

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 6, 2026

Merging this PR will not alter performance

✅ 28 untouched benchmarks


Comparing codex/fix-build-upload-head (428ecdb) with main (1fd1ce4)

Open in CodSpeed

@riderx riderx marked this pull request as ready for review May 6, 2026 17:11
@riderx
Copy link
Copy Markdown
Member Author

riderx commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@riderx riderx merged commit 0396172 into main May 6, 2026
49 of 50 checks passed
@riderx riderx deleted the codex/fix-build-upload-head branch May 6, 2026 22:08
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