diigo-cache: diigo counts pages from 0; migrate stored pages (schema v2)
Comparing a cache with diigo's RSS export: the size-100 walk had missed
exactly the 100 newest bookmarks (everything updated since 2026-09-16).
diigo's page_num is 0-based, and we sent our 1-based page number
unchanged, so "page 1" was really page 2 and the newest page was never
fetched. diigo's total (16744) was right; the "total-overstated"
reading was a misdiagnosis.
- page() asks for page_num = n - 1
- BREAKING for stored state, agreed beforehand, migrated in place:
schema v2 renumbers every stored page +1 (pages and page_members, via
negation so no number collides), once, recorded as kv "schema" = 2;
nothing is refetched, page 1 just becomes a miss
- fill jobs record their numbering; a job saved without it fails ("page
numbering changed …; start the fill again") instead of resuming
- the fake pages from 0 like diigo (7 tests failed until the fix);
tests feed v1-shaped storage and a v1-numbered job to the new code
- the next-page peek guard stays; its comments no longer claim diigo
overstates its total
- the fixed test clock moves to 2099: pinned to "today" its alarms came
due in real time and fired on their own
Generated-by: Claude Opus 5.5
This commit is contained in:
1 parent
e6deb9fda0
commit
cffb1fa9b2
5 files changed
+116
-17
No files matched your search
@@ -14,7 +14,8 @@ const TOTAL = 250;
|
||||
const CAPPED_WEBAPP = "fake-capped-webapp";
|
||||
const CAP = 64;
|
||||
/** the plain account, but its `total` claims 60 more items than it has
|
||||
* (as diigo's does, observed 2026-10-07) */
|
||||
* (hypothetical: what looked like this on 2026-10-07 was the 0-based
|
||||
* page_num, but the guard stays) */
|
||||
const OVERSTATED_WEBAPP = "fake-overstated-webapp";
|
||||
const OVERSTATEMENT = 60;
|
||||
|
||||
@@ -93,7 +94,9 @@ class FakeGet extends RpcTarget {
|
||||
const total = this.#dated === "deep" ? DEEP_TOTAL : dated ? DATED_TOTAL : TOTAL;
|
||||
const now = Date.now();
|
||||
const items = [];
|
||||
for (let n = (page - 1) * count + 1; n <= Math.min(page * count, total); n += 1) {
|
||||
// diigo's page_num counts from 0 (observed 2026-10-07: page_num=1
|
||||
// skipped the newest page)
|
||||
for (let n = page * count + 1; n <= Math.min((page + 1) * count, total); n += 1) {
|
||||
items.push(dated ? datedItem(n, now, this.#dated === "deep" ? "deep_dee" : "dated_dan") : item(n));
|
||||
}
|
||||
// past the end, diigo answers no items and a total of 0 (observed
|
||||
|
||||
Reference in new issue
Block a user