Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(fence-census): the DST-fallback pass uses the next fallback ahead of now() and runs under pinned clocks (master red since 2026-11-01 05:18Z)

garrytan0f61783a5bc9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 03029c58ec..ebb2456f10 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,14 @@ credits are retained; no result has been reassigned to another provider. Origina
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [Unreleased]
+
+**Master's fence-census suite passes again after the 2026 DST fallback.** The test 'the incremental pass in batches of one reads every page across a DST fallback in the session time zone' wrote fixed `updated_at` values in the 2026-11-01 New York fallback hour. The census only reads pages updated at or after its watermark (the database clock minus two minutes), so once the clock passed about 05:18Z on 2026-11-01 those pages fell behind the watermark, and the test has failed on every run since. It now uses the next fallback that is still ahead of the database clock and asserts that the four instants read 01:20-04, 01:40-04, 01:10-05 and 01:30-05 in the session time zone, so the DST coverage can't quietly disappear. It also runs with the clock pinned inside the 2026 and 2027 fallback hours.
+
+### Itemized changes
+
+- `test/fence-census.test.ts`: the DST-fallback census test derives its instants from the next New York fallback after `now()`, checks their local text offsets, and runs at the real clock plus two pinned clocks (2026-11-01T05:30Z and 2027-11-07T05:30Z). With the old fixed instants, all three fail.
+
## [0.60.534.0] - 2026-11-01
**Merge train S: five sync, refresh and maintenance fixes land in one release.** Page writes create a missing source folder and name a missing checkout (#8106). A diverged managed checkout can publish itself on opt-in, and every refresh fetch is logged (#8102). Sync-lane wave 2 repairs quoted fence markers, releases agreeing file-drift holds, syncs plain directories and retires former-binding effects (#8077). The `synthesize` phase survives a local writer replace (#8111). A door commit during a refresh is waited out instead of failing the refresh as `refresh_dirty` (#8117).
diff --git a/test/fence-census.test.ts b/test/fence-census.test.ts
index 985d9dd98a..5da6af9e18 100644
--- a/test/fence-census.test.ts
+++ b/test/fence-census.test.ts
@@ -18,7 +18,7 @@
* test/e2e/fence-census-postgres.test.ts (a second session holds a real open
* transaction). Synthetic content only.
*/
-import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
+import { afterAll, beforeAll, describe, expect, setSystemTime, test } from 'bun:test';
import { execFileSync } from 'node:child_process';
import { randomUUID } from 'node:crypto';
import { mkdirSync, mkdtempSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';
@@ -183,23 +183,36 @@ for (const backend of backends) {
if (backend === 'pglite') {
// GBRA-75 wave 10: the pass orders by the timestamp its keyset compares, not the text it returns, so small
- // batches never skip a page, even in a session time zone whose text offsets change (a DST fallback hour).
- test('the incremental pass in batches of one reads every page across a DST fallback in the session time zone', async () => {
- const s = await source(null);
- const slugs = ['notes/dst-a', 'notes/dst-b', 'notes/dst-c', 'notes/dst-d'];
- for (const slug of slugs) await s.stored(slug, CLEAN);
- await s.census();
- const [{ zone }] = await engine.executeRaw<{ zone: string }>(`SELECT current_setting('TimeZone') AS zone`);
+ // batches never skip a page, even in a session time zone whose text offsets change (a DST fallback hour). It also
+ // runs with the clock pinned inside the 2026 and 2027 fallback hours, where fixed instants fell behind the watermark.
+ for (const clock of [null, '2026-11-01T05:30:00Z', '2027-11-07T05:30:00Z']) test(`the incremental pass in batches of one reads every page across a DST fallback in the session time zone${clock ? ` (clock pinned at ${clock})` : ''}`, async () => {
+ if (clock) setSystemTime(new Date(clock));
try {
- await engine.executeRaw(`SELECT set_config('TimeZone', 'America/New_York', false)`);
- // 01:20-04, 01:40-04, then 01:10-05 and 01:30-05: their text sorts differently from their instants.
- for (const [i, at] of ['2026-11-01T05:20:00Z', '2026-11-01T05:40:00Z', '2026-11-01T06:10:00Z', '2026-11-01T06:30:00Z'].entries()) {
- await engine.executeRaw('UPDATE pages SET compiled_truth=$1, updated_at=$2::timestamptz WHERE source_id=$3 AND slug=$4', [DETERMINISTIC, at, s.id, slugs[i]]);
+ const s = await source(null);
+ const slugs = ['notes/dst-a', 'notes/dst-b', 'notes/dst-c', 'notes/dst-d'];
+ for (const slug of slugs) await s.stored(slug, CLEAN);
+ await s.census();
+ const [{ zone }] = await engine.executeRaw<{ zone: string }>(`SELECT current_setting('TimeZone') AS zone`);
+ try {
+ await engine.executeRaw(`SELECT set_config('TimeZone', 'America/New_York', false)`);
+ // The next fallback (first Sunday of November) still ahead of the database clock, so every instant is past the
+ // pass watermark: 01:20-04, 01:40-04, then 01:10-05 and 01:30-05, whose text sorts differently from their instants.
+ const [{ ms }] = await engine.executeRaw<{ ms: number }>(`SELECT (extract(epoch FROM now()) * 1000)::float8 AS ms`);
+ let first = 0;
+ for (let year = new Date(Number(ms)).getUTCFullYear(); first <= Number(ms); year++) first = Date.UTC(year, 10, 1 + (7 - new Date(Date.UTC(year, 10, 1)).getUTCDay()) % 7, 5, 20);
+ const instants = [0, 20, 50, 70].map(m => new Date(first + m * 60_000).toISOString());
+ const local = await engine.executeRaw<{ at: string }>(`SELECT unnest($1::timestamptz[])::text AS at`, [instants]);
+ expect(local.map(r => r.at.slice(11))).toEqual(['01:20:00-04', '01:40:00-04', '01:10:00-05', '01:30:00-05']);
+ for (const [i, at] of instants.entries()) {
+ await engine.executeRaw('UPDATE pages SET compiled_truth=$1, updated_at=$2::timestamptz WHERE source_id=$3 AND slug=$4', [DETERMINISTIC, at, s.id, slugs[i]]);
+ }
+ await s.census({ batchSize: 1 });
+ expect(await s.keys()).toEqual(slugs);
+ } finally {
+ await engine.executeRaw(`SELECT set_config('TimeZone', $1, false)`, [zone]);
}
- await s.census({ batchSize: 1 });
- expect(await s.keys()).toEqual(slugs);
} finally {
- await engine.executeRaw(`SELECT set_config('TimeZone', $1, false)`, [zone]);
+ if (clock) setSystemTime();
}
}, 60_000);
}