ReviewOS

home-lang/home

Port Bun.serve Bun.file routes, ranges, and stream safety

#173
Closed chris opened this 10 days ago ·
10 days ago

Tracks a focused tranche of #66.

Scope:

  • activate the exact upstream js/bun/http/bun-serve-file.test.ts corpus without source edits
  • implement shared Bun.file response semantics for MIME types, Last-Modified, empty files, missing-file fallback, HEAD, conditional requests, byte ranges, and cancellation
  • preserve custom headers/status and file-slice boundaries
  • cover FIFO backpressure and late request-body file-response safety fixtures
  • eliminate large-file stress allocations and add a durable exact-corpus regression

Acceptance evidence to be posted after the commit is pushed.

10 days ago

Implemented and pushed in 0cd698ed90cbb7d05c23a8d26fcb7c743dbb67e0 (merged/published on main at 976b02dd31e726f960d1b5e0ef2a5190eecbc787).

Evidence:

  • exact upstream js/bun/http/bun-serve-file.test.ts: 66 passed, 0 failed, 0 unsupported, 2 upstream TODOs
  • js/bun/http/fetch-file-upload.test.ts: 6/6 passed
  • js/web/fetch/body-clone.test.ts: 25/25 passed
  • js/bun/globals.test.js: 20/20 passed
  • full zig build test -Dfilter=home_test --summary failures: exit 0
  • Home/upstream corpus SHA-256 match: a267b000a64bf1b0a1874bc80f5cd2dd77b8aa2bf41f020a8cb62e8bd6b36ac8

Shared behavior now covers MIME inference, Last-Modified/preconditions, missing-file fallback, empty-file 204s, HEAD responses, single byte ranges/416s, range/custom-header preservation, file-slice boundaries, immediate aborts, and the two subprocess stream-safety fixtures. Large-file stress now avoids repeated byte-array length materialization and implicit file ETag hashing. Durable Home tests execute the exact upstream corpus and assert its 66/2 result.

Sign in to comment on this issue.