Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test/registry: classify edit_page and map the conformance E2E; rebaseline pinned contracts

garrytancce00df23c64
diff --git a/docs/architecture/managed-mutating-writers.tsv b/docs/architecture/managed-mutating-writers.tsv
index 633dbdaa52..e26b989549 100644
--- a/docs/architecture/managed-mutating-writers.tsv
+++ b/docs/architecture/managed-mutating-writers.tsv
@@ -17,6 +17,7 @@ op add_link coordinator coordinatedManualLinkWrite: durable authority, withCoord
op remove_link coordinator coordinatedManualLinkWrite, same boundary as add_link.
op add_timeline_entry coordinator submitPageMutation admits a journaled page mutation.
op revert_version coordinator submitPageMutation admits a journaled page mutation.
+op edit_page coordinator submitPageMutation admits a journaled page mutation; edits apply to the locked snapshot.
op put_skill coordinator Shared-skill publication through the persistence journal.
op delete_skill coordinator Shared-skill publication through the persistence journal.
op set_skill_policy no_canonical_write Shared-skill policy row, epoch-guarded; no page content.
diff --git a/scripts/e2e-test-map.ts b/scripts/e2e-test-map.ts
index 7d376a30e5..03374e3620 100644
--- a/scripts/e2e-test-map.ts
+++ b/scripts/e2e-test-map.ts
@@ -244,6 +244,10 @@ export const E2E_TEST_MAP: Record<string, string[]> = {
// postgres.js bind paths + JSONB shapes + parity vs PGLite.
"src/core/db-lock.ts": ["test/e2e/db-lock-acquisition-token.test.ts", "test/e2e/sync-lock-overlap-postgres.test.ts", "test/e2e/managed-connector-fencing.test.ts", "test/e2e/managed-connector-recovery.test.ts"],
"src/core/lease-schema.ts": ["test/e2e/db-lock-acquisition-token.test.ts"],
+ // O-CEO-13 wave-8 write contract gate: receipts, replay, edit_page, publication reauthorization.
+ "src/core/persistence/page-edit.ts": ["test/e2e/write-contract-conformance.test.ts"],
+ "src/core/persistence/write-wait.ts": ["test/e2e/write-contract-conformance.test.ts"],
+ "src/core/ops/page-edit.ts": ["test/e2e/write-contract-conformance.test.ts"],
"src/core/persistence/**": [
"test/e2e/fix-wave-3-integration.test.ts",
"test/e2e/persistence-http-liveness.test.ts",
@@ -444,7 +448,7 @@ export const E2E_TEST_MAP: Record<string, string[]> = {
"src/core/persistence/memory-mutations.ts": ["test/e2e/withdrawal-followup-writes-postgres.test.ts"],
"src/core/persistence/coordinator.ts": ["test/e2e/withdrawal-followup-writes-postgres.test.ts"],
"src/core/facts/meta-hook.ts": ["test/e2e/hot-memory-invalidation-postgres.test.ts", "test/e2e/facts-context-injection-postgres.test.ts", "test/e2e/serve-http-meta.test.ts"],
- "src/mcp/dispatch.ts": ["test/e2e/hot-memory-invalidation-postgres.test.ts"],
+ "src/mcp/dispatch.ts": ["test/e2e/hot-memory-invalidation-postgres.test.ts", "test/e2e/write-contract-conformance.test.ts"],
// Schema source of truth: any change must pass the cross-engine drift gate.
"src/schema.sql": ["test/e2e/schema-drift.test.ts", "test/e2e/schema-catalog-golden.test.ts"],
"src/core/pglite-schema.ts": ["test/e2e/schema-drift.test.ts", "test/e2e/schema-catalog-golden.test.ts"],
diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.json
index 2bafcead62..59d4b4fc6f 100644
--- a/test/fixtures/goldens/exports/types.json
+++ b/test/fixtures/goldens/exports/types.json
@@ -2451,6 +2451,7 @@
"memory?: { auto_writeback?: string; auto_writeback_transient_ttl?: string; visibility_posture?: string; } | undefined",
"openai_api_key?: string | undefined",
"openrouter_api_key?: string | undefined",
+ "persistence?: { write_wait_ms?: number | string; } | undefined",
"protocol_installed_at?: string | undefined",
"provider_base_urls?: Record<string, string> | undefined",
"provider_chat_options?: Record<string, Record<string, unknown>> | undefined",
@@ -5392,7 +5393,8 @@
"surfaceCeiling?: \"verbs\" | \"starter\" | \"full\" | undefined",
"takesHoldersAllowList?: string[] | undefined",
"transport?: \"stdio\" | \"http\" | undefined",
- "viaSubagent?: boolean | undefined"
+ "viaSubagent?: boolean | undefined",
+ "writeWaitMs?: number | undefined"
],
"name": "OperationContext"
},
@@ -5430,6 +5432,7 @@
"description?: string | undefined",
"enum?: string[] | undefined",
"items?: ParamDef | undefined",
+ "properties?: Record<string, ParamDef> | undefined",
"required?: boolean | undefined",
"type: \"string\" | \"number\" | \"boolean\" | \"object\" | \"array\""
],
diff --git a/test/reconcile-owner-journey.serial.test.ts b/test/reconcile-owner-journey.serial.test.ts
index 897746a6ad..895f8fd5b4 100644
--- a/test/reconcile-owner-journey.serial.test.ts
+++ b/test/reconcile-owner-journey.serial.test.ts
@@ -1,4 +1,5 @@
import { expect, test } from 'bun:test';
+import { PENDING_WRITE_EXIT_CODE } from '../src/core/exit-codes.ts';
import { randomUUID } from 'node:crypto';
import { mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
@@ -190,7 +191,7 @@ for (const transport of ['stdio', 'http'] as const) {
held.lock = await acquireNativeLock(binding.coordination_path!, { timeoutMs: 1000 });
expect(held.lock).not.toBeNull();
const pending = await reconcile(applyArgs);
- expect(pending.exitCode).toBe(1);
+ expect(pending.exitCode).toBe(PENDING_WRITE_EXIT_CODE); // #5232: admitted, still pending
expect(JSON.parse(pending.stdout)).toMatchObject({ error: 'write_pending', write_request: { request_id: reconcileId } });
expect(JSON.parse(pending.stdout).write_request.state).not.toBe('committed');
privateSummary(pending);
@@ -199,7 +200,7 @@ for (const transport of ['stdio', 'http'] as const) {
expect(pendingReceipt.request_id).toBe(reconcileId);
expect(pendingReceipt.state).not.toBe('committed');
const pendingReplay = await reconcile(applyArgs);
- expect(pendingReplay.exitCode).toBe(1);
+ expect(pendingReplay.exitCode).toBe(PENDING_WRITE_EXIT_CODE);
expect(JSON.parse(pendingReplay.stdout)).toMatchObject({ error: 'write_pending', write_request: {
request_id: reconcileId, created_at: pendingReceipt.created_at,
} });
diff --git a/test/remote-privacy-sweep.test.ts b/test/remote-privacy-sweep.test.ts
index 06ddf5a27a..fc8406a602 100644
--- a/test/remote-privacy-sweep.test.ts
+++ b/test/remote-privacy-sweep.test.ts
@@ -191,6 +191,8 @@ const PARAM_FACTORY: Record<string, Record<string, unknown>> = {
// put_page-into-fence-bearing-page restoration-echo class is explicitly
// NOT covered here (write-side sweep TODO).
put_page: { slug: 'notes/sweep-fresh-write', content: '# Fresh write\n\nNew content.\n' },
+ // A stale revision on the fence-bearing page: the refusal must not echo it.
+ edit_page: { slug: WORLD_FENCE_SLUG, expected_revision: '00000000-0000-4000-8000-000000000000', edits: [{ old_text: 'x', new_text: 'y' }] },
remember: { fact: 'fresh sweep fact', provenance: 'sweep', entity: 'people/sweep-fresh-entity' },
capture: { content: 'fresh sweep capture' },
add_tag: { slug: WORLD_PAGE_SLUG, tag: 'sweep-tag' },
@@ -208,7 +210,7 @@ const PARAM_FACTORY: Record<string, Record<string, unknown>> = {
// carries ctx.auth; the scalar shape — like the stdio transport — doesn't).
// These operations enforce durable write authority inside the shared dispatcher.
// Other scope checks remain transport-owned and outside this privacy harness.
-const COORDINATED_WRITES = new Set(['put_page', 'capture', 'delete_page', 'restore_page', 'revert_version',
+const COORDINATED_WRITES = new Set(['put_page', 'capture', 'delete_page', 'restore_page', 'revert_version', 'edit_page',
'remember', 'forget', 'add_tag', 'remove_tag', 'add_timeline_entry',
'takes_add', 'takes_update', 'takes_supersede', 'takes_resolve',
'get_write_request', 'list_write_requests', 'cancel_write_request']);
@@ -343,6 +345,7 @@ const EXPECTED_OUTCOME: Record<string, Outcome> = {
list_write_requests: 'ok',
cancel_write_request: 'error',
revert_version: 'error',
+ edit_page: 'error',
put_raw_data: 'error',
log_ingest: 'error',
takes_add: 'ok',