Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
wip(#6712 PR 4b lane S): Postgres arm, Postgres doctor goldens, config.ts ceiling
garrytan0bfa43ce3953
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 94726c59a5..98b78b4684 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -45,5 +45,5 @@ src/core/search/mode.ts 1669 ratchet +53 W3 confidence-gated reranking: rerankersrc/commands/eval-longmemeval.ts 1544 ratchet new row: crossed the 1500 unlisted cap in fw3-search (#5092 benchmark-brain recycling: configureBrain split + recycler wiring + test seams; the recycler itself lives in src/eval/longmemeval/harness.ts); +1 P6: tokenmax synopsis-tier wiring (logic in eval/longmemeval/synopsis-tier.ts); +13 GBRA-81 lane A: --via-operation query|search (flags, per-call expansion pin, the run's expectExpansion, the op branch in runOneQuestion, row field, via_operation_summary and its FAIL line; logic in eval/longmemeval/via-operation.ts); +12 --call-plan FILE / --call-plan-gate CMD: two LME_FLAGS entries (CLI help lines), two ParsedArgs fields, the parseArgs pairing check and the header invariant (planner lives in eval/longmemeval/call-plan.ts; runEvalLongMemEval is one line shorter)src/commands/doctor/checks/extraction-sync.ts 1543 ratchet +1 undeclared_db_only_pages computes the source Git scope once per source (logic in core/markdown.ts sourceGitScope); new row: crossed the 1500 unlisted cap at the fix wave 9 merge: +7 lane W #5028 (extract_atoms freshness judged by the phase itself) and +3 lane F #5863 (extract_health dates a high halt rate by its last halt), each under the cap alone; +7 #5019: content_hash_duplicates fix pins the pairs' source (GBRAIN_SOURCE) and names a delete that runs; +1 fix wave 10 lane L1 #5556: links_extraction_lag denominator excludes quarantined pages (quarantineFilterFragment import); +11 fix wave 15 P2.8 (#5495): extract_health reads the 7-day halt reasons per kind (halt_reasons, top_halt_reason in details and the top reason in the warn line); the read, the unknown bucket and the ranking live in core/extract/rollup-writer.ts; +20 wave 18b lane 1: links_extraction_lag names the columns its pre-migration degrade reads (#6599 strict predicate), sync_freshness separates sync outcome from freshness for a source with no successful sync (#4960; verdict text, fixes and the attempt read live in doctor/sync-outcome.ts and core/sync-attempt.ts) and exempts read-only skill-pack catalogs (#6076; core/shared-skills/adopted-packs.ts)src/core/search/evidence-delivery.ts 1673 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136)-src/commands/config.ts 1510 ratchet new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig)+src/commands/config.ts 1511 ratchet new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6712 PR 4b: sync.admission set dispatch (validation and the set_at write live in commands/config/sync-admission-value.ts, persistence/sync-admission.ts)src/commands/mcp-expose.ts 1512 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts)diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.jsonindex 47f001e1dd..0e072f4905 100644--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json@@ -651,6 +651,20 @@"name": "managed_sync_blocked","status": "ok"},+ {+ "category": "ops",+ "details": {+ "age_seconds": null,+ "docs": "docs/guides/error-codes.md#sync_admission_restricted",+ "set_at": null,+ "stored": null,+ "value": "normal"+ },+ "elapsed_ms": "<volatile>",+ "message": "sync.admission is normal: managed sync admits everything it classifies.",+ "name": "sync_admission_restricted",+ "status": "ok"+ },{"category": "ops","details": {@@ -4576,6 +4590,20 @@"name": "managed_sync_blocked","status": "ok"},+ {+ "category": "ops",+ "details": {+ "age_seconds": null,+ "docs": "docs/guides/error-codes.md#sync_admission_restricted",+ "set_at": null,+ "stored": null,+ "value": "normal"+ },+ "elapsed_ms": "<volatile>",+ "message": "sync.admission is normal: managed sync admits everything it classifies.",+ "name": "sync_admission_restricted",+ "status": "ok"+ },{"category": "ops","details": {diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.jsonindex d1efba3d5d..926548da5e 100644--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json@@ -635,6 +635,20 @@"name": "managed_sync_blocked","status": "ok"},+ {+ "category": "ops",+ "details": {+ "age_seconds": null,+ "docs": "docs/guides/error-codes.md#sync_admission_restricted",+ "set_at": null,+ "stored": null,+ "value": "normal"+ },+ "elapsed_ms": "<volatile>",+ "message": "sync.admission is normal: managed sync admits everything it classifies.",+ "name": "sync_admission_restricted",+ "status": "ok"+ },{"category": "ops","details": {diff --git a/test/postgres-unit-arms.txt b/test/postgres-unit-arms.txtindex 78215bc04e..c259ec261c 100644--- a/test/postgres-unit-arms.txt+++ b/test/postgres-unit-arms.txt@@ -195,6 +195,7 @@ test/shared-skills-writer-boundary.test.tstest/source-retire-missing-checkout.test.tstest/source-row-diagnostics.test.tstest/stats-health-source-scope.test.ts+test/sync-admission-6712.test.tstest/sync-capacity-preflight.test.tstest/sync-checkpoint-moved-6834.test.tstest/sync-drain-claims.test.tsdiff --git a/test/sync-admission-6712.test.ts b/test/sync-admission-6712.test.tsindex 6a9d1f2140..633b1a54cc 100644--- a/test/sync-admission-6712.test.ts+++ b/test/sync-admission-6712.test.ts@@ -10,10 +10,15 @@* - doctor `sync_admission_restricted` warns on a managed brain while the value is not `normal`, with its age and the* restore command for the user, and is ok on `normal` and on a brain that is not managed;* - `sync status` carries `admission`.+ *+ * Seams: none; PGLite always, Postgres when DATABASE_URL is set.*/-import { afterAll, beforeAll, beforeEach, expect, spyOn, test } from 'bun:test';+import { afterAll, beforeAll, beforeEach, describe, expect, spyOn, test } from 'bun:test';import { randomUUID } from 'node:crypto';+import type { BrainEngine } from '../src/core/engine.ts';import { PGLiteEngine } from '../src/core/pglite-engine.ts';+import { PostgresEngine } from '../src/core/postgres-engine.ts';+import { requirePostgresTestDatabase, testBackends } from './helpers/test-backends.ts';import { runConfig } from '../src/commands/config.ts';import { readSyncAdmission, readSyncAdmissionSetting, syncAdmissionStatus, SYNC_ADMISSION_KEY, SYNC_ADMISSION_SET_OP } from '../src/core/persistence/sync-admission.ts';import { writePassRow, type ManagedSyncPassValue } from '../src/core/persistence/sync-pass-row.ts';@@ -23,21 +28,22 @@ import { declarePersistenceProtocol } from '../src/core/persistence/protocol.ts'import { cliRenderContext, renderAction, type Action } from '../src/core/agent-output.ts';import { syncLockId } from '../src/core/db-lock.ts';-let engine: PGLiteEngine;+let engine: BrainEngine;let incarnation: string;const SOURCE = 'default';-beforeAll(async () => {- engine = new PGLiteEngine(); await engine.connect({}); await engine.initSchema();+async function connect(backend: 'pglite' | 'postgres'): Promise<void> {+ if (backend === 'postgres') { const pg = new PostgresEngine(); await pg.connect({ database_url: requirePostgresTestDatabase() } as never); engine = pg; }+ else { const lite = new PGLiteEngine(); await lite.connect({}); engine = lite; }+ await engine.initSchema();incarnation = (await engine.executeRaw<{ incarnation: string }>('SELECT incarnation::text AS incarnation FROM sources WHERE id=$1', [SOURCE]))[0]!.incarnation;-}, 120_000);-afterAll(async () => { await engine.disconnect(); });-beforeEach(async () => {+}+async function reset(): Promise<void> {await engine.unsetConfig(SYNC_ADMISSION_KEY);await engine.executeRaw('DELETE FROM op_checkpoints WHERE op=ANY($1::text[])', [[SYNC_ADMISSION_SET_OP, 'managed-sync-pass']]);await engine.executeRaw('DELETE FROM gbrain_cycle_locks WHERE id=$1', [syncLockId(SOURCE)]);await engine.executeRaw('DELETE FROM persistence_requests WHERE source_id=$1', [SOURCE]);-});+}async function config(args: string[]) {const logs: string[] = [], errs: string[] = [];@@ -83,115 +89,121 @@ async function setManaged(enabled: boolean) {});}-test('config set sync.admission refuses a value outside the three and writes nothing, --force included', async () => {- for (const args of [['set', SYNC_ADMISSION_KEY, 'off'], ['set', SYNC_ADMISSION_KEY, 'Normal'], ['set', SYNC_ADMISSION_KEY, 'hold_destructive', '--force']]) {- const refused = await config(args);- expect(refused.exit).toBe(2);- expect(refused.err).toContain('sync.admission is one of normal, imports_only, classify_only');- expect(refused.err).toContain('Nothing was written');- expect(await engine.getConfig(SYNC_ADMISSION_KEY)).toBeNull();- }- const got = await config(['get', SYNC_ADMISSION_KEY]);- expect(got.exit).toBeNull();- expect(got.out).toBe('normal');- expect(got.err).toContain('default (unset)');-});+for (const backend of testBackends()) describe(backend, () => {+ beforeAll(() => connect(backend), 120_000);+ afterAll(async () => { await engine.disconnect(); });+ beforeEach(reset);-test('each value is stored with its set_at; a transaction reads it; config get prints the value in effect', async () => {- for (const value of ['imports_only', 'classify_only', 'normal'] as const) {- const [{ before }] = await engine.executeRaw<{ before: string }>('SELECT clock_timestamp()::text AS before');- const set = await config(['set', SYNC_ADMISSION_KEY, value]);- expect(set.exit).toBeNull();- expect(set.out).toContain(`Set sync.admission = ${value}`);- expect(await engine.transaction(tx => readSyncAdmission(tx))).toBe(value);- const setting = await readSyncAdmissionSetting(engine);- expect(setting).toMatchObject({ value, stored: value });- expect(Date.parse(setting.set_at!)).toBeGreaterThanOrEqual(Date.parse(before) - 1);+ test('config set sync.admission refuses a value outside the three and writes nothing, --force included', async () => {+ for (const args of [['set', SYNC_ADMISSION_KEY, 'off'], ['set', SYNC_ADMISSION_KEY, 'Normal'], ['set', SYNC_ADMISSION_KEY, 'hold_destructive', '--force']]) {+ const refused = await config(args);+ expect(refused.exit).toBe(2);+ expect(refused.err).toContain('sync.admission is one of normal, imports_only, classify_only');+ expect(refused.err).toContain('Nothing was written');+ expect(await engine.getConfig(SYNC_ADMISSION_KEY)).toBeNull();+ }const got = await config(['get', SYNC_ADMISSION_KEY]);- expect(got.out).toBe(value);- expect(got.err).toContain(`set at ${setting.set_at}`);- }- await engine.setConfig(SYNC_ADMISSION_KEY, 'junk');- expect(await readSyncAdmissionSetting(engine)).toMatchObject({ value: 'classify_only', stored: 'junk', set_at: null });- const got = await config(['get', SYNC_ADMISSION_KEY]);- expect(got.out).toBe('classify_only');- expect(got.err).toContain('fail closed');-});--test('effective waits for a pass pinned before set_at that holds the lease, and turns true when it ends or loses the lease', async () => {- const token = randomUUID();- await pinPass(token, new Date(Date.now() - 60_000).toISOString());- await holdLease(token);- expect((await config(['set', SYNC_ADMISSION_KEY, 'imports_only'])).exit).toBeNull();- expect(await status()).toMatchObject({ value: 'imports_only', effective: false });- await pinPass(token, new Date(Date.now() - 60_000).toISOString(), 'synced');- expect((await status()).effective).toBe(true);- await pinPass(token, new Date(Date.now() - 60_000).toISOString());- expect((await status()).effective).toBe(false);- await engine.executeRaw("UPDATE gbrain_cycle_locks SET ttl_expires_at=now()-interval '1 second' WHERE id=$1", [syncLockId(SOURCE)]);- expect((await status()).effective).toBe(true);- await holdLease(randomUUID());- expect((await status()).effective).toBe(true);- const next = randomUUID();- await holdLease(next);- await pinPass(next, new Date(Date.parse((await readSyncAdmissionSetting(engine)).set_at!) + 1000).toISOString());- expect((await status()).effective).toBe(true);- await pinPass(next, new Date(Date.now() - 60_000).toISOString());- expect((await config(['set', SYNC_ADMISSION_KEY, 'classify_only'])).exit).toBeNull();- expect((await status()).effective).toBe(false);- expect((await config(['set', SYNC_ADMISSION_KEY, 'normal'])).exit).toBeNull();- expect(await status()).toMatchObject({ value: 'normal', effective: true });-});--test('effective waits for a destructive request admitted before set_at until it is published', async () => {- const del = await admitRequest('managed_sync_delete', '1 minute');- const reconcile = await admitRequest('canonical_reconcile', '1 minute');- await admitRequest('managed_sync_import', '1 minute');- expect((await config(['set', SYNC_ADMISSION_KEY, 'imports_only'])).exit).toBeNull();- expect((await status()).effective).toBe(false);- await engine.executeRaw("UPDATE persistence_requests SET state='running' WHERE request_id=$1::uuid", [del]);- await engine.executeRaw("UPDATE persistence_requests SET state='committed', completed_at=now() WHERE request_id=$1::uuid", [reconcile]);- expect((await status()).effective).toBe(false);- await engine.executeRaw("UPDATE persistence_requests SET state='cancelled', completed_at=now() WHERE request_id=$1::uuid", [del]);- expect((await status()).effective).toBe(true);- await admitRequest('managed_sync_delete', '0 seconds');- expect((await status()).effective).toBe(true);- await admitRequest('managed_sync_delete', '1 minute');- expect((await status()).effective).toBe(false);- await engine.executeRaw('DELETE FROM op_checkpoints WHERE op=$1', [SYNC_ADMISSION_SET_OP]);- expect(await status()).toMatchObject({ value: 'imports_only', set_at: null, effective: false });-});+ expect(got.exit).toBeNull();+ expect(got.out).toBe('normal');+ expect(got.err).toContain('default (unset)');+ });-test('doctor sync_admission_restricted warns on a managed brain while not normal, and is ok on normal and on a brain that is not managed', async () => {- const ctx = { engine, progress: { heartbeat: () => {} } } as never;- expect(await syncAdmissionEntry.run(ctx)).toMatchObject([{ name: 'sync_admission_restricted', status: 'ok' }]);- expect((await config(['set', SYNC_ADMISSION_KEY, 'imports_only'])).exit).toBeNull();- expect(await syncAdmissionEntry.run(ctx)).toMatchObject([{ name: 'sync_admission_restricted', status: 'ok', severity: 'info', readiness_state: 'not_applicable' }]);- await setManaged(true);- try {- for (const value of ['imports_only', 'classify_only'] as const) {- expect((await config(['set', SYNC_ADMISSION_KEY, value])).exit).toBeNull();- const checks = await syncAdmissionEntry.run(ctx);- if (!Array.isArray(checks)) throw new Error('sync_admission_restricted returned no checks');- const [check] = checks;- expect(check).toMatchObject({ name: 'sync_admission_restricted', status: 'warn', details: { value, age_seconds: expect.any(Number) },- fix: { argv: ['gbrain', 'config', 'set', 'sync.admission', 'normal'], actor: 'user' } });- expect(check!.message).toContain(`sync.admission is ${value}, set `);- expect(check!.message).toContain(' ago (');- expect(check!.message).toContain('gbrain config set sync.admission normal');- expect(renderAction(check!.fix as Action, cliRenderContext()).next).toBe('tell_user_to_run');+ test('each value is stored with its set_at; a transaction reads it; config get prints the value in effect', async () => {+ for (const value of ['imports_only', 'classify_only', 'normal'] as const) {+ const [{ before }] = await engine.executeRaw<{ before: string }>('SELECT clock_timestamp()::text AS before');+ const set = await config(['set', SYNC_ADMISSION_KEY, value]);+ expect(set.exit).toBeNull();+ expect(set.out).toContain(`Set sync.admission = ${value}`);+ expect(await engine.transaction(tx => readSyncAdmission(tx))).toBe(value);+ const setting = await readSyncAdmissionSetting(engine);+ expect(setting).toMatchObject({ value, stored: value });+ expect(Date.parse(setting.set_at!)).toBeGreaterThanOrEqual(Date.parse(before) - 1);+ const got = await config(['get', SYNC_ADMISSION_KEY]);+ expect(got.out).toBe(value);+ expect(got.err).toContain(`set at ${setting.set_at}`);}+ await engine.setConfig(SYNC_ADMISSION_KEY, 'junk');+ expect(await readSyncAdmissionSetting(engine)).toMatchObject({ value: 'classify_only', stored: 'junk', set_at: null });+ const got = await config(['get', SYNC_ADMISSION_KEY]);+ expect(got.out).toBe('classify_only');+ expect(got.err).toContain('fail closed');+ });++ test('effective waits for a pass pinned before set_at that holds the lease, and turns true when it ends or loses the lease', async () => {+ const token = randomUUID();+ await pinPass(token, new Date(Date.now() - 60_000).toISOString());+ await holdLease(token);+ expect((await config(['set', SYNC_ADMISSION_KEY, 'imports_only'])).exit).toBeNull();+ expect(await status()).toMatchObject({ value: 'imports_only', effective: false });+ await pinPass(token, new Date(Date.now() - 60_000).toISOString(), 'synced');+ expect((await status()).effective).toBe(true);+ await pinPass(token, new Date(Date.now() - 60_000).toISOString());+ expect((await status()).effective).toBe(false);+ await engine.executeRaw("UPDATE gbrain_cycle_locks SET ttl_expires_at=now()-interval '1 second' WHERE id=$1", [syncLockId(SOURCE)]);+ expect((await status()).effective).toBe(true);+ await holdLease(randomUUID());+ expect((await status()).effective).toBe(true);+ const next = randomUUID();+ await holdLease(next);+ await pinPass(next, new Date(Date.parse((await readSyncAdmissionSetting(engine)).set_at!) + 1000).toISOString());+ expect((await status()).effective).toBe(true);+ await pinPass(next, new Date(Date.now() - 60_000).toISOString());+ expect((await config(['set', SYNC_ADMISSION_KEY, 'classify_only'])).exit).toBeNull();+ expect((await status()).effective).toBe(false);expect((await config(['set', SYNC_ADMISSION_KEY, 'normal'])).exit).toBeNull();+ expect(await status()).toMatchObject({ value: 'normal', effective: true });+ });++ test('effective waits for a destructive request admitted before set_at until it is published', async () => {+ const del = await admitRequest('managed_sync_delete', '1 minute');+ const reconcile = await admitRequest('canonical_reconcile', '1 minute');+ await admitRequest('managed_sync_import', '1 minute');+ expect((await config(['set', SYNC_ADMISSION_KEY, 'imports_only'])).exit).toBeNull();+ expect((await status()).effective).toBe(false);+ await engine.executeRaw("UPDATE persistence_requests SET state='running' WHERE request_id=$1::uuid", [del]);+ await engine.executeRaw("UPDATE persistence_requests SET state='committed', completed_at=now() WHERE request_id=$1::uuid", [reconcile]);+ expect((await status()).effective).toBe(false);+ await engine.executeRaw("UPDATE persistence_requests SET state='cancelled', completed_at=now() WHERE request_id=$1::uuid", [del]);+ expect((await status()).effective).toBe(true);+ await admitRequest('managed_sync_delete', '0 seconds');+ expect((await status()).effective).toBe(true);+ await admitRequest('managed_sync_delete', '1 minute');+ expect((await status()).effective).toBe(false);+ await engine.executeRaw('DELETE FROM op_checkpoints WHERE op=$1', [SYNC_ADMISSION_SET_OP]);+ expect(await status()).toMatchObject({ value: 'imports_only', set_at: null, effective: false });+ });++ test('doctor sync_admission_restricted warns on a managed brain while not normal, and is ok on normal and on a brain that is not managed', async () => {+ const ctx = { engine, progress: { heartbeat: () => {} } } as never;expect(await syncAdmissionEntry.run(ctx)).toMatchObject([{ name: 'sync_admission_restricted', status: 'ok' }]);- } finally {- await setManaged(false);- }-});+ expect((await config(['set', SYNC_ADMISSION_KEY, 'imports_only'])).exit).toBeNull();+ expect(await syncAdmissionEntry.run(ctx)).toMatchObject([{ name: 'sync_admission_restricted', status: 'ok', severity: 'info', readiness_state: 'not_applicable' }]);+ await setManaged(true);+ try {+ for (const value of ['imports_only', 'classify_only'] as const) {+ expect((await config(['set', SYNC_ADMISSION_KEY, value])).exit).toBeNull();+ const checks = await syncAdmissionEntry.run(ctx);+ if (!Array.isArray(checks)) throw new Error('sync_admission_restricted returned no checks');+ const [check] = checks;+ expect(check).toMatchObject({ name: 'sync_admission_restricted', status: 'warn', details: { value, age_seconds: expect.any(Number) },+ fix: { argv: ['gbrain', 'config', 'set', 'sync.admission', 'normal'], actor: 'user' } });+ expect(check!.message).toContain(`sync.admission is ${value}, set `);+ expect(check!.message).toContain(' ago (');+ expect(check!.message).toContain('gbrain config set sync.admission normal');+ expect(renderAction(check!.fix as Action, cliRenderContext()).next).toBe('tell_user_to_run');+ }+ expect((await config(['set', SYNC_ADMISSION_KEY, 'normal'])).exit).toBeNull();+ expect(await syncAdmissionEntry.run(ctx)).toMatchObject([{ name: 'sync_admission_restricted', status: 'ok' }]);+ } finally {+ await setManaged(false);+ }+ });-test('sync status carries admission', async () => {- expect((await readSyncStatus(engine, SOURCE, { detail: false })).admission).toEqual({ value: 'normal', set_at: null, effective: true });- expect((await config(['set', SYNC_ADMISSION_KEY, 'classify_only'])).exit).toBeNull();- const { admission } = await readSyncStatus(engine, SOURCE, { detail: false });- expect(admission).toMatchObject({ value: 'classify_only', effective: true });- expect(admission.set_at).toBe((await readSyncAdmissionSetting(engine)).set_at);+ test('sync status carries admission', async () => {+ expect((await readSyncStatus(engine, SOURCE, { detail: false })).admission).toEqual({ value: 'normal', set_at: null, effective: true });+ expect((await config(['set', SYNC_ADMISSION_KEY, 'classify_only'])).exit).toBeNull();+ const { admission } = await readSyncStatus(engine, SOURCE, { detail: false });+ expect(admission).toMatchObject({ value: 'classify_only', effective: true });+ expect(admission.set_at).toBe((await readSyncAdmissionSetting(engine)).set_at);+ });});