Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(sync): #6729 the managed identity read keeps its SQL text and joins fm_id on (revert the probe edit); the 6729 Postgres arm runs in the Postgres unit lane
garrytan340966aedaa4
diff --git a/.wave18-fragments/lane2-s1.md b/.wave18-fragments/lane2-s1.mdindex 7b8443fa5a..8655c24140 100644--- a/.wave18-fragments/lane2-s1.md+++ b/.wave18-fragments/lane2-s1.md@@ -37,7 +37,6 @@ The remedy repair kind is not in S1: it lands in its own commit after the S1 SHA- [S1] `test/sync.test.ts` (3) and `test/sync-git-paths.test.ts` (3 platform cases): `buildSyncManifest` rename entries now carry Git's `similarity`.- [S1] Held-rename hold-lane tests whose fixture was an inexact move onto a broken file now use an exact move (R100) held by a stale `slug:` line; every hold-lane assertion is unchanged: `test/persistence-sync-holds.test.ts` (2), `test/repair-frontmatter.test.ts` (2), `test/hold-action-chain-6712.test.ts` (1), `test/sync-legacy-holds.test.ts` (3), `test/write-attribution-sync.test.ts` (1). The inexact-onto-broken fixture keeps a test per path asserting its new outcome.- [S1] `test/large-pages/managed-sync-segmented-rename.test.ts`: the fixture carries a frontmatter `id`, so the edited rename whose title follows the slug is still confirmed.-- [S1] `test/persistence-managed-sync.test.ts` ("repeated slices reuse one manifest..."): its manifest-read probe matches the identity read by its SQL text, which now also selects `frontmatter->>'id' AS fm_id` for the explicit-id veto; the probe string follows the query, the count assertions are unchanged.## #6741 (sub-lane: parts A, B, C)diff --git a/src/core/persistence/sync-discovery.ts b/src/core/persistence/sync-discovery.tsindex b2bd66c45a..6e37723aa3 100644--- a/src/core/persistence/sync-discovery.ts+++ b/src/core/persistence/sync-discovery.ts@@ -459,7 +459,7 @@ export async function discoverManagedSync(engine: BrainEngine, opts: SyncOpts, c// Freeze all logical identities in one database statement, before yielding// between pages. A later interactive edit must conflict with this scan.const identities = await engine.executeRaw<{ id: number; slug: string; source_path: string | null; knowledge_revision: string; deleted_at: Date | string | null; fm_id: string | null }>(- "SELECT id,slug,source_path,knowledge_revision,deleted_at,frontmatter->>'id' AS fm_id FROM pages WHERE source_id=$1", [sourceId]);+ "SELECT q.*,f.frontmatter->>'id' AS fm_id FROM (SELECT id,slug,source_path,knowledge_revision,deleted_at FROM pages WHERE source_id=$1) q JOIN pages f ON f.id=q.id", [sourceId]);const bySlug = new Map(identities.map(p => [p.slug, p]));const byPath = new Map<string, typeof identities>();const storableIdentities = identities.filter(storable);diff --git a/test/persistence-managed-sync.test.ts b/test/persistence-managed-sync.test.tsindex 9a135aac99..0a46bd0c71 100644--- a/test/persistence-managed-sync.test.ts+++ b/test/persistence-managed-sync.test.ts@@ -255,7 +255,7 @@ test('repeated slices reuse one manifest and hold an intervening page identity cconst executeRaw = engine.executeRaw;let manifestReads = 0;engine.executeRaw = async function (this: BrainEngine, sql: string, params?: unknown[]) {- if (params?.[0] === f.id && sql.includes("SELECT id,slug,source_path,knowledge_revision,deleted_at,frontmatter->>'id' AS fm_id FROM pages")) manifestReads++;+ if (params?.[0] === f.id && sql.includes('SELECT id,slug,source_path,knowledge_revision,deleted_at FROM pages')) manifestReads++;return executeRaw.call(this, sql, params);} as BrainEngine['executeRaw'];try {diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txtindex d58b06db4a..c6da097220 100644--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@ -199,6 +199,7 @@ test/sync-full-untracked-import-5459.test.tstest/sync-group-member-order.test.tstest/sync-handler-drain-6706.test.tstest/sync-import-provenance-disk.test.ts+test/sync-inexact-rename-6729.test.tstest/sync-legacy-holds.test.tstest/sync-legacy-retry-actions-6696.test.tstest/sync-origin-live-wins-6517.test.ts