Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(#6712 PR 4b): the level-read fault seams match the Postgres cursor declared over the level read
garrytan09aa5dbeeca8
diff --git a/test/persistence-sync-failures.serial.test.ts b/test/persistence-sync-failures.serial.test.tsindex 6fcf0c98c0..bf8ce7130d 100644--- a/test/persistence-sync-failures.serial.test.ts+++ b/test/persistence-sync-failures.serial.test.ts@@ -290,8 +290,8 @@ test('managed failure retry hints name the failed cursor options locally, shell-const d = await fixture(engine, { 'note.md': 'A stable discovery observation.\n' });const execute = engine.executeRaw;engine.executeRaw = function (this: BrainEngine, sql: string, params?: unknown[]) {- // #6712 PR 4b: the pass's level read stands where the cursor's discovery read stood.- if (sql.includes('FROM pages p LEFT JOIN op_checkpoints c') && params?.[0] === d.id) throw new OperationError('storage_error', 'Synthetic discovery failure');+ // #6712 PR 4b: the pass's level read (a Postgres cursor declared over it, or PGLite keyset pages) stands where the cursor's discovery read stood.+ if (sql.includes('SELECT p.id, p.slug, p.source_path, p.knowledge_revision::text AS revision') && params?.[0] === d.id) throw new OperationError('storage_error', 'Synthetic discovery failure');return execute.call(this, sql, params);} as BrainEngine['executeRaw'];let thrown: Error | undefined;@@ -326,7 +326,7 @@ test('a pass that fails reading its level or freezing a changed page stays diagnconst d = await fixture(engine, { 'note.md': 'A stable level observation.\n' });const execute = engine.executeRaw;engine.executeRaw = function (this: BrainEngine, sql: string, params?: unknown[]) {- if (sql.includes('FROM pages p LEFT JOIN op_checkpoints c') && params?.[0] === d.id) throw new OperationError('storage_error', 'Synthetic level read failure');+ if (sql.includes('SELECT p.id, p.slug, p.source_path, p.knowledge_revision::text AS revision') && params?.[0] === d.id) throw new OperationError('storage_error', 'Synthetic level read failure');return execute.call(this, sql, params);} as BrainEngine['executeRaw'];try {diff --git a/test/persistence-sync-options.serial.test.ts b/test/persistence-sync-options.serial.test.tsindex df4e7ce20d..d7c33c1e2f 100644--- a/test/persistence-sync-options.serial.test.ts+++ b/test/persistence-sync-options.serial.test.ts@@ -616,7 +616,7 @@ type SyncBarrier = 'pass-pin-commit' | 'pass-classify' | 'foreground' | 'freeze'const isLeaseCheck = (sql: string) => sql.startsWith('SELECT 1 FROM gbrain_cycle_locks WHERE id=$1 AND acquisition_token=$2::uuid');function matchesSyncBarrier(boundary: SyncBarrier, sql: string, params: unknown[] | undefined, transactional: boolean): boolean {if (boundary === 'pass-pin-commit') return transactional && sql.startsWith('INSERT INTO op_checkpoints(op,fingerprint,completed_keys,updated_at)') && params?.[0] === 'managed-sync-pass' && params?.[3] === true;- if (boundary === 'pass-classify') return sql.startsWith('SELECT p.id, p.slug, p.source_path, p.knowledge_revision::text AS revision');+ if (boundary === 'pass-classify') return sql.replace(/^DECLARE sync_pass_pages NO SCROLL CURSOR FOR /, '').startsWith('SELECT p.id, p.slug, p.source_path, p.knowledge_revision::text AS revision');if (boundary === 'foreground') return sql.includes("NOT(COALESCE(intent->>'kind','') LIKE 'managed_sync_%') LIMIT 1");if (boundary === 'freeze') return sql.startsWith('SELECT id,slug,source_path,deleted_at FROM pages WHERE source_id=') && !transactional;if (boundary === 'request-lookup') return sql.startsWith('SELECT') && sql.includes('FROM persistence_requests') && sql.includes('request_id=') && !transactional;