Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Record the new doctor check, delete_page wording and purge writer in the goldens and the write inventory

garrytan7c8561f4fd1d
diff --git a/docs/architecture/system-of-record.md b/docs/architecture/system-of-record.md
index ada2084699..3670ab6d89 100644
--- a/docs/architecture/system-of-record.md
+++ b/docs/architecture/system-of-record.md
@@ -301,6 +301,7 @@ or a physical projection that leaves attribution untouched):
- `src/core/persistence/memory-prepare.ts` (2): `remember` request preparer; the fence row and its facts row go through `prepareFenceFactAppend`.
- `src/core/persistence/page-append.ts` (1): segmented `append_page` / `edit_page` request preparer; the splice versions the page inside its request's publication.
- `src/core/persistence/page-prepare.ts` (12): page request preparer (including the restore of a segmented page over 24 MiB, which flips `deleted_at` without re-serializing, and the tag flip of a segmented page, which versions it and changes its tag rows and `content_hash` without re-serializing).
+- `src/core/persistence/page-purge.ts` (2): the purge's in-transaction recheck (GST-2689) versions and soft-deletes a live page whose derived page was written mid-purge; it runs inside the `delete_page` request's coordinated publication (`page-prepare.ts` apply) and carries that request.
- `src/core/persistence/prepared-maintenance.ts` (5): managed maintenance request preparer (consolidation closes an unfenced fact in the database and a fenced one from its published fence cell; a held move clears the row number of the struck held rows it removes from their holding page).
- `src/core/persistence/semantic-pages.ts` (1): `add_timeline_entry` request preparer.
- `src/core/persistence/sync-image.ts` (2): managed sync image request preparer; a Git rename retires the old page inside the same publication.
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index 72dde17bf0..9084baf67a 100644
--- a/test/fixtures/goldens/cli/tools-json.json
+++ b/test/fixtures/goldens/cli/tools-json.json
@@ -2,8 +2,8 @@
"golden": {
"exitCode": 0,
"stderr": "",
- "stdoutBytes": 293886,
- "stdoutSha256": "4286c19216ec6ebea6cf2e333a5ebf142d749009f48899190adf8a147b450bf3",
+ "stdoutBytes": 294110,
+ "stdoutSha256": "0e1ee227a4d2411801ab5f280e45f2e67f075799f2935e3251fafd8972396573",
"toolNames": [
"remember",
"entity",
@@ -746,7 +746,7 @@
"scope": "write"
},
{
- "description": "Soft-delete a page and remove its markdown file from the source working tree (the source local_path, or sync.repo_path when the source has none). File removal is skipped when sync.write_through is off; the committed receipt reports the persistence mode and write_through outcome. Read the page revision first and pass expected_revision; retain request_id for replay. The row is hidden from search and from get_page/list_pages, but is recoverable via restore_page within 72h, which re-creates the file. The autopilot purge phase hard-deletes after the recovery window. Pass include_deleted: true to get_page to verify the soft-delete landed. A page whose file another live page of the source records is hidden without touching that file (receipt write_through.skipped: shared_origin): the file and the surviving page remain, nothing is erased, and the warning names gbrain repair file-drift --prefer file, which imports the file's current content into the surviving page (sync holds that page file_drift rather than overwrite it). purge: true is trusted-local CLI only and removes the row, chunks, links and raw data immediately after its recorded markdown artifact is removed. Purge uses the same revision, request_id and recovery protocol, including for existing tombstones. A removal failure preserves the prior row and never reports purge success; repair the artifact and submit a new request_id. A purge of a page whose file is shared refuses and names the soft delete. A committed purge warns that git history, synced copies, exports and derived rows may retain content; rotate exposed credentials.",
+ "description": "Soft-delete a page and remove its markdown file from the source working tree (the source local_path, or sync.repo_path when the source has none). File removal is skipped when sync.write_through is off; the committed receipt reports the persistence mode and write_through outcome. Read the page revision first and pass expected_revision; retain request_id for replay. The row is hidden from search and from get_page/list_pages, but is recoverable via restore_page within 72h, which re-creates the file. The autopilot purge phase hard-deletes after the recovery window. Pass include_deleted: true to get_page to verify the soft-delete landed. A page whose file another live page of the source records is hidden without touching that file (receipt write_through.skipped: shared_origin): the file and the surviving page remain, nothing is erased, and the warning names gbrain repair file-drift --prefer file, which imports the file's current content into the surviving page (sync holds that page file_drift rather than overwrite it). purge: true is trusted-local CLI only and removes the row, chunks, links and raw data immediately after its recorded markdown artifact is removed. Purge uses the same revision, request_id and recovery protocol, including for existing tombstones. A removal failure preserves the prior row and never reports purge success; repair the artifact and submit a new request_id. A purge of a page whose file is shared refuses and names the soft delete. A committed purge warns that git history, synced copies, exports and derived rows may retain content; rotate exposed credentials. Before the row is removed, pages that are private only through this page get their own visibility: private; a purge that cannot label them soft-deletes the page instead and returns purge_held (doctor derived_origin_parked).",
"idempotent": true,
"local_only": false,
"mutating": true,
diff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.json
index 50f194a67a..fa2d873fb5 100644
--- a/test/fixtures/goldens/doctor/content-pglite-human.json
+++ b/test/fixtures/goldens/doctor/content-pglite-human.json
@@ -264,6 +264,7 @@
" [OK] slug_path_mismatch: Every live page's slug is the one its recorded file path derives (0 candidate(s) inspected).",
" [OK] rename_identity_downgrades: No rename that lost its page identity is waiting for a disposition.",
" [OK] purge_parked_pages: No soft-deleted page is parked by the managed purge.",
+ " [OK] derived_origin_parked: No soft-deleted page is kept from the purge to keep a page derived from it private.",
" [OK] derivation_purge_sweeps: No fact purge has a sweep of stored derivation results pending or stalled.",
" [INFO] missing_recorded_files: Not applicable: no source is a classic checkout on this host (managed sources are checked by ghost_pages).",
" [OK] uncommitted_sync_deletions: No soft-deleted page was removed by a sync while Git never held its file (0 tombstone(s) checked).",
diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.json
index 57003d2076..f026769021 100644
--- a/test/fixtures/goldens/doctor/content-pglite-json.json
+++ b/test/fixtures/goldens/doctor/content-pglite-json.json
@@ -3729,6 +3729,17 @@
"name": "purge_parked_pages",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "origins": [],
+ "parked": 0
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No soft-deleted page is kept from the purge to keep a page derived from it private.",
+ "name": "derived_origin_parked",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {