Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(fix-wave-8): takes join the deferred ANN worklist (#5088 x #5885); conformance waits for the consumer's worktree lock

garrytand66826104664
diff --git a/test/e2e/migrate-embeddings-postgres.test.ts b/test/e2e/migrate-embeddings-postgres.test.ts
index bc59515017..6edce07e39 100644
--- a/test/e2e/migrate-embeddings-postgres.test.ts
+++ b/test/e2e/migrate-embeddings-postgres.test.ts
@@ -211,7 +211,7 @@ d('embedding migration (live Postgres + pgvector)', () => {
);
expect(idx.length).toBe(0);
expect(JSON.parse((await engine.getConfig(MIGRATION_STATE_KEY))!).deferred_ann_indexes.map((i: { name: string }) => i.name).sort())
- .toEqual(['idx_chunks_embedding', 'idx_facts_embedding_hnsw', 'idx_query_cache_embedding_hnsw']);
+ .toEqual(['idx_chunks_embedding', 'idx_facts_embedding_hnsw', 'idx_query_cache_embedding_hnsw', 'idx_takes_embedding_hnsw']);
// Re-embed through the real pipeline at the new width. NOTE: no
// resetGateway() here — it would clear the installed fake transport.
@@ -249,7 +249,7 @@ d('embedding migration (live Postgres + pgvector)', () => {
let pending = JSON.parse((await engine.getConfig(MIGRATION_STATE_KEY))!).deferred_ann_indexes;
const built = await buildDeferredAnnIndexes(engine, { targetDims, readPending: async () => pending, writePending: async next => { pending = next; }, log: () => {} });
- expect(built.built.sort()).toEqual(['idx_chunks_embedding', 'idx_facts_embedding_hnsw', 'idx_query_cache_embedding_hnsw']);
+ expect(built.built.sort()).toEqual(['idx_chunks_embedding', 'idx_facts_embedding_hnsw', 'idx_query_cache_embedding_hnsw', 'idx_takes_embedding_hnsw']);
for (const name of built.built) expect(await annIndexValidity(engine, name)).toBe(true);
await completeEmbeddingMigration(engine, plan);
diff --git a/test/fixtures/write-contract-conformance-cases.ts b/test/fixtures/write-contract-conformance-cases.ts
index 9ddfbb356a..334c5523d3 100644
--- a/test/fixtures/write-contract-conformance-cases.ts
+++ b/test/fixtures/write-contract-conformance-cases.ts
@@ -108,7 +108,9 @@ async function withFixture(databaseUrl: string | undefined, run: (fixture: Fixtu
async function hold(engine: BrainEngine) {
const binding = await getWorktreeBinding(engine, 'default');
- const lock = await acquireWorktree(binding!);
+ // The consumer can still hold the worktree lock for a moment after the
+ // previous write settled (post-publication effects), so wait for it.
+ const lock = await acquireWorktree(binding!, 15_000);
if (!lock) throw new Error('worktree lock unavailable');
return lock;
}
diff --git a/test/migrate-embeddings-ann-deferred-5088.serial.test.ts b/test/migrate-embeddings-ann-deferred-5088.serial.test.ts
index 2dcc3477f6..d51d580572 100644
--- a/test/migrate-embeddings-ann-deferred-5088.serial.test.ts
+++ b/test/migrate-embeddings-ann-deferred-5088.serial.test.ts
@@ -49,7 +49,7 @@ async function chunkIndexes(): Promise<Array<{ name: string; def: string }>> {
return engine.executeRaw(`SELECT indexname AS name, indexdef AS def FROM pg_indexes WHERE tablename = 'content_chunks' ORDER BY indexname`);
}
const annNames = async () => (await chunkIndexes()).filter(i => /USING hnsw \(embedding /.test(i.def)).map(i => i.name);
-const PINNED_ANN = ['idx_facts_embedding_hnsw', 'idx_query_cache_embedding_hnsw'];
+const PINNED_ANN = ['idx_facts_embedding_hnsw', 'idx_query_cache_embedding_hnsw', 'idx_takes_embedding_hnsw'];
const pinnedAnnNames = async () => (await engine.executeRaw<{ name: string }>(
"SELECT indexname AS name FROM pg_indexes WHERE indexname = ANY($1::text[]) ORDER BY indexname", [PINNED_ANN])).map(r => r.name);
const marker = async () => JSON.parse((await engine.getConfig(MIGRATION_STATE_KEY)) ?? 'null');