Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(fences): update fixtures whose malformation Tier 1 now fixes; regenerate the export-surface golden (#6188)

garrytana3eb11eea13f
diff --git a/src/core/config.ts b/src/core/config.ts
index 6d89cef34b..df76fc1870 100644
--- a/src/core/config.ts
+++ b/src/core/config.ts
@@ -1670,9 +1670,7 @@ export const KNOWN_CONFIG_KEYS: readonly string[] = [
'sync.hold_escalate_count',
'sync.hold_escalate_pct',
'sync.parser_regression',
- // #6188: Tier 1 inline fence normalization on write paths (read by fence-repair/config.ts).
- // Default on; `false` refuses (coordinated writers) or stores as written (legacy importers).
- 'fences.normalize',
+ 'fences.normalize', // #6188: inline Tier 1 fence normalization (fence-repair/config.ts); default on
// #2179: clamp window for DCR-requested per-client token TTLs. Read by
// `gbrain serve --http` at startup; unset min defaults to 300s, unset max
// defaults fail-closed to max(--token-ttl, min).
diff --git a/test/persistence-semantic-pages.test.ts b/test/persistence-semantic-pages.test.ts
index f3695b3dba..1b763513cd 100644
--- a/test/persistence-semantic-pages.test.ts
+++ b/test/persistence-semantic-pages.test.ts
@@ -95,8 +95,11 @@ test('canonical replacement and revert restore facts, takes and timeline from co
expect(await engine.executeRaw('SELECT id FROM facts WHERE source_id=$1 AND source_markdown_slug=$2 AND expired_at IS NULL',[sourceId,'projections'])).toHaveLength(2);
expect(await engine.executeRaw('SELECT id FROM takes WHERE page_id=$1',[before.page.id])).toHaveLength(2);
expect(await engine.getTimeline('projections',{sourceId})).toHaveLength(1);
- const invalid=content.replace('Second fact','Conflicting fact').replace('| 2 | Conflicting fact','| 1 | Conflicting fact');
- await expect(submit('put_page',{slug:'projections',content:invalid,expected_revision:restored.revision})).rejects.toMatchObject({code:'invalid_params'});
+ // #6188: a fence Tier 1 cannot fix exactly (a visibility no synonym maps) still refuses typed and changes nothing;
+ // a duplicate row number, which Tier 1 renumbers, is covered in test/fence-write-verbs.test.ts.
+ const invalid=content.replace('Second fact','Conflicting fact').replace(/(\| 2 \| Conflicting fact \| fact \| [^|]+ \| )world( \|)/,'$1nonvisible$2');
+ expect(invalid).toContain('| nonvisible |');
+ await expect(submit('put_page',{slug:'projections',content:invalid,expected_revision:restored.revision})).rejects.toMatchObject({code:'invalid_params',canonicalCode:'invalid_fence'});
expect((await engine.readPageSnapshot('projections',{sourceId}))!.revision).toBe(restored.revision);
});
diff --git a/test/privacy-strip-and-forget.test.ts b/test/privacy-strip-and-forget.test.ts
index b56e4c4e66..a1693c982f 100644
--- a/test/privacy-strip-and-forget.test.ts
+++ b/test/privacy-strip-and-forget.test.ts
@@ -395,16 +395,18 @@ describe('#4548 row-level visibility-aware fence merge (remote write-back)', ()
);
await putPageOp().handler(makeCtx({ remote: false }), { slug, content: fence });
warnSpy.mockClear();
- // The caller mangles the visible row's kind — the incoming fence now
- // parses with warnings, so the merge refuses to rewrite it (it can't
- // re-render rows it couldn't parse without losing caller content).
- // The managed publication refuses malformed content and retains the hidden row.
- await expect(remoteRoundTrip(slug, (c) => c.replace('| fact |', '| banana |'))).rejects.toMatchObject({code:'invalid_params'});
+ // The caller mangles the visible row's visibility into a word no synonym
+ // maps (#6188: an invented kind is now normalized losslessly, see
+ // test/fence-write-verbs.test.ts E7), so the incoming fence stays
+ // malformed. The managed publication refuses it typed before the merge
+ // runs (nothing is written, so there is no gap to warn about) and the
+ // hidden row is retained.
+ await expect(remoteRoundTrip(slug, (c) => c.replace('| world |', '| banana |'))).rejects.toMatchObject({code:'invalid_params', reason:'enum_unmapped'});
const warnedGap = warnSpy.mock.calls.some(
(c) => String(c[0]).includes('#2044 gap') && String(c[0]).includes(slug),
);
- expect(warnedGap).toBe(true);
+ expect(warnedGap).toBe(false);
const raw = await engine.getPage(slug, { sourceId: 'default' });
expect((raw?.compiled_truth ?? '')).toContain('SECRET_MAL');
} finally {