Skip to content

chore: Rewrite peer deps during publish. - #86

Merged
Brooooooklyn merged 1 commit into
mainfrom
rewrite-peer-deps
Apr 7, 2026
Merged

Brooooooklyn merged 1 commit into
mainfrom
rewrite-peer-deps

Conversation

@cpojer

@cpojer cpojer commented Apr 7, 2026

Copy link
Copy Markdown
Member

Because we use aliases, currently npm cannot be used with the Void packages because it gets confused about the peer dependency aliases. This PR changes it so the peer dep info in package.json files gets rewritten during a publish. pnpm does not have this problem. We can remove this code once we publish to npm.

@Brooooooklyn would love a review of this because the solution kinda sucks. Not sure if there is anything else we can do right now though 🤷‍♂️

@cpojer
cpojer requested a review from Brooooooklyn April 7, 2026 09:29
@Brooooooklyn

Copy link
Copy Markdown
Member

Let's merge

@Brooooooklyn
Brooooooklyn merged commit 643fca5 into main Apr 7, 2026
7 checks passed
@Brooooooklyn
Brooooooklyn deleted the rewrite-peer-deps branch April 7, 2026 10:34
cpojer added a commit that referenced this pull request Apr 8, 2026
cpojer pushed a commit that referenced this pull request Sep 11, 2026
* fix(api): stream deploy multipart body to avoid 128 MB OOM

`POST /projects/:id/deploy` called `c.req.formData()`, which decodes
every multipart part into Worker memory at once. Media-heavy static
deploys exceeded the 128 MB Worker limit before the handler even began
processing.

Replace the `formData()` call with a streaming parser in
`packages/api/src/multipart.ts` (async generator yielding per-part
`ReadableStream` bodies, with auto-drain on abandonment and carry logic
for boundaries split across chunks). For `manifest.type === 'spa' |
'static'` deploys, asset parts now pipe straight into KV (<2 MB) or
R2 (>= 2 MB) one at a time via `collectAndUploadStaticAsset`. Full
deploys (workers + assets) still buffer into the per-hash map. Older
CLIs that don't set `manifest.type` fall back to the buffered path so
there is no behavior regression for deployed clients.

The daily deploy-count check is hoisted above the parse loop so a 429
never leaves orphaned KV/R2 writes. The streamed path also carries a
`streamedHashStores` map so identical-content assets dedupe the same
way the old `Map<hash, AssetEntry>` did, matching the previous `new`
count and avoiding redundant writes.

Adds 19 unit tests for the multipart parser and 4 integration tests
covering the small-asset KV path, the >2 MB R2 path, duplicate-hash
dedupe, and pre-upload rejection of unsupported manifest versions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(api): harden deploy multipart streaming against 128 MiB OOM

Tightens the streaming multipart parser and deploy handler so a single
oversized reader.read() can no longer transiently double-buffer its
bytes on the way into the parser, and so large worker:* modules are no
longer copied a second time when building the WfP upload form.

- multipart.ts: queue-based pending buffer with incremental carving for
  reads above MAX_PENDING_RETENTION_BYTES. A large transport chunk is
  parked in partialRead and copied out one bounded slice per fill()
  iteration instead of being eagerly sliced upfront, bounding the peak
  live set to ~1x the read size. Per-part body chunks, header scan, and
  fill growth all stay capped.
- deploy.ts: workerFiles now holds pre-built Blobs (parse-time wrap) so
  the upload loop appends the existing Blob directly instead of
  allocating a second new Blob([uint8Array]) copy per module. Aggregate
  BufferedBudget accounting and cleanup gating on !routingSwitched are
  unchanged.
- assets.ts: streaming asset readers observe the shared buffered-byte
  budget and abort with PartTooLargeError before materializing an
  oversized part.
- tests: regression coverage for the R12/R16/R17 findings, including a
  functional streaming test over a 4 MiB + 3 MiB single-read multipart
  body and an await using test that verifies parser cleanup via
  Symbol.asyncDispose -> return() -> reader.cancel() on the upstream
  source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Brooooooklyn added a commit that referenced this pull request Nov 24, 2026
…, show the last bypass

- waiting_scan copy (API and CLI) says when it waits for a deploy going live
  or for the project's Zero Trust row, not only for a scan (#75, #86).
- The CLI bypass sends the request it saw; the route takes `requestId`, so a
  bypass that loses to a protect gets 409 `public request closed` with its
  state instead of "no public request ... run public" (#72).
- Bypass refusals keep the API code, status and blockers in `--json` (#93).
- GET /projects/:id/zero-trust returns `lastBypass` (reason for deploy and
  up) and `zero-trust status` prints a "Last bypass" line (§13.3).
- `protect` that cancels an open request prints "Public request canceled.
  <slug> stays protected."; a held `public` prints the CLI request lines and
  "Check it: void project zero-trust status" (§11.4, §13.3, #80).
- A public-only Zero Trust switch with the gate on is refused with 409
  `security public gate on` before the existing-projects check (#64).
- Copy nits: "finishes" for one going-public project, the requester in the
  cancel preview, "failing since" from a stored start of the probe failure,
  bypass during a Zero Trust change says "Try again after it ends", and a
  passed request drops its held reason (#65, #87, #89, §5.2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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