Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

doctor and search: per-class projection readiness and preview-first fixes (#6803)

garrytanacd6bb1e7ad9
diff --git a/src/commands/doctor/checks/projection-readiness.ts b/src/commands/doctor/checks/projection-readiness.ts
index c58a58ea00..d635cff204 100644
--- a/src/commands/doctor/checks/projection-readiness.ts
+++ b/src/commands/doctor/checks/projection-readiness.ts
@@ -1,53 +1,146 @@
import type { BrainEngine } from '../../../core/engine.ts';
import type { PageReadScope } from '../../../core/types.ts';
+import type { Action } from '../../../core/agent-output.ts';
import { probeProjectionReadiness } from '../../../core/search/projection-readiness.ts';
+import { projectionBacklog, type ProjectionBacklog } from '../../../core/page-state/projections.ts';
+import { projectionDrainLimit } from '../../../core/page-state/image-seal.ts';
import type { PersistenceProjectionStatus } from '../../../core/persistence/ipc.ts';
+import { isMultimodalEnabled } from '../../../core/sync.ts';
import type { Check } from '../../doctor.ts';
import type { DoctorContext, DoctorEntry } from '../context.ts';
const DOCS = 'docs/guides/repair.md#projection-drain';
const UNCHANGED = 'No repair or embedding was started by this check.';
const CODE_REPAIR = 'For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path.';
+const DRAIN_PREVIEW = ['gbrain', 'projections', 'drain', '--dry-run', '--json'];
+const IMAGES_PREVIEW = ['gbrain', 'embed', '--stale', '--images', '--dry-run', '--json'];
+
+/** #6803: the class counts doctor reports (counts only, never identifiers). */
+function classDetails(backlog: Required<ProjectionBacklog>) {
+ const { pending, failed, sealable, sealable_with_visual, reimport, ocr_required, protected: guarded, archived, oldest_age_seconds, as_of } = backlog;
+ return { pending, failed, sealable, sealable_with_visual, reimport, ocr_required, protected: guarded, archived, oldest_age_seconds, as_of };
+}
+
+/** One sentence per class that needs work or is unsealed by design, from the backlog's counts. */
+function classSentences(backlog: Required<ProjectionBacklog>, resident: boolean): string[] {
+ const sentences: string[] = [];
+ if (backlog.sealable) {
+ sentences.push(`${backlog.sealable} image page(s) the importer already attested (${backlog.sealable_with_visual} with a visual vector) are out of search until \`gbrain projections drain\` seals them (keyless: no provider call, no re-embedding; preview with \`gbrain projections drain --dry-run --json\`)${resident ? '; the resident never seals images' : ''}.`);
+ }
+ if (backlog.reimport) {
+ sentences.push(`${backlog.reimport} image page(s) need their importer (fresh OCR and pixels, paid): preview with \`gbrain embed --stale --images --dry-run\`${backlog.ocr_required
+ ? `; ${backlog.ocr_required} of them held protected OCR before an edit and are sealed only after a successful fresh OCR pass, so they need OCR enabled (GBRAIN_EMBEDDING_IMAGE_OCR=true)` : ''}.`);
+ }
+ if (backlog.protected || backlog.archived) {
+ sentences.push(`${backlog.protected} protected-OCR image(s) and ${backlog.archived} archived-source page(s) stay unsealed by design: search leaves them out until the image is reimported without protected content or the source is restored.`);
+ }
+ return sentences;
+}
+
+/**
+ * The fix for a queue that needs work: the drain when text or sealable images
+ * wait (ask first when it would seal images: Decision 3), else the paid
+ * importer route for `reimport` images, or null with the setting that blocks it.
+ * A remote caller cannot run either: the host admin does.
+ */
+function projectionFix(backlog: Required<ProjectionBacklog>, opts: { remote?: boolean }): { fix?: Action; blocked?: string } {
+ const actor = opts.remote ? 'host_admin' as const : 'agent' as const;
+ if (backlog.pending || backlog.sealable) {
+ const limit = projectionDrainLimit(backlog.pending);
+ return { fix: { argv: ['gbrain', 'projections', 'drain', '--limit', String(limit)], preview_argv: DRAIN_PREVIEW, consent: [], actor, requires_exclusive: false,
+ ...(backlog.sealable ? { ask_user: true as const,
+ user_message: `${backlog.sealable} image page(s) are out of search until they are sealed. \`gbrain projections drain --limit ${limit}\` seals the ones the importer already attested (keyless, no provider call, no re-embedding), at most ${limit} per run; may I run it, repeating until sealable is 0?` } : {}),
+ why: `Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most ${limit} pages per run; repeat until the dry run shows sealable 0.`,
+ verify: { argv: DRAIN_PREVIEW }, docs: DOCS } };
+ }
+ if (!backlog.reimport) return {};
+ if (!isMultimodalEnabled()) return { blocked: 'GBRAIN_EMBEDDING_MULTIMODAL' };
+ return { fix: { argv: ['gbrain', 'embed', '--stale', '--images', '--max-usd', '<USD>'], preview_argv: IMAGES_PREVIEW, consent: ['paid', 'egress'], actor, ask_user: true,
+ requires_exclusive: false, inputs: [{ name: 'USD', how: 'a dollar cap the user approves after reading the dry run' }],
+ user_message: `${backlog.reimport} image page(s) can be sealed only by a fresh import (OCR and one multimodal embedding per image, paid)${backlog.ocr_required
+ ? `; ${backlog.ocr_required} of them need OCR enabled (GBRAIN_EMBEDDING_IMAGE_OCR=true) and a successful fresh OCR pass` : ''}. The dry run counts them; may I run the paid sweep with a cap you choose?`,
+ why: 'Re-imports each image from its source file: fresh OCR decides safety from the current pixels, then the importer seals it.',
+ verify: { argv: IMAGES_PREVIEW }, docs: DOCS } };
+}
/**
* #5401: `resident` is true when the caller runs inside a PGLite resident (the
* run_doctor operation on a serving process), where the drain command would
- * refuse; the resident drains the backlog itself.
+ * refuse; the resident drains text itself. #6803: the check reports every
+ * class of the queue (page-state/projection-class.ts): `pending` text,
+ * `sealable` and `reimport` images and `failed` rows warn; `protected` and
+ * `archived` are by design (ok, info). `remote` callers get the host admin's fix.
*/
-export async function checkProjectionReadiness(engine: BrainEngine, scope: PageReadScope = {}, opts: { resident?: boolean } = {}): Promise<Check> {
+export async function checkProjectionReadiness(engine: BrainEngine, scope: PageReadScope = {}, opts: { resident?: boolean; remote?: boolean } = {}): Promise<Check> {
const readiness = await probeProjectionReadiness(engine, scope);
+ const backlog = readiness.status === 'unknown' ? null : await projectionBacklog(engine, scope).catch(() => null);
+ if (!backlog) {
+ return { name: 'text_projection_readiness', status: 'warn', details: { readiness: 'unknown', ready: false },
+ message: 'Text projection readiness is unknown because its read-only probe failed; index completeness could not be verified.' };
+ }
+ const details = { readiness: readiness.status, ready: readiness.ready, ...classDetails(backlog) };
+ const work = backlog.pending + backlog.sealable + backlog.reimport;
+ if (work === 0 && readiness.status !== 'projection_pending') {
+ const byDesign = classSentences(backlog, false);
+ return byDesign.length
+ ? { name: 'text_projection_readiness', status: 'ok', severity: 'info', fix_unavailable_reason: 'operator_judgement', details,
+ message: `No queued projection needs work. ${byDesign.join(' ')}` }
+ : { name: 'text_projection_readiness', status: 'ok', message: 'Visible text projections match their canonical revisions.', details };
+ }
+ const text = backlog.pending || work === 0
+ ? `Visible pages have missing or stale text projections${backlog.pending ? ` (${backlog.pending} queued Markdown/code page(s)${backlog.failed ? `, ${backlog.failed} last failed` : ''})` : ''}; search and code results may be incomplete. ${opts.resident
+ ? 'The resident gbrain process that holds this PGLite brain is rebuilding queued Markdown and code projections (up to 100 pages per pass, fewer while writes wait). On the brain host, `gbrain doctor --only text_projection_readiness --json` shows the counts and how to drain faster.'
+ : 'Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres.'} ${CODE_REPAIR}`
+ : '';
+ const { fix, blocked } = opts.resident ? {} : projectionFix(backlog, opts);
+ const unavailable = blocked ? ` Re-importing images needs multimodal embeddings, which are off (set ${blocked}=true on the brain host, then preview with \`gbrain embed --stale --images --dry-run\`).` : '';
return {
- name: 'text_projection_readiness',
- status: readiness.ready ? 'ok' : 'warn',
- message: readiness.status === 'ready'
- ? 'Visible text projections match their canonical revisions.'
- : readiness.status === 'projection_pending'
- ? `Visible pages have missing or stale text projections; search and code results may be incomplete. ${opts.resident
- ? 'The resident gbrain process that holds this PGLite brain is rebuilding queued Markdown and code projections (up to 100 pages per pass, fewer while writes wait). On the brain host, `gbrain doctor` shows the pending count and how to drain faster.'
- : 'Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres.'} ${CODE_REPAIR} ${UNCHANGED}`
- : 'Text projection readiness is unknown because its read-only probe failed; index completeness could not be verified.',
- details: { readiness: readiness.status, ready: readiness.ready },
+ name: 'text_projection_readiness', status: 'warn',
+ message: [text, ...classSentences(backlog, opts.resident === true)].filter(Boolean).join(' ') + unavailable + ` ${UNCHANGED}`,
+ details: blocked ? { ...details, reimport_blocked_by: blocked } : details,
+ ...(fix ? { fix } : { fix_unavailable_reason: 'operator_judgement' as const }),
};
}
/** The doctor text when a PGLite resident holds the datastore, from its projection_status reply (null: it gave none). */
-export function residentProjectionReadiness(pid: number | undefined, status: PersistenceProjectionStatus | null, steps: string): Pick<Check, 'status' | 'message' | 'details'> {
+export function residentProjectionReadiness(pid: number | undefined, status: PersistenceProjectionStatus | null, steps: string, drainFix?: Action): Pick<Check, 'status' | 'message' | 'details' | 'fix' | 'fix_unavailable_reason'> {
const owner = `The resident gbrain process${pid ? ` (pid ${pid})` : ''} holds this PGLite brain`;
if (!status) {
return {
status: 'warn',
message: `${owner} and did not report its projection backlog, so it may predate the faster projection drain. Restart it on the upgraded gbrain so it drains up to 100 pages per pass. ${steps}`,
details: { readiness: 'unknown', ready: false, owner_pid: pid ?? null, docs: DOCS },
+ fix_unavailable_reason: 'operator_judgement',
};
}
- const details = { readiness: status.pending ? 'projection_pending' : 'ready', ready: status.pending === 0, owner_pid: pid ?? null, ...status, docs: DOCS };
- if (status.pending === 0) return { status: 'ok', message: `${owner} and reports no queued text projections.`, details };
+ // #6803: a resident that predates the class counts answers only pending/failed; its image rows are invisible to it.
+ if (status.sealable === undefined) {
+ return {
+ status: 'warn',
+ message: `${owner} and predates this upgrade: it reports only ${status.pending} queued text projection(s) and cannot count image pages. Restart it on the upgraded gbrain, then run \`gbrain doctor --only text_projection_readiness --json\` again. ${steps}`,
+ details: { readiness: 'unknown', ready: false, owner_pid: pid ?? null, ...status, docs: DOCS },
+ fix_unavailable_reason: 'operator_judgement',
+ };
+ }
+ const backlog = { sealable_with_visual: 0, reimport: 0, ocr_required: 0, protected: 0, archived: 0, as_of: '', ...status } as Required<ProjectionBacklog>;
+ const work = backlog.pending + backlog.sealable + backlog.reimport;
+ const details = { readiness: work ? 'projection_pending' : 'ready', ready: work === 0, owner_pid: pid ?? null, ...classDetails(backlog), docs: DOCS };
+ const images = classSentences(backlog, true);
+ if (work === 0) {
+ return images.length
+ ? { status: 'ok', message: `${owner} and reports no queued text projections. ${images.join(' ')}`, details, fix_unavailable_reason: 'operator_judgement' }
+ : { status: 'ok', message: `${owner} and reports no queued text projections.`, details };
+ }
const age = status.oldest_age_seconds === null ? '' : `; the oldest was queued ${status.oldest_age_seconds}s ago`;
const failed = status.failed ? `; ${status.failed} last failed and are retried after 30 seconds` : '';
+ const draining = status.pending
+ ? `${owner} and is draining ${status.pending} queued text projections${age}${failed}. Search and code results may be incomplete until it finishes; it rebuilds up to 100 pages per pass, fewer while writes wait. Re-run \`gbrain doctor\` to watch the count.`
+ : `${owner}; it has no queued text projections${age}.`;
return {
status: 'warn',
- message: `${owner} and is draining ${status.pending} queued text projections${age}${failed}. Search and code results may be incomplete until it finishes; it rebuilds up to 100 pages per pass, fewer while writes wait. Re-run \`gbrain doctor\` to watch the count. ${steps} ${UNCHANGED}`,
+ message: [draining, ...images, steps, UNCHANGED].join(' '),
details,
+ ...(backlog.sealable && drainFix ? { fix: drainFix } : { fix_unavailable_reason: 'operator_judgement' as const }),
};
}
@@ -61,7 +154,7 @@ async function runProjectionResident(ctx: DoctorContext): Promise<Check[]> {
const { persistenceConfigForBrain } = await import('../../../core/persistence/local-client.ts');
const { inspectLockHolder } = await import('../../../core/pglite-lock.ts');
const { persistenceSocketPathForConfig, requestPersistenceProjectionStatus } = await import('../../../core/persistence/ipc.ts');
- const { residentDrainSteps } = await import('../../projections.ts');
+ const { residentDrainSteps, residentDrainAction } = await import('../../projections.ts');
let config: ReturnType<typeof persistenceConfigForBrain>;
let brainId: string;
try {
@@ -76,7 +169,8 @@ async function runProjectionResident(ctx: DoctorContext): Promise<Check[]> {
if (socketPath) {
try { status = await requestPersistenceProjectionStatus(socketPath); } catch { /* an older resident, or none listening */ }
}
- checks.push({ name: 'text_projection_readiness', ...residentProjectionReadiness(holder.pid, status, residentDrainSteps(holder.pid, brainId)) });
+ checks.push({ name: 'text_projection_readiness', ...residentProjectionReadiness(holder.pid, status, residentDrainSteps(holder.pid, brainId),
+ residentDrainAction(holder, brainId, status)) });
return checks;
}
diff --git a/src/commands/doctor/report-remote.ts b/src/commands/doctor/report-remote.ts
index 1871f88c8d..0e395d512b 100644
--- a/src/commands/doctor/report-remote.ts
+++ b/src/commands/doctor/report-remote.ts
@@ -437,7 +437,7 @@ export async function doctorReportRemote(
checks.push(await checkProjectionReadiness(engine, {
sourceIds: opts.sourceIds,
excludePrivate: await resolveExcludePrivatePages(engine, opts.remote),
- }, { resident: engine.kind === 'pglite' && opts.remote === true }));
+ }, { resident: engine.kind === 'pglite' && opts.remote === true, remote: opts.remote === true }));
// issue #1777 — hidden_by_search_policy: chunked pages withheld from default
// search by the hard-exclude prefix policy. Pure SQL COUNT, safe on the
diff --git a/src/core/code-graph-readiness.ts b/src/core/code-graph-readiness.ts
index 7e98ead52e..774d1347ad 100644
--- a/src/core/code-graph-readiness.ts
+++ b/src/core/code-graph-readiness.ts
@@ -70,7 +70,7 @@ export async function resolveCodeReadiness(
};
const projection = await probeProjectionReadiness(engine, { ...scope, pageKind: 'code' });
if (!projection.ready) {
- return { status: projection.status, ready: false, has_code: opts.count > 0, pending_edges: false };
+ return { status: projection.status === 'projection_pending' ? 'projection_pending' : 'unknown', ready: false, has_code: opts.count > 0, pending_edges: false };
}
if (opts.count > 0) {
return { status: 'ready', ready: true, has_code: true, pending_edges: false };
diff --git a/src/core/interop-notices.ts b/src/core/interop-notices.ts
index 93450ebab3..1123e1021d 100644
--- a/src/core/interop-notices.ts
+++ b/src/core/interop-notices.ts
@@ -54,6 +54,7 @@ export const DEGRADED_STAGE_GUIDANCE: Readonly<Record<RecallStage, StageGuidance
vector_candidates_incomplete: { why: 'vector search hit its candidate limit or deadline, so some semantic matches can be missing', fix: null },
keyword_candidates_incomplete: { why: 'CJK keyword matching hit its deadline or its candidate cap on a large corpus, so some keyword matches can be missing; narrow the search with source_id (the CLI source-id flag), or ask the user to raise search.cjk_keyword_deadline_ms (milliseconds, default 3000)', fix: null },
projection_pending: { why: 'recently written pages are not in the search index yet', fix: 'doctor' },
+ projection_by_design: { why: 'some image pages in scope hold protected OCR content and stay out of the search index by design; nothing is pending', fix: null },
projection_status_unknown: { why: 'whether recent writes are in the search index could not be checked', fix: 'doctor' },
keyword_count_unavailable: { why: 'the keyword match count did not finish, so how many pages match the query is unknown', fix: null },
deadline: { why: 'the pack hit its time limit and is partial', fix: null },
diff --git a/src/core/ops/search.ts b/src/core/ops/search.ts
index 135b15a22d..e57c972f9a 100644
--- a/src/core/ops/search.ts
+++ b/src/core/ops/search.ts
@@ -447,7 +447,8 @@ async function buildRetrievalResponseMeta(
if (heldNotice) ctx.emitNotice?.(heldNotice);
const degraded = [...(m?.degraded ?? [])];
if (safeIndexPending) degraded.push({ stage: 'safe_index_pending' });
- if (readiness.status !== 'ready') {
+ if (readiness.status === 'by_design') degraded.push({ stage: 'projection_by_design' });
+ else if (readiness.status !== 'ready') {
degraded.push({ stage: readiness.status === 'projection_pending' ? 'projection_pending' : 'projection_status_unknown' });
}
const planNotice = relationalPlanNotice(m?.relational_plan);
diff --git a/src/core/search/projection-readiness.ts b/src/core/search/projection-readiness.ts
index 73cc496a38..2303176618 100644
--- a/src/core/search/projection-readiness.ts
+++ b/src/core/search/projection-readiness.ts
@@ -1,6 +1,7 @@
import type { BrainEngine } from '../engine.ts';
import type { PageReadScope } from '../types.ts';
import { pageReadFilter } from './read-policy-sql.ts';
+import { projectionClassSql } from '../page-state/projection-class.ts';
export interface ProjectionReadinessScope extends PageReadScope {
pageKind?: string;
@@ -8,8 +9,12 @@ export interface ProjectionReadinessScope extends PageReadScope {
excludeSlugPrefixes?: string[];
}
+/**
+ * `by_design` (#6803): the only unsealed pages in scope are protected-OCR images,
+ * which no repair seals (archived sources are already outside every live read).
+ */
export interface ProjectionReadiness {
- status: 'ready' | 'projection_pending' | 'unknown';
+ status: 'ready' | 'projection_pending' | 'by_design' | 'unknown';
ready: boolean;
hint?: string;
}
@@ -93,22 +98,25 @@ async function probeUncached(
filters.push(`LEFT(p.slug, LENGTH($${params.length}::text)) <> $${params.length}`);
}
try {
- const rows = await engine.executeRaw<{ pending: boolean }>(
- `SELECT EXISTS (
- SELECT 1 FROM pages p
+ // One bound statement: unsealed pages that need work, then those unsealed by design (the class fragment doctor counts).
+ const unsealed = `SELECT 1 FROM pages p JOIN sources s ON s.id = p.source_id
WHERE p.deleted_at IS NULL
AND p.text_projection_revision IS DISTINCT FROM p.knowledge_revision
- AND ${filters.join(' AND ')}
- ) AS pending`,
+ AND ${filters.join(' AND ')}`;
+ const cls = projectionClassSql('p', 's');
+ const rows = await engine.executeRaw<{ pending: boolean; by_design: boolean }>(
+ `SELECT EXISTS (${unsealed} AND ${cls} NOT IN ('protected','archived')) AS pending,
+ EXISTS (${unsealed} AND ${cls} IN ('protected','archived')) AS by_design`,
params,
);
if (typeof rows[0]?.pending !== 'boolean') throw new Error('Invalid readiness result');
- return rows[0].pending
- ? {
+ if (rows[0].pending) {
+ return {
status: 'projection_pending', ready: false,
hint: 'Current text projections are pending in the visible scope; results may be incomplete. Run `gbrain doctor` locally to inspect recovery. This read does not repair or embed content.',
- }
- : { status: 'ready', ready: true };
+ };
+ }
+ return { status: rows[0].by_design ? 'by_design' : 'ready', ready: true };
} catch {
return {
status: 'unknown', ready: false,
diff --git a/src/core/types.ts b/src/core/types.ts
index c028f9ed41..899231fc62 100644
--- a/src/core/types.ts
+++ b/src/core/types.ts
@@ -2070,7 +2070,7 @@ export const DEGRADED_STAGES = [
'safe_index_pending',
'vector_candidates_incomplete',
'keyword_candidates_incomplete',
- 'projection_pending',
+ 'projection_pending', 'projection_by_design',
'projection_status_unknown',
'keyword_count_unavailable',
] as const;
diff --git a/test/doctor-report-remote.serial.test.ts b/test/doctor-report-remote.serial.test.ts
index efda0cfaff..66b0bce58e 100644
--- a/test/doctor-report-remote.serial.test.ts
+++ b/test/doctor-report-remote.serial.test.ts
@@ -261,12 +261,15 @@ describe('run_doctor canonical projection readiness', () => {
auth: { allowedSources: ['readiness-visible', 'readiness-hidden'] },
} as unknown as OperationContext;
const check = (report: DoctorReport) => report.checks.find(c => c.name === 'text_projection_readiness')!;
+ // #6803: doctor also counts the queue by class, within the caller's visible scope.
+ const counts = (pending: number, oldest: number | null) => ({ pending, failed: 0, sealable: 0, sealable_with_visual: 0, reimport: 0, ocr_required: 0,
+ protected: 0, archived: 0, oldest_age_seconds: oldest, as_of: expect.any(String) });
const remote = check(await operationsByName.run_doctor.handler(ctx, {}) as DoctorReport);
expect(remote.status).toBe('ok');
- expect(remote.details).toEqual({ readiness: 'ready', ready: true });
+ expect(remote.details).toEqual({ readiness: 'ready', ready: true, ...counts(0, null) });
const local = check(await operationsByName.run_doctor.handler({ ...ctx, remote: false }, {}) as DoctorReport);
expect(local.status).toBe('warn');
- expect(local.details).toEqual({ readiness: 'projection_pending', ready: false });
+ expect(local.details).toEqual({ readiness: 'projection_pending', ready: false, ...counts(1, expect.any(Number)) });
const restricted = check(await operationsByName.run_doctor.handler({ ...ctx, auth: { ...ctx.auth!, allowedSources: ['readiness-visible'] } }, {}) as DoctorReport);
expect(restricted.status).toBe('ok');
expect(JSON.stringify(restricted)).not.toContain('readiness-hidden');
@@ -274,6 +277,6 @@ describe('run_doctor canonical projection readiness', () => {
await engine.executeRaw("UPDATE pages SET text_projection_revision=NULL WHERE source_id='readiness-visible'");
const pending = check(await operationsByName.run_doctor.handler(ctx, {}) as DoctorReport);
expect(pending.status).toBe('warn');
- expect(pending.details).toEqual({ readiness: 'projection_pending', ready: false });
+ expect(pending.details).toEqual({ readiness: 'projection_pending', ready: false, ...counts(0, null) });
});
});
diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.json
index 968d5d6d52..f77840c6c1 100644
--- a/test/fixtures/goldens/doctor/content-pglite-json.json
+++ b/test/fixtures/goldens/doctor/content-pglite-json.json
@@ -625,7 +625,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -840,8 +840,18 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 0,
+ "protected": 0,
"readiness": "ready",
- "ready": true
+ "ready": true,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
"message": "Visible text projections match their canonical revisions.",
diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
index 2ce1098498..c6155bb5ac 100644
--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
@@ -626,7 +626,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -862,12 +862,59 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 1,
+ "protected": 0,
"readiness": "projection_pending",
- "ready": false
+ "ready": false,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
- "fix_unavailable_reason": "unstructured",
- "message": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "message": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn"
},
@@ -3873,7 +3920,45 @@
"tier": "symptom"
},
{
- "fix": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "action": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "fix": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn",
"tier": "symptom"
@@ -4543,7 +4628,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -4779,12 +4864,59 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 1,
+ "protected": 0,
"readiness": "projection_pending",
- "ready": false
+ "ready": false,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
- "fix_unavailable_reason": "unstructured",
- "message": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "message": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn"
},
@@ -7790,7 +7922,45 @@
"tier": "symptom"
},
{
- "fix": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "action": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "fix": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn",
"tier": "symptom"
diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
index 882cacbef5..06ee0538cd 100644
--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
@@ -620,7 +620,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -865,12 +865,59 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 1,
+ "protected": 0,
"readiness": "projection_pending",
- "ready": false
+ "ready": false,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
- "fix_unavailable_reason": "unstructured",
- "message": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "message": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn"
},
@@ -2060,7 +2107,7 @@
"category": "ops",
"details": {
"depth": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"worker_alive": true
},
"elapsed_ms": "<volatile>",
@@ -3874,7 +3921,45 @@
"tier": "symptom"
},
{
- "fix": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "action": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "fix": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn",
"tier": "symptom"
@@ -4538,7 +4623,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -4783,12 +4868,59 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 1,
+ "protected": 0,
"readiness": "projection_pending",
- "ready": false
+ "ready": false,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
- "fix_unavailable_reason": "unstructured",
- "message": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "fix": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "message": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn"
},
@@ -5978,7 +6110,7 @@
"category": "ops",
"details": {
"depth": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"worker_alive": true
},
"elapsed_ms": "<volatile>",
@@ -7792,7 +7924,45 @@
"tier": "symptom"
},
{
- "fix": "Visible pages have missing or stale text projections; search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
+ "action": {
+ "actor": "agent",
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--limit",
+ "4800",
+ "--brain",
+ "host"
+ ],
+ "command": "gbrain projections drain --limit 4800 --brain host",
+ "consent": [],
+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/repair.md#projection-drain",
+ "next": "run",
+ "preview_argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ],
+ "requires_exclusive": false,
+ "verify": {
+ "argv": [
+ "gbrain",
+ "projections",
+ "drain",
+ "--dry-run",
+ "--json",
+ "--brain",
+ "host"
+ ]
+ },
+ "why": "Rebuilds queued Markdown and code projections and seals importer-attested image pages in place, at most 4800 pages per run; repeat until the dry run shows sealable 0."
+ },
+ "fix": "Visible pages have missing or stale text projections (1 queued Markdown/code page(s)); search and code results may be incomplete. Run `gbrain projections drain` to rebuild queued Markdown and code projections now; it is safe while `gbrain serve` runs on Postgres. For code metadata repair, run `gbrain reindex-code --force --no-embed`. If work stays pending, inspect the recorded source path. No repair or embedding was started by this check.",
"name": "text_projection_readiness",
"status": "warn",
"tier": "symptom"
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index 92472188c0..e86314649d 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -607,7 +607,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -764,8 +764,18 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 0,
+ "protected": 0,
"readiness": "ready",
- "ready": true
+ "ready": true,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
"message": "Visible text projections match their canonical revisions.",
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 9677738d65..6206de0a6a 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -610,7 +610,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -811,8 +811,18 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 0,
+ "protected": 0,
"readiness": "ready",
- "ready": true
+ "ready": true,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
"message": "Visible text projections match their canonical revisions.",
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index 4f1243add9..181e384182 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -604,7 +604,7 @@
"unresolved": {
"distinct_intents": 0,
"distinct_slugs": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"rows": 0
},
"window_days": 7
@@ -814,8 +814,18 @@
{
"category": "brain",
"details": {
+ "archived": 0,
+ "as_of": "<ts>+00",
+ "failed": 0,
+ "ocr_required": 0,
+ "oldest_age_seconds": "<volatile>",
+ "pending": 0,
+ "protected": 0,
"readiness": "ready",
- "ready": true
+ "ready": true,
+ "reimport": 0,
+ "sealable": 0,
+ "sealable_with_visual": 0
},
"elapsed_ms": "<volatile>",
"message": "Visible text projections match their canonical revisions.",
@@ -1807,7 +1817,7 @@
"category": "ops",
"details": {
"depth": 0,
- "oldest_age_seconds": null,
+ "oldest_age_seconds": "<volatile>",
"worker_alive": true
},
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.json
index 837d29a390..73570606a9 100644
--- a/test/fixtures/goldens/exports/types.json
+++ b/test/fixtures/goldens/exports/types.json
@@ -487,7 +487,7 @@
"kind": "variable",
"name": "DEGRADED_STAGES",
"signature": [
- "readonly [\"embed_unavailable\", \"embed_timeout\", \"expansion_failed\", \"expansion_partial\", \"rescore_skipped\", \"vector_arm_failed\", \"keyword_arm_failed\", \"title_arm_failed\", \"budget_dropped_all\", \"budget_truncated\", \"keyword_zero\", \"cache_prestamp\", \"reranker_skipped\", \"rerank_passthrough\", \"rerank_failed\", \"keyword_relaxed_carried\", \"safe_index_pending\", \"vector_candidates_incomplete\", \"keyword_candidates_incomplete\", \"projection_pending\", \"projection_status_unknown\", \"keyword_count_unavailable\"]"
+ "readonly [\"embed_unavailable\", \"embed_timeout\", \"expansion_failed\", \"expansion_partial\", \"rescore_skipped\", \"vector_arm_failed\", \"keyword_arm_failed\", \"title_arm_failed\", \"budget_dropped_all\", \"budget_truncated\", \"keyword_zero\", \"cache_prestamp\", \"reranker_skipped\", \"rerank_passthrough\", \"rerank_failed\", \"keyword_relaxed_carried\", \"safe_index_pending\", \"vector_candidates_incomplete\", \"keyword_candidates_incomplete\", \"projection_pending\", \"projection_by_design\", \"projection_status_unknown\", \"keyword_count_unavailable\"]"
]
},
{
@@ -501,14 +501,14 @@
"kind": "type",
"name": "DegradedStage",
"signature": [
- "\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
+ "\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_by_design\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
]
},
{
"kind": "interface",
"members": [
"reason?: \"candidate_budget\" | \"iterative_scan_unavailable\" | \"no_provider\" | \"provider_error\" | \"timeout\" | \"variant_embed_failed\" | \"original_embed_failed\" | \"first_result_truncated\" | \"no_key\" | \"empty_result_set\" | \"malformed_shape\" | \"budget\" | \"rate_limited\" | \"unreachable\" | \"auth\" | \"egress_denied\" | \"embedding_disabled\" | \"skipped_after_timeout\" | undefined",
- "stage: \"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
+ "stage: \"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_by_design\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
],
"name": "DegradedStageEntry"
},
@@ -1297,7 +1297,7 @@
"kind": "variable",
"name": "RANKING_ONLY_DEGRADED_STAGES",
"signature": [
- "ReadonlySet<\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_status_unknown\" | \"keyword_count_unavailable\">"
+ "ReadonlySet<\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_by_design\" | \"projection_status_unknown\" | \"keyword_count_unavailable\">"
]
},
{
@@ -8553,7 +8553,7 @@
"kind": "variable",
"name": "DEGRADED_STAGES",
"signature": [
- "readonly [\"embed_unavailable\", \"embed_timeout\", \"expansion_failed\", \"expansion_partial\", \"rescore_skipped\", \"vector_arm_failed\", \"keyword_arm_failed\", \"title_arm_failed\", \"budget_dropped_all\", \"budget_truncated\", \"keyword_zero\", \"cache_prestamp\", \"reranker_skipped\", \"rerank_passthrough\", \"rerank_failed\", \"keyword_relaxed_carried\", \"safe_index_pending\", \"vector_candidates_incomplete\", \"keyword_candidates_incomplete\", \"projection_pending\", \"projection_status_unknown\", \"keyword_count_unavailable\"]"
+ "readonly [\"embed_unavailable\", \"embed_timeout\", \"expansion_failed\", \"expansion_partial\", \"rescore_skipped\", \"vector_arm_failed\", \"keyword_arm_failed\", \"title_arm_failed\", \"budget_dropped_all\", \"budget_truncated\", \"keyword_zero\", \"cache_prestamp\", \"reranker_skipped\", \"rerank_passthrough\", \"rerank_failed\", \"keyword_relaxed_carried\", \"safe_index_pending\", \"vector_candidates_incomplete\", \"keyword_candidates_incomplete\", \"projection_pending\", \"projection_by_design\", \"projection_status_unknown\", \"keyword_count_unavailable\"]"
]
},
{
@@ -8567,14 +8567,14 @@
"kind": "type",
"name": "DegradedStage",
"signature": [
- "\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
+ "\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_by_design\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
]
},
{
"kind": "interface",
"members": [
"reason?: \"candidate_budget\" | \"iterative_scan_unavailable\" | \"no_provider\" | \"provider_error\" | \"timeout\" | \"variant_embed_failed\" | \"original_embed_failed\" | \"first_result_truncated\" | \"no_key\" | \"empty_result_set\" | \"malformed_shape\" | \"budget\" | \"rate_limited\" | \"unreachable\" | \"auth\" | \"egress_denied\" | \"embedding_disabled\" | \"skipped_after_timeout\" | undefined",
- "stage: \"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
+ "stage: \"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_by_design\" | \"projection_status_unknown\" | \"keyword_count_unavailable\""
],
"name": "DegradedStageEntry"
},
@@ -9117,7 +9117,7 @@
"kind": "variable",
"name": "RANKING_ONLY_DEGRADED_STAGES",
"signature": [
- "ReadonlySet<\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_status_unknown\" | \"keyword_count_unavailable\">"
+ "ReadonlySet<\"embed_unavailable\" | \"embed_timeout\" | \"expansion_failed\" | \"expansion_partial\" | \"rescore_skipped\" | \"vector_arm_failed\" | \"keyword_arm_failed\" | \"title_arm_failed\" | \"budget_dropped_all\" | \"budget_truncated\" | \"keyword_zero\" | \"cache_prestamp\" | \"reranker_skipped\" | \"rerank_passthrough\" | \"rerank_failed\" | \"keyword_relaxed_carried\" | \"safe_index_pending\" | \"vector_candidates_incomplete\" | \"keyword_candidates_incomplete\" | \"projection_pending\" | \"projection_by_design\" | \"projection_status_unknown\" | \"keyword_count_unavailable\">"
]
},
{
diff --git a/test/helpers/doctor-json-golden.ts b/test/helpers/doctor-json-golden.ts
index b3a2224708..6b22e7a643 100644
--- a/test/helpers/doctor-json-golden.ts
+++ b/test/helpers/doctor-json-golden.ts
@@ -144,7 +144,7 @@ export function patchConfig(h: DoctorHome, patch: (cfg: Record<string, unknown>)
}
const UUID = /\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi;
-const VOLATILE_KEYS = /(^|_)(ms|pid|elapsed|duration|uptime)$|_ms$|^elapsed|^table_bytes$/i;
+const VOLATILE_KEYS = /(^|_)(ms|pid|elapsed|duration|uptime)$|_ms$|^elapsed|^table_bytes$|^oldest_age_seconds$/i;
export function normalizeDoctorText(text: string, roots: Record<string, string>, extra: Array<[RegExp | string, string]> = []): string {
let out = scrubPaths(text, roots);
diff --git a/test/projection-readiness.test.ts b/test/projection-readiness.test.ts
index 7023e4d009..93bf53fa75 100644
--- a/test/projection-readiness.test.ts
+++ b/test/projection-readiness.test.ts
@@ -129,7 +129,8 @@ describe('canonical projection readiness', () => {
await seed('code');
const pending = await checkProjectionReadiness(engine, { sourceId: 'source-a' });
expect(pending.status).toBe('warn');
- expect(pending.details).toEqual({ readiness: 'projection_pending', ready: false });
+ expect(pending.details).toEqual({ readiness: 'projection_pending', ready: false, pending: 1, failed: 0, sealable: 0, sealable_with_visual: 0,
+ reimport: 0, ocr_required: 0, protected: 0, archived: 0, oldest_age_seconds: expect.any(Number), as_of: expect.any(String) });
expect(JSON.stringify(pending)).not.toContain('source-a');
const unknown = await checkProjectionReadiness({ executeRaw: async () => { throw new Error('private connection'); } } as any);
expect(unknown.status).toBe('warn');
diff --git a/test/search-projection-readiness.test.ts b/test/search-projection-readiness.test.ts
index e230a2438c..5f55606b59 100644
--- a/test/search-projection-readiness.test.ts
+++ b/test/search-projection-readiness.test.ts
@@ -50,6 +50,20 @@ describe('search operations disclose visible projection gaps', () => {
expect(retrieval.projection_readiness).toMatchObject({ status: 'projection_pending', ready: false });
});
+ test('an unsealed protected-OCR image alone is disclosed as by design, not pending', async () => {
+ await sealed();
+ await engine.putPage('images/protected-example.png', {
+ type: 'image', page_kind: 'image', title: 'protected-example.png',
+ compiled_truth: '<!--- gbrain:takes:begin -->\nSYNTHETIC_PROTECTED\n<!--- gbrain:takes:end -->',
+ }, { sourceId });
+ const rows = await operationsByName.search.handler(context(true), { query: 'readinessmarker', source_id: sourceId });
+ expect(rows).toHaveLength(1);
+ expect(retrieval.projection_readiness).toMatchObject({ status: 'by_design', ready: true });
+ expect(retrieval.degraded).toContainEqual({ stage: 'projection_by_design' });
+ expect(retrieval.degraded).not.toContainEqual({ stage: 'projection_pending' });
+ expect(JSON.stringify(retrieval)).not.toContain('SYNTHETIC_PROTECTED');
+ });
+
test('pending pages outside the requested source do not affect readiness', async () => {
await sealed();
await engine.putPage('notes/foreign-pending', { type: 'note', title: 'Foreign example', compiled_truth: 'readinessmarker' }, { sourceId: foreign });