diigo-cache: page size 100, diigo's cap; fill jobs record their page size

Asked for 128, diigo returned 100 (the short-page guard caught it on the
first real fill), so PAGE_SIZE = 100: ~168 pages for 16.7k bookmarks.

The same run showed a fill job outliving a page-size change: progress
counted in 24s ("page 25 of 698") resumed as if counted in 128s. Stored
state reinterpreted, so: FillStatus records pageSize (additive; jobs
saved without it counted in 24), and a job whose size differs from
PAGE_SIZE fails with "page size changed …; start the fill again"
instead of resuming; starting again replaces it. Tested with the old
shape in storage.

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 04:59:39 -05:00
1 parent 3baffcab4c
commit 563cb83995
4 files changed
+60 -20

No files matched your search

+9 -7
View File
@@ -1,17 +1,18 @@
/**
* @file a stand-in for webapp's `WebAppFactory` entrypoint, for tests: an
* auxiliary worker (plain JS — the vitest pool doesn't transform aux
* workers) serving diigo-shaped `load_user_items` pages. 300 items (3
* pages of 128), every third private; a few webapp ids are known. Counts its diigo calls so tests
* workers) serving diigo-shaped `load_user_items` pages. 250 items (3
* pages of 100, the last short), every third private; a few webapp ids
* are known. Counts its diigo calls so tests
* can tell a cache hit (no call) from a miss.
*/
import { RpcTarget, WorkerEntrypoint } from "cloudflare:workers";
const KNOWN_WEBAPP = "fake-webapp-id";
const TOTAL = 300;
/** the plain account, but diigo-style capped at 100 items per page */
const TOTAL = 250;
/** the plain account, capped below PAGE_SIZE (as diigo caps at 100) */
const CAPPED_WEBAPP = "fake-capped-webapp";
const CAP = 100;
const CAP = 64;
/** a second account, for date filters (goal 1d): 60 bookmarks, item n
* updated n-1 days + 1 hour before the call, in diigo's updated-desc
@@ -19,7 +20,7 @@ const CAP = 100;
* 5th an old bookmark edited recently (created 100 days before updated) */
const DATED_WEBAPP = "fake-dated-webapp";
const DATED_TOTAL = 60;
/** the same shape, 6000 deep (~16 years, 47 pages of 128): for walk cost */
/** the same shape, 6000 deep (~16 years, 60 pages of 100): for walk cost */
const DEEP_WEBAPP = "fake-deep-webapp";
const DEEP_TOTAL = 6000;
const HOUR = 60 * 60 * 1000;
@@ -41,7 +42,8 @@ function datedItem(n, now, user = "dated_dan") {
/** item n (1-based, in diigo's order): diigo's field names, made-up
* values. link_id and updated_at are scrambled (distinct; 7 and 11 are
* coprime to 307, a prime above TOTAL), so neither column sorts back into diigo's order — a
* coprime to 307, a prime above TOTAL), so neither column sorts back
* into diigo's order — a
* cache that replays by column rather than by fetch order is caught. */
function item(n) {
return {