Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(doctor-goldens): label the segmented writer floor instead of scrubbing it as VERSION

garrytancbffd932cb07
diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.json
index 6a41da36b7..65a2ef6573 100644
--- a/test/fixtures/goldens/doctor/content-pglite-json.json
+++ b/test/fixtures/goldens/doctor/content-pglite-json.json
@@ -1528,7 +1528,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
index 40ccb29254..62f50062d5 100644
--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
@@ -1696,7 +1696,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
@@ -5967,7 +5967,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
index e7a1463adf..cd3abfe4f9 100644
--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
@@ -1688,7 +1688,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
@@ -5960,7 +5960,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index ce9512661d..2674b689cf 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -1416,7 +1416,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 439247d48d..4d6465da83 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -1472,7 +1472,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index 5d276fa2f3..ffe932b93d 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -1464,7 +1464,7 @@
"configured": "unset",
"docs": "docs/guides/memory-boundaries.md#segmented-page-storage",
"effective": "off",
- "floor": "0.60.290.0",
+ "floor": "<segmented-writer-floor>",
"max_bytes": 25165824,
"truncated": false,
"window_days": 7
diff --git a/test/helpers/doctor-json-golden.ts b/test/helpers/doctor-json-golden.ts
index 6b22e7a643..2dfe3b5713 100644
--- a/test/helpers/doctor-json-golden.ts
+++ b/test/helpers/doctor-json-golden.ts
@@ -27,6 +27,7 @@ import { delimiter, join } from 'node:path';
import { defineNormalizer, mapStrings, scrubKeys, scrubPaths, scrubTimestamps } from './golden.ts';
import { PROVIDER_ENV_KEYS } from './provider-env.ts';
import { MIGRATIONS } from '../../src/core/schema-migrations/registry.generated.ts';
+import { SEGMENTED_WRITER_FLOOR } from '../../src/core/persistence/writer-versions.ts';
const REPO_ROOT = join(import.meta.dir, '..', '..');
const CLI = join(REPO_ROOT, 'src', 'cli.ts');
@@ -180,13 +181,25 @@ export function expectSchemaLatestMatchesRegistry(run: GbrainRun): void {
}
/** `doctor-json-v1` with optional extra literal/regex replacements (e.g. a Postgres URL). */
+/**
+ * The segmented writer floor equals VERSION in the release that stamps it, so the
+ * version scrub would turn it into `<version>` there and back into a literal one
+ * release later; a stable label keeps the doctor goldens independent of VERSION.
+ */
+function maskWriterFloor(value: unknown): unknown {
+ if (Array.isArray(value)) return value.map(maskWriterFloor);
+ if (!value || typeof value !== 'object') return value;
+ return Object.fromEntries(Object.entries(value as Record<string, unknown>).map(([k, v]) =>
+ [k, k === 'floor' && v === SEGMENTED_WRITER_FLOOR ? '<segmented-writer-floor>' : maskWriterFloor(v)]));
+}
+
export function doctorJsonNormalizer(extra: Array<[RegExp | string, string]> = [], name = 'doctor-json-v1') {
return defineNormalizer<GbrainRun>(name, (run) => {
const fn = (s: string) => normalizeDoctorText(s, run.roots, extra);
return {
args: run.args.map(fn),
exit_code: run.exitCode,
- report: run.json === null ? null : mapStrings(scrubKeys(run.json, VOLATILE_KEYS), fn),
+ report: run.json === null ? null : mapStrings(maskWriterFloor(scrubKeys(run.json, VOLATILE_KEYS)), fn),
stdout: run.json === null ? fn(run.stdout).split('\n').filter(Boolean) : '<json>',
stderr: fn(run.stderr).split('\n').filter(Boolean),
};