Skip to content

fix: void init should run an actual drizzle migration. - #91

Merged
cpojer merged 1 commit into
mainfrom
void-init-fix
Apr 8, 2026
Merged

cpojer merged 1 commit into
mainfrom
void-init-fix

Conversation

@cpojer

@cpojer cpojer commented Apr 8, 2026

Copy link
Copy Markdown
Member

@cpojer
cpojer requested a review from Brooooooklyn April 8, 2026 08:14
@cpojer
cpojer merged commit c863c82 into main Apr 8, 2026
7 checks passed
@cpojer
cpojer deleted the void-init-fix branch April 8, 2026 08:22
cpojer pushed a commit that referenced this pull request Sep 11, 2026
… keeps draining (#91)

The for-await parse loop awaited the full KV/R2 PUT for each `asset:*`
part inline, starving `c.req.raw.body` during per-asset upload. On
asset-heavy deploys (cpojer-blog: 199 files) the CF edge closed the
inbound socket mid-stream and the CLI printed "Connection lost during
deploy", even though c6c267d removed the server-side OOM.

Split `collectAndUploadStaticAsset` into `readStaticAssetPart`
(stream-read + hash inline) and `uploadStaticAssetPart` (dedupe +
PUT). The parse loop now reads one part synchronously, kicks the PUT
off into a concurrency-limited pool (max 4 in-flight, sharing
`STATIC_ASSET_UPLOAD_CONCURRENCY` with the bulk-upload path), and
advances. `staticUploadPromises` retains every pool task so rejections
that settle before the post-parse drain still propagate through
`Promise.all`; `inFlightStaticUploads` gates the pool via
`Promise.race`. The budget charge moves into each task's `finally` so
memory pressure still caps residency. The catch path now waits on
in-flight uploads with `Promise.allSettled` before cleanup to avoid
deleting a KV/R2 key while its PUT is still writing.

Adds a regression test that blocks `STATIC_ASSETS.put` on gates and
asserts all N asset PUTs are in flight concurrently — fails with
`expected 1 to be 3` before this fix.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
cpojer pushed a commit that referenced this pull request Sep 11, 2026
…est (#93)

The fan-out change in #91 let KV/R2 PUTs run concurrently but each pool
slot independently charges `bufferedBudget` for its resident bytes. CLIs
that mirror the same binary under multiple URL paths (cpojer-blog emits
every media file both under `/blog/...` and `/client/blog/...`) doubled
every large asset's memory residency during parse, pegging the 64 MiB
aggregate cap on deploys that would otherwise fit.

When the declared `assetManifest` maps an incoming `asset:/path` to a
hash already resident or in-flight this request, drain the body with
strict size verification and commit the manifest entry directly from
the declared hash+size. Zero budget charge, zero redundant PUT.

Security: dedupe is per-request, keyed by blobs already read-and-hashed
by this same request. A malicious client declaring a wrong hash for a
later path can only cause the first-occurrence content to serve at that
path — exactly what the declared manifest asked for. Cross-project
bleed is blocked by the `projectId`-scoped KV/R2 key namespace.

Parses the declared manifest eagerly so the fast-path can fire as soon
as the `assetManifest` part arrives (standard CLI order: manifest,
assetManifest, asset:*).

Co-authored-by: Claude Opus 4.7 (1M context) <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.

1 participant