diigo-cache: a fill ends at the first page past the data

Seen live: "filled: 168 of 1 pages". diigo's total overstated by 100
(16744 vs 16644), so the walk went on to page 168, which diigo answered
empty with a total ≤ 100; the fill recomputed its page count from that,
ceil(total/100) = 1.

Now a page whose own total says the data ended before it ends the walk,
with the count set to the last page with items ("167 of 167"). Judged
by total, not by items, since the public cache may keep none of a page
that isn't the end. The known-pages estimate ignores zero totals. The
fake answers past-the-end pages as diigo does (no items, total 0).

Generated-by: Claude Opus 5.5
This commit is contained in:
dckc committed 2026-10-07 05:08:12 -05:00
1 parent fd16c7db53
commit 4034fba76b
3 files changed
+22 -5

No files matched your search

+5 -1
View File
@@ -135,7 +135,11 @@ describe("fill job (goal 1e)", () => {
const stub = await wired("fake-overstated-webapp");
await stub.startFill();
await drain(stub);
expect(await stub.fillStatus()).toMatchObject({ state: "done" });
// 250 items claimed as 310: the walk reaches page 4 (empty, total 0)
// and ends there; the count is the last page with items, not 4, and
// not the empty page's ceil(0/100) = 1
const status = await stub.fillStatus();
expect(status).toMatchObject({ state: "done", nextPage: 4, pages: 3 });
expect((await stub.page(3, PAGE_SIZE)).items).toHaveLength(50);
});