fix(snapshots): persist lastConfirmedAt into snapshot metadata upon pull confirmation
CI / Typecheck, test, feed (push) Successful in 20s
CI / Build site (push) Successful in 11s
CI / Container image (push) Successful in 41s

Record lastConfirmedAt in snapshot metadata when a source is confirmed (200 or 304). This ensures git-committed snapshot metadata reflects when sources like wiki.gg were successfully pulled even when page HTML did not change, avoiding false pull overdue notices on downstream builds like GitHub Pages.
This commit is contained in:
Lucas Winther committed 2026-09-18 10:37:37 +02:00
1 parent f07607911b
commit 84441b6d6d
7 files changed
+40 -15

No files matched your search

+1
View File
@@ -173,6 +173,7 @@ describe("a normal cycle", () => {
const snapshot = await store.read("genshin-game8-events");
expect(snapshot?.html).toBe("<html><event></event></html>");
expect(snapshot?.meta.contentChangedAt).toBe("2026-08-01T00:00:00.000Z");
expect(snapshot?.meta.lastConfirmedAt).toBe(NOW.toISOString());
expect(snapshot?.state.lastConfirmedAt).toBe(NOW.toISOString());
});
+15 -3
View File
@@ -385,16 +385,28 @@ describe("the six-hour floor", () => {
expect(state.lastConfirmedAt).toBe(T1);
});
test("check bookkeeping lives outside the committed metadata", async () => {
test("failed check bookkeeping lives in state without modifying meta", async () => {
await save("<html>one</html>", T0);
const before = await Bun.file(store.metaPath("genshin-game8-events")).text();
await store.recordCheck("genshin-game8-events", {
at: T1,
status: 503,
ok: false,
});
const after = await Bun.file(store.metaPath("genshin-game8-events")).text();
expect(after).toBe(before);
});
test("successful confirmation updates lastConfirmedAt in metadata", async () => {
await save("<html>one</html>", T0);
await store.recordCheck("genshin-game8-events", {
at: T1,
status: 304,
ok: true,
});
const after = await Bun.file(store.metaPath("genshin-game8-events")).text();
expect(after).toBe(before);
const meta = await store.readMeta("genshin-game8-events");
expect(meta?.lastConfirmedAt).toBe(T1);
expect(meta?.contentChangedAt).toBe(T0);
});
});