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
This commit is contained in:
dckc committed 2026-10-07 09:46:21 -05:00
1 parent 7c0d1d62c6
commit 279ddb4caa
1 file changed
+3 -8
+3 -8
View File
@@ -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<Response> {
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);