From 279ddb4caae8f8a748e6a215b73e5ceb2044efc0 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 7 Oct 2026 09:46:21 -0500 Subject: [PATCH] fixup! diigo-cache: the public page only reads Comments written for the reader: no restating what the shebang says, no traces of the design conversation; the publish comment no longer mentions a projection that no longer exists. Generated-by: Claude Opus 5.5 --- diigo-cache/src/index.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/diigo-cache/src/index.ts b/diigo-cache/src/index.ts index e61234a..c5be9ca 100644 --- a/diigo-cache/src/index.ts +++ b/diigo-cache/src/index.ts @@ -16,11 +16,8 @@ import { updatedISO, usernameOf } from "./items.js"; import { toWebkey, idFromWebkey, isWebkey, shashKey } from "./webkeys.js"; import { pmSave } from "./pm-save.js"; -/** - * the live clock. This module is the worker's edge — the runtime's entry, - * like a program script — so ambient time is reached here and delegated - * down; the cache logic only uses the clock it is given. - */ +/** the live clock: the worker's entry module reads ambient time and hands + * it to the cache logic, which uses only the clock it is given */ function liveClock(): Clock { return { now: () => Date.now(), sleep: (ms) => new Promise((r) => setTimeout(r, ms)) }; } @@ -382,9 +379,7 @@ async function publishCache(request: Request, env: Env): Promise { if (wiring.publicId) { return Response.json({ cacheId, publicId: wiring.publicId, status: "already published" }); } - // seed the projection *now*, while the cache is still private-only: - // only rows already cached and marked shared can enter the public - // side; the username rides the same rows + // the username comes from the items: the cookie's own account const firstPage = await cache.page(1, PAGE_SIZE); const firstItem = firstPage.items[0] ? (JSON.parse(firstPage.items[0]) as Item) : undefined; const username = usernameOf(firstItem);