Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(goldens): doctor hot-check goldens normalize capture-day buckets (master went red at UTC midnight)

time-attack841c258980be
diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
index 2b4c71aa97..ecafdd5900 100644
--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
@@ -2410,7 +2410,7 @@
"by_day": [
{
"count": 1,
- "day": "2026-10-10"
+ "day": "<today>"
}
],
"normalized_7d": 1,
@@ -5433,7 +5433,7 @@
"by_day": [
{
"count": 1,
- "day": "2026-10-10"
+ "day": "<today>"
}
],
"normalized_7d": 1,
diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
index c699888c06..60af99c154 100644
--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
@@ -2401,7 +2401,7 @@
"by_day": [
{
"count": 1,
- "day": "2026-10-10"
+ "day": "<today>"
}
],
"normalized_7d": 1,
@@ -5413,7 +5413,7 @@
"by_day": [
{
"count": 1,
- "day": "2026-10-10"
+ "day": "<today>"
}
],
"normalized_7d": 1,
diff --git a/test/helpers/doctor-json-golden.ts b/test/helpers/doctor-json-golden.ts
index af71b375df..a19d0f38e8 100644
--- a/test/helpers/doctor-json-golden.ts
+++ b/test/helpers/doctor-json-golden.ts
@@ -143,6 +143,8 @@ export function normalizeDoctorText(text: string, roots: Record<string, string>,
let out = scrubPaths(text, roots);
for (const [pattern, label] of extra) out = typeof pattern === 'string' ? out.split(pattern).join(label) : out.replace(pattern, label);
out = scrubTimestamps(out).replace(UUID, '<uuid>');
+ // Bare UTC day buckets (`by_day[].day`) of events the fixture records at capture time.
+ for (const [ago, label] of [[0, '<today>'], [1, '<yesterday>']] as const) out = out.split(new Date(Date.now() - ago * 86_400_000).toISOString().slice(0, 10)).join(label);
out = out.replace(/\(most recent caller: at [^()]*\([^()]*\)\)/g, '(most recent caller: <frame>)');
out = out.split(PACKAGE_VERSION).join('<version>');
out = out.replace(SCHEMA_LATEST, (match, prefix: string, n: string) => (Number(n) === REGISTRY_LATEST ? `${prefix}<latest>` : match));