Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
refactor(doctor): rename_identity_downgrades and purge_parked_pages push through checks[] so the registry AST walker sees them (#6729, #6741)
garrytand753f43ef461
diff --git a/src/commands/doctor/checks/purge-parks.ts b/src/commands/doctor/checks/purge-parks.tsindex a42e81c7df..ec2b97a400 100644--- a/src/commands/doctor/checks/purge-parks.ts+++ b/src/commands/doctor/checks/purge-parks.ts@@ -9,7 +9,7 @@ import type { Check } from '../../doctor.ts';import type { BrainEngine } from '../../../core/engine.ts';import { PURGE_PARK_LIMIT, readPurgeParks } from '../../../core/persistence/purge-parks.ts';import { checkError, doctorVerify } from '../check-fix.ts';-import { connectedEngine, type DoctorEntry } from '../context.ts';+import { connectedEngine, type DoctorContext, type DoctorEntry } from '../context.ts';const NAME = 'purge_parked_pages';const SAMPLE = 20;@@ -35,8 +35,10 @@ export async function checkPurgeParkedPages(engine: BrainEngine): Promise<Check>};}-export const purgeParkedPagesEntry: DoctorEntry = {- name: NAME,- emits: [NAME],- run: async ctx => [await checkPurgeParkedPages(connectedEngine(ctx))],-};+async function runPurgeParkedPages(ctx: DoctorContext): Promise<Check[]> {+ const checks: Check[] = [];+ checks.push(await checkPurgeParkedPages(connectedEngine(ctx)));+ return checks;+}++export const purgeParkedPagesEntry: DoctorEntry = { name: 'purge_parked_pages', emits: [NAME], run: runPurgeParkedPages };diff --git a/src/commands/doctor/checks/rename-identity-downgrades.ts b/src/commands/doctor/checks/rename-identity-downgrades.tsindex e292299881..1f4dd38ec1 100644--- a/src/commands/doctor/checks/rename-identity-downgrades.ts+++ b/src/commands/doctor/checks/rename-identity-downgrades.ts@@ -14,25 +14,30 @@ const DOCS = 'docs/guides/live-sync.md#renaming-a-page';const SAMPLE = 5;async function runRenameIdentityDowngrades(ctx: DoctorContext): Promise<Check[]> {+ const checks: Check[] = [];try {const open = await listIdentityDowngrades(connectedEngine(ctx));const bySource = [...new Set(open.map(record => record.source_id))].map(source_id => ({ source_id, count: open.filter(record => record.source_id === source_id).length }));const samples = open.slice(0, SAMPLE).map(record => ({ source_id: record.source_id, from: record.from, to: record.to, old_slug: record.old_slug, new_slug: record.new_slug,reason: record.reason, facts: record.facts, links: record.links, aliases: record.aliases, expires_at: record.expires_at }));const details = { count: open.length, by_source: bySource, samples, docs: DOCS };- if (!open.length) return [{ name: 'rename_identity_downgrades', status: 'ok', details, message: 'No rename in the last 72 h lost its page identity.' }];+ if (!open.length) {+ checks.push({ name: 'rename_identity_downgrades', status: 'ok', details, message: 'No rename in the last 72 h lost its page identity.' });+ return checks;+ }const first = open[0]!;- return [{ name: 'rename_identity_downgrades', status: 'warn', details,+ checks.push({ name: 'rename_identity_downgrades', status: 'warn', details,message: `${open.length} rename(s) synced in the last 72 h did not keep their page identity, so each old page's facts, links and aliases stay on its soft-deleted slug until its window ends `+ `(e.g. ${samples.map(record => `${record.source_id}:${record.from} -> ${record.to}, ${record.facts} fact(s) and ${record.links} link(s) on ${record.old_slug}`).join('; ')}; `+ `first: ${identityDowngradeReasonText(first.reason)}). If a pair is one page that moved, preview carrying its identity with ${identityRemedyPreviewArgv(first.source_id).join(' ')}; `+ 'otherwise nothing is needed and the old pages purge after their window.',fix: agentFix([...identityRemedyPreviewArgv(first.source_id), '--json'],'Read-only preview: lists each pair with what would move onto the new page and prints the apply command with its hash. Apply only after the user confirms the pair is one page that moved.',- 'rename_identity_downgrades', { docs: DOCS }) }];+ 'rename_identity_downgrades', { docs: DOCS }) });} catch (error) {- return [checkError('rename_identity_downgrades', 'read the renames whose identity was not kept', error, { details: { count: 'unknown', docs: DOCS } })];+ checks.push(checkError('rename_identity_downgrades', 'read the renames whose identity was not kept', error, { details: { count: 'unknown', docs: DOCS } }));}+ return checks;}export const renameIdentityDowngradesEntry: DoctorEntry = { name: 'rename_identity_downgrades', emits: ['rename_identity_downgrades'], run: runRenameIdentityDowngrades };