Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(takes): scope the selection-race stub to the extraction's own read

garrytanf4f05f789f67
diff --git a/test/persistence-managed-takes-extract.test.ts b/test/persistence-managed-takes-extract.test.ts
index 88a1b58676..370f0fcc70 100644
--- a/test/persistence-managed-takes-extract.test.ts
+++ b/test/persistence-managed-takes-extract.test.ts
@@ -126,7 +126,8 @@ test(`${backend}: managed extraction classifies the pinned snapshot after a sele
const originalReadPageSnapshot = engine.readPageSnapshot.bind(engine);
let editedAfterSelection = false;
(engine as any).readPageSnapshot = async (selectedSlug: string, options?: { sourceId?: string }) => {
- if (!editedAfterSelection && selectedSlug === slug) {
+ // Only the extraction's own read races: the projection rebuild the first write queued reads this page too.
+ if (!editedAfterSelection && selectedSlug === slug && new Error().stack?.includes('extract-takes-from-pages')) {
editedAfterSelection = true;
(engine as any).readPageSnapshot = originalReadPageSnapshot;
await engine.transaction(tx => withCoordinatedWrite(tx, ['default'], async () => {