Conversation
@vinext/cloudflare
create-vinext-app
@vinext/types
vinext
@cloudflare/workers-response-store
commit: |
Contributor
Performance benchmarksCompared 0 improved · 0 regressed · 6 within ±1.5%
View detailed results and traces 🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head |
Member
|
/bigbonk review for issues Time limit: 8 minutes. Complete the review and post all findings within that limit. |
Contributor
|
LGTM! |
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.
Summary
Infinityrevalidate value used by runtime-rendered static App Router pages through Cloudflare KV.nullrepresentation at the cache-entry validation boundary and restore it toInfinitybefore callers see the entry.NaNand-Infinitywrites so invalid values cannot be confused with the static-page sentinel.Why
JSON.stringify(Infinity)producesnull. The KV adapter previously wrote that value for a static page, then rejected the same row on its next read. Each request therefore became a miss followed by a delete, render, and full KV rewrite.This also repairs beta.9/beta.10 rows already stored with
cacheControl.revalidate: null.Fixes #3311.
Simplification
The original patch added 91 production lines and 57 test lines. The final cumulative diff adds 12 production lines (and removes 1) plus 38 test lines.
The implementation uses native JSON serialization and normalizes once at the existing schema boundary. This removes the custom serialized metadata type, four number codec helpers, duplicate return-path decoding, raw/encoded timestamp pairs, and a redundant legacy-row test. The retained production code is only:
Infinitybut rejects other non-finite revalidate values;nullrepresentation; andInfinitybefore returning a validated entry.Next.js parity and runtime scope
Next.js represents non-revalidating cache policy as
falseor its finiteINFINITE_CACHEsentinel internally. Vinext's existing runtime App Router path intentionally uses positiveInfinity, and its response-header logic already treats that value as the static policy. This PR preserves that current vinext contract rather than changing cache semantics.The Cloudflare KV runtime adapter is shared by the App/Pages dev and production registrations. Deploy-time prerender KV seeding continues to represent static routes as an absent cache-control claim, while TPR only writes finite revalidate values; neither path needs a change.
Red / green proof
e97de291c: the focused regression failed withInvalid cache entry shapeand returned no cache hit.Testing
vp test run tests/kv-cache-handler.test.ts tests/isr-cache.test.ts tests/fetch-cache.test.ts(314 passed)vp test run tests/app-page-cache.test.ts -t "indefinite|non-finite"(2 passed)vp check packages/cloudflare/src/cache/kv-data-adapter.runtime.ts tests/kv-cache-handler.test.tsvp run @vinext/cloudflare#buildThe focused test exercises the complete adapter serialization boundary directly; there is no separate worker-specific branch between the KV string and this parser.