Repository navigation
fix(worker): a request of one reader never meets the HTML cache or the last good renders - #74
Merged
Merged
Conversation
…e last good renders
…st, session cookie name, og row
wojciechszyjka
commented
Nov 30, 2026
wojciechszyjka
left a comment
Collaborator
Author
There was a problem hiding this comment.
Code review: om-auto-review-pr (head a92fc9a)
Verdict: approve-ready. Posted as a comment, because GitHub does not let the author approve their own PR.
An independent review pass found 0 blockers, 0 majors, 2 minors and 3 nits. All five are fixed in a92fc9a.
Minors
- The "stores or removes nothing" check compared keys only, so it missed an overwrite under the same key. On 322a252 the Authorization row passed for that reason. The check now compares the stored objects, and that row fails on 322a252.
astro-sessionis Astro's default session cookie name. A test now fails ifastro.worker.config.tssetssession.cookie.
Nits
- Removed dead
readcode: every non-read request already returns early. - The fake cold path now matches cookie names exactly.
- Added an og card row,
/og/crm.png?_preview=.... It fails on 322a252 because the refused query removed the kept card.
Validation
yarn check: pass.npx vitest run test/worker: 379 passed.- Built Worker on a fresh local D1, run on e34e74c. The review fixes after it change only the dead
readcode and the tests.admin-d1.ts: 35 checks and the outage phase pass.- WP11's smoke check: 37 of 37 pass.
- The repro answers as a cold page.
CI is pending at this head. This comment does not wait for it.
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.
Fixes a regression of WP10 (#69) that WP11's harness found. In the HTML cache of
src/worker/editorial-cache.ts, a request carrying EmDash's edit-mode cookie was answered beforesrc/outer-middleware.tsran. A cached/crmthen went to that request withpublic, max-age=0, must-revalidateand withoutSet-Cookie: emdash-edit-mode=deleted, while a cold page answersprivate, no-storeand clears the cookie (WP01's rule, decision D6a).Change
privateRequest()names the requests that belong to one reader.editorialApp()passes such a request straight to the site: no read of the generations, no cache hit, nothing stored, no kept render removed. The request then gets exactly the cold path. The set:emdash-edit-mode(WP01; dropped and cleared outside /_emdash by the outer middleware);src/route-policy.tsrefuses:_preview,_edit,/_image, the OAuth metadata (their 404);Cf-Access-Jwt-Assertionand theCF_Authorizationcookie;astro-session(a signed-in editor);Authorizationheader (already excluded before).The same order problem also hit two other paths. Both are fixed by the same check:
no-storebut without the cleared cookie. It now gets the cold 503, which clears the cookie./crm?_edit=1answered 404, and that 404 removed the kept render of/crm, so anyone could empty the outage fallback of any page.The og card route (
/og/<slug>.png) goes through the sameeditorialApp(), so the same check covers it. Its og crop runs inside the cold path.Verification
test/worker/publish/cache-private.test.ts: 14 cases (the review added an og card row, an overwrite-proof check of the kept and cached objects, and a check that the Worker config keeps Astro's session cookie name). On 322a252 with a stubprivateRequest, 13 fail on assertions, for exampleexpected 'hit' to be nulland, in the outage case,expected [ 200, null ] to deeply equal [ 503, ... ]. The 14th, the config check, passes there too, as it should. On this head all 14 pass.yarn check: passes.npx vitest run test/worker: 379 passed.yarn om emdash-import:GET /crmanswers miss, then hit. ThenGET /crmwithCookie: emdash-edit-mode=trueanswers200,private, no-store,Set-Cookie: emdash-edit-mode=deleted, with noX-OM-Cache, the same as a cold page./crm?_edit=1answers 404.test/worker/publish/admin-d1.ts: 35 checks, then the outage phase, all pass. The run used the same local, uncommitted Access key source as for feat(worker): the publish guard, the D1 invariants and the cache (WP10) #69.test/worker/smoke.ts(fromfeat/wp11-worker-harness): 37 checks, all pass.test/worker/smoke.tson main still expects the WP04 shell: placeholder home, admin 302, older route list. It fails 5 checks that are unrelated to this change; WP11 updates it.