Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(spec): re-quote the refresh-barrier mutants on the GST-1623 code and pin the held write's commit so hold-beside-held-off is caught again

garrytan6b8d5b05f89c
diff --git a/spec/tla/refresh-barrier/mutants.json b/spec/tla/refresh-barrier/mutants.json
index f8631b3921..466f8c487e 100644
--- a/spec/tla/refresh-barrier/mutants.json
+++ b/spec/tla/refresh-barrier/mutants.json
@@ -71,8 +71,8 @@
"edits": [
{
"file": "src/core/persistence/refresh-barrier.ts",
- "before": "if (paths === null || paths.has(target)) touched.push(target);",
- "after": "if (paths === null) touched.push(target);"
+ "before": "if (changes === null || changes.paths.has(changes.fold ? target.toLowerCase() : target)) touched.push(target);",
+ "after": "if (changes === null) touched.push(target);"
}
],
"tests": [
@@ -375,8 +375,8 @@
"edits": [
{
"file": "src/core/persistence/refresh-barrier.ts",
- "before": " await declarePersistenceProtocol(tx);\n const [held] = await tx.executeRaw(`SELECT 1 FROM persistence_requests r JOIN sources s ON s.id=r.source_id\n WHERE r.id=$1::uuid AND r.state='deferred' AND r.deferred_import_from=$2 AND COALESCE(s.last_commit,'')=r.deferred_import_from\n AND r.updated_at<now()-($3::double precision*interval '1 millisecond') FOR SHARE OF s`, [row.id, row.deferred_import_from, maxWaitMs]);\n",
- "after": " const [held] = await tx.executeRaw(`SELECT 1 FROM persistence_requests r JOIN sources s ON s.id=r.source_id\n WHERE r.id=$1::uuid AND r.state='deferred' AND r.deferred_import_from=$2 AND COALESCE(s.last_commit,'')=r.deferred_import_from\n AND r.updated_at<now()-($3::double precision*interval '1 millisecond') FOR SHARE OF s`, [row.id, row.deferred_import_from, maxWaitMs]);\n await declarePersistenceProtocol(tx);\n"
+ "before": " await declarePersistenceProtocol(tx);\n const [held] = await tx.executeRaw(`SELECT 1 FROM persistence_requests r JOIN sources s ON s.id=r.source_id\n WHERE r.id=$1::uuid AND r.state='deferred' AND r.deferred_import_from=$2 AND COALESCE(s.last_commit,'')=r.deferred_import_from\n AND ${holdOverdue('$3::double precision')} FOR SHARE OF s`, [row.id, row.deferred_import_from, maxWaitMs]);\n",
+ "after": " const [held] = await tx.executeRaw(`SELECT 1 FROM persistence_requests r JOIN sources s ON s.id=r.source_id\n WHERE r.id=$1::uuid AND r.state='deferred' AND r.deferred_import_from=$2 AND COALESCE(s.last_commit,'')=r.deferred_import_from\n AND ${holdOverdue('$3::double precision')} FOR SHARE OF s`, [row.id, row.deferred_import_from, maxWaitMs]);\n await declarePersistenceProtocol(tx);\n"
}
],
"tests": [
@@ -403,8 +403,8 @@
"edits": [
{
"file": "src/core/persistence/refresh-barrier.ts",
- "before": "interval '1 millisecond') FOR SHARE OF s`, [row.id, row.deferred_import_from, maxWaitMs]);",
- "after": "interval '1 millisecond')`, [row.id, row.deferred_import_from, maxWaitMs]);"
+ "before": "${holdOverdue('$3::double precision')} FOR SHARE OF s`, [row.id, row.deferred_import_from, maxWaitMs]);",
+ "after": "${holdOverdue('$3::double precision')}`, [row.id, row.deferred_import_from, maxWaitMs]);"
}
],
"tests": [
diff --git a/test/import-write-barrier.test.ts b/test/import-write-barrier.test.ts
index 068d6a8fd7..5f9e3a4c13 100644
--- a/test/import-write-barrier.test.ts
+++ b/test/import-write-barrier.test.ts
@@ -394,6 +394,7 @@ test('a write held for an import is never passed by a later write to the same pa
expect(await f.lastCommit(f.alpha)).not.toBe(before);
await settle(f, held);
if (second.pending) await settle(f, later);
+ expect((await requestRow(f, first.receipt.request_id)).state).toBe('committed');
// Writes to one page commit in admission order: the later write is the last to commit, so the earlier one never lands on top of it.
const versions = (await f.engine.executeRaw<{ body: string }>(
`SELECT compiled_truth AS body FROM (SELECT v.compiled_truth, v.id FROM page_versions v JOIN pages p ON p.id=v.page_id WHERE p.source_id=$1 AND p.slug=$2