Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs: canonical writer census notes url-clone-fences restores a held HEAD without importing (#7897)

garrytan9bed685d3eff
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsv
index 700ea4c446..2c4363aadf 100644
--- a/docs/architecture/canonical-writers.tsv
+++ b/docs/architecture/canonical-writers.tsv
@@ -278,7 +278,7 @@ src/core/belief/ledger.ts 0 contract The belief ledger finalization contract wri
src/core/belief/purge.ts 1 engine_guard bumpPurgeEpoch updates only sources.purge_epoch, a counter the managed writer guard lets through because the identity and checkpoint columns stay unchanged; it runs inside the purge transaction that already holds the purge's admission and page keys.
src/core/belief/purge-mirror.ts 4 engine_guard W1 restore replay (BELIEF_LEDGER.md 8) of purges newer than the archive: runs only inside the backup restore's single transaction before the restored root is published, granting gbrain.write_sources for that one source in that transaction; its fact, take and page deletes repeat what purge_fact and purgePageInTransaction removed.
src/core/persistence/links-extraction-holds.ts 2 engine_guard GBRA-130 A-1: records and clears only the derived pages.links_extract_failure column (a stale-extraction failure record outside the managed writer guard tracked set, like the attendance marker); it touches no canonical body, title, type, tag or frontmatter column.
-src/core/repair/url-clone-fences.ts 3 engine_guard GBRA-130 C-2: unmanaged brains only (refused on managed). Keeps the fence rows the database already holds database-only in a maintenance transaction, then imports the clone file's HEAD bytes through importFromContent before restoring the file; preview-bound (--expect) with destructive consent and a file backup.
+src/core/repair/url-clone-fences.ts 3 engine_guard GBRA-130 C-2: unmanaged brains only (refused on managed). Keeps the fence rows the database already holds database-only in a maintenance transaction, then imports the clone file's HEAD bytes through importFromContent before restoring the file (a HEAD the private hold refuses is restored without importing, #7897); preview-bound (--expect) with destructive consent and a file backup.
src/core/repair/visibility.ts 1 coordinator `gbrain repair visibility --apply` (GBRA-159) only tightens database-only active facts from world to private when their source page is private. On a managed brain the UPDATE runs only inside the managed_maintenance_tighten_fact_visibility publication (owner-checked by maintenancePreflight, page key locked); an unmanaged brain runs it in one maintenanceTransaction. The UPDATE rechecks visibility='world', row_num IS NULL and expired_at IS NULL under the row lock. Fenced rows are never updated here: they change in the page through a revision-bound put_page.
src/core/facts/file-body-guard.ts 1 engine_guard #6982 replaceStoredBody mirrors a checkout file body over the page row only inside its caller's maintenanceTransaction, after re-reading the row under a row lock and confirming it still equals the body the caller compared, and saves a page_versions row first; on a managed brain the canonical table trigger refuses the write outside the coordinator.
src/core/persistence/git-declared.ts 4 coordinator GBRA-95 G7a declareStrictPublication stamps or clears pages.database_only_reason (and drops source_path/source_uri for a page turning private, keeping the path in withheld_source_path, which the publication that writes the file again clears) inside the guarded publication transaction of publishMutation and publishGroup, after the door commit removed the file; it writes no content.