Repository navigation
fix: void init should run an actual drizzle migration. - #91
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See https://discord.com/channels/1475973262193459293/1486949277698752593/1491280811066916876