Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix: pre-landing review fixes

garrytaned405afed91b
diff --git a/changelog.d/capy-w-a1-trust-purge-secret-scan.md b/changelog.d/capy-w-a1-trust-purge-secret-scan.md
index b6afab8adc..e7884916ee 100644
--- a/changelog.d/capy-w-a1-trust-purge-secret-scan.md
+++ b/changelog.d/capy-w-a1-trust-purge-secret-scan.md
@@ -4,11 +4,11 @@ important: security
**Model-written Life Chronicle events no longer read as your own notes after a trust claim, legacy bearer tokens keep their tools when the default MCP surface is narrowed, every way a page is hard-deleted now clears what the page left in six side tables, the secret scan catches passwords in escaped JSON and URL-encoded values, and the drift report records where it came from.** Community wave W-A1: bug reports verified on master and fixed with our own code.
### Fixed
-- **Trust claim and legacy chronicle events (#9284).** `gbrain trust claim-sources` lifted legacy Life Chronicle event pages (`captured_via: life-chronicle:auto`) to "your notes", even when the page they summarise is an imported third-party email, so remote agents got a model summary of a stranger's text unquoted. The chronicle capture kind is now capped at agent_written, and a claim never puts an event above its depth page's tier. `--relower --source <id>` can lower what a claim lifted even after `sources set-trust` ended that claim. Lowering never raises a row and never changes who can read a page. Rows already lifted change only when you run the relower; `gbrain doctor` counts them and names the dry-run command.
+- **Trust claim and legacy chronicle events (#9284).** `gbrain trust claim-sources` lifted legacy Life Chronicle event pages (`captured_via: life-chronicle:auto`) to "your notes", even when the page they summarise is an imported third-party email, so remote agents got a model summary of a stranger's text unquoted. The chronicle capture kind is now capped at agent_written, and a claim never puts an event above its depth page's tier, including a depth page the same claim classifies for the first time. `--relower --source <id>` can lower what a claim lifted even after `sources set-trust` ended that claim. Lowering never raises a row and never changes who can read a page. Rows already lifted change only when you run the relower; `gbrain doctor` counts them and names the dry-run command.
- **Legacy bearer tokens and `mcp.default_surface_dcr` (#9266).** Setting the DCR default surface also narrowed legacy bearer tokens, which have no client row to pre-seed, so they lost tools their grants allowed. Legacy tokens now keep the server surface (still bounded by their scope, source and operation grants, and still clamped by `GBRAIN_MCP_FORCE_SURFACE`); OAuth clients with no surface row still get the default. Doctor and the advisor already reported it this way.
-- **Purge leftovers (#9146).** Only `delete --purge` removed a page's proposed takes, open loops, core-edit notice text, aliases, redirects and rename rows. Tombstone expiry (including after a managed connector delete), the batch delete connectors use and a restore that replays a purge now remove them too, as does source removal for the two tables that did not cascade. Write-gate holds go with the page, except a hold that arrived after the soft delete, which is a new pending write and stays until its own disposition. Works the same on brains with no repository.
-- **Secret scan (#8265).** The high-entropy assignment detector missed a password whose key quote is escaped (JSON inside a JSON string) and one after a URL-encoded `%3D`/`%3A` separator. Both are caught, ordinary query strings and encoded URLs are not. New transcript imports redact both shapes; pages imported before are not rewritten, so `gbrain doctor` asks once for a read-only, model-free transcript re-audit that lists them.
-- **Drift report provenance (#9208).** The dream drift phase wrote `reports/drift-<date>` with no derivation, so it was stored at tier unknown with no origin. It now records a `derive:drift` origin and takes the tier of the pages it judged, capped at agent_written.
+- **Purge leftovers (#9146).** Only `delete --purge` removed a page's proposed takes, open loops, core-edit notice text, aliases, redirects and rename rows. Tombstone expiry (including after a managed connector delete), the batch delete connectors use and a restore that replays a purge now remove them too, as does source removal for the two tables that did not cascade. Write-gate holds go with the page, except a hold that arrived, or was re-opened by the same content arriving again, after the soft delete, which is a new pending write and stays until its own disposition. Works the same on brains with no repository.
+- **Secret scan (#8265).** The high-entropy assignment detector missed a password whose key quote is escaped (JSON inside a JSON string) and one after a URL-encoded `%3D`/`%3A` separator. Both are caught, ordinary query strings and encoded URLs are not, and an encoded URL that carries a username and password still is. New transcript imports redact both shapes; pages imported before are not rewritten, so `gbrain doctor` asks once for a read-only, model-free transcript re-audit that lists them.
+- **Drift report provenance (#9208).** The dream drift phase wrote `reports/drift-<date>` with no derivation, so it was stored at tier unknown with no origin. It now records a `derive:drift` origin and takes the lowest tier of the pages, takes and timeline entries the judge read, capped at agent_written, with each of them recorded as an input.
<!-- behavior-change: chronicle_events_trust_cap_9284 -->
<!-- behavior-change: audit_secrets_escaped_encoded_8265 -->
diff --git a/src/core/cycle/drift.ts b/src/core/cycle/drift.ts
index eebfb86dc3..ba1d64693d 100644
--- a/src/core/cycle/drift.ts
+++ b/src/core/cycle/drift.ts
@@ -233,25 +233,27 @@ async function findDriftCandidates(
}));
}
-/** Format the candidate page's recent timeline entries as judge evidence. */
+/** Format the candidate page's recent timeline entries as judge evidence, with the ids of the rows it quotes. */
async function loadEvidence(
engine: BrainEngine,
pageId: number,
cutoffIso: string,
-): Promise<string> {
- const rows = await engine.executeRaw<{ date: string; source: string; summary: string }>(
- `SELECT date::text AS date, source, summary FROM timeline_entries
+): Promise<{ text: string; ids: number[] }> {
+ const rows = await engine.executeRaw<{ id: number | string; date: string; source: string; summary: string }>(
+ `SELECT id, date::text AS date, source, summary FROM timeline_entries
WHERE page_id = $1 AND date >= $2::date
ORDER BY date DESC LIMIT 12`,
[pageId, cutoffIso],
);
- if (rows.length === 0) return '(no timeline entries in window)';
- return rows.map(r => `- ${r.date} [${r.source}] ${r.summary}`).join('\n');
+ if (rows.length === 0) return { text: '(no timeline entries in window)', ids: [] };
+ return { text: rows.map(r => `- ${r.date} [${r.source}] ${r.summary}`).join('\n'), ids: rows.map(r => Number(r.id)) };
}
interface JudgedCandidate {
candidate: DriftCandidate;
verdict: DriftVerdict;
+ /** The timeline rows the judge's prompt quoted. */
+ evidenceIds: number[];
}
function buildReportBody(
@@ -343,7 +345,7 @@ export async function runPhaseDrift(
let budgetExhausted = false;
let failed = 0;
for (const candidate of candidates.slice(0, config.maxPerCycle)) {
- const evidence = await loadEvidence(engine, candidate.pageId, cutoffIso);
+ const { text: evidence, ids: evidenceIds } = await loadEvidence(engine, candidate.pageId, cutoffIso);
const check = meter.check({
modelId,
// ~4 chars per token over the prompt the judge actually sends.
@@ -357,7 +359,7 @@ export async function runPhaseDrift(
}
try {
const verdict = await judge({ candidate, evidence, modelHint: modelId, maxOutputTokens });
- judged.push({ candidate, verdict });
+ judged.push({ candidate, verdict, evidenceIds });
} catch (e) {
failed += 1;
process.stderr.write(`[drift] judge failed on take ${candidate.takeId}: ${(e as Error).message}\n`);
@@ -373,7 +375,8 @@ export async function runPhaseDrift(
// Typed `note` (+ report_type) so the default pack declares it (#5881).
// Lands in the default source (brain-global artifact, same-day re-runs
// upsert the same slug).
- const derivation = await deriveTrust(engine, [...new Set(judged.map(j => j.candidate.pageId))].map(id => ({ table: 'pages' as const, id })),
+ const derivation = await deriveTrust(engine, judged.flatMap(j => [{ table: 'pages' as const, id: j.candidate.pageId },
+ { table: 'takes' as const, id: j.candidate.takeId }, ...j.evidenceIds.map(id => ({ table: 'timeline_entries' as const, id }))]),
{ channel: 'derive:drift' });
if (maintenance) {
const snapshot = await engine.readPageSnapshot(reportSlug, { sourceId: 'default' });
diff --git a/src/core/persistence/purge-slug-stores.ts b/src/core/persistence/purge-slug-stores.ts
index 288b5c165b..b4e12baf91 100644
--- a/src/core/persistence/purge-slug-stores.ts
+++ b/src/core/persistence/purge-slug-stores.ts
@@ -35,8 +35,8 @@ export async function scrubPurgedSlugStores(
/**
* #9146: the write-gate holds of hard-deleted pages and their receipts. An immediate hard delete drops every hold of
* the slug, as the direct purge does. A tombstone expiry passes each page's `deletedAt` (text, so microseconds
- * survive) and drops only holds created up to it: a hold that arrived after the soft delete is a later write, kept
- * for review.
+ * survive) and drops only holds last seen up to it: a hold that arrived, or was re-opened by the same content
+ * arriving again, after the soft delete is a later write, kept for review.
*/
export async function scrubPurgedSlugHolds(
engine: Pick<BrainEngine, 'executeRaw'>,
@@ -45,7 +45,7 @@ export async function scrubPurgedSlugHolds(
): Promise<{ write_gate_holds: number; write_gate_receipts: number }> {
if (!pages.length) return { write_gate_holds: 0, write_gate_receipts: 0 };
const holds = (await engine.executeRaw<{ id: string }>(`DELETE FROM write_gate_holds h USING unnest($2::text[], $3::timestamptz[]) AS d(slug, upto)
- WHERE h.source_id = $1 AND h.slug = d.slug AND (d.upto IS NULL OR h.created_at <= d.upto) RETURNING h.id::text AS id`,
+ WHERE h.source_id = $1 AND h.slug = d.slug AND (d.upto IS NULL OR GREATEST(h.created_at, h.last_seen_at) <= d.upto) RETURNING h.id::text AS id`,
[sourceId, pages.map(p => p.slug), pages.map(p => p.deletedAt ?? null)])).map(h => h.id);
const receipts = holds.length ? (await engine.executeRaw("DELETE FROM write_gate_receipts WHERE target_table = 'write_gate_holds' AND target_id = ANY($1::text[]) RETURNING 1", [holds])).length : 0;
return { write_gate_holds: holds.length, write_gate_receipts: receipts };
diff --git a/src/core/secret-scan-assignment.ts b/src/core/secret-scan-assignment.ts
index e6cf4afef7..03cc902064 100644
--- a/src/core/secret-scan-assignment.ts
+++ b/src/core/secret-scan-assignment.ts
@@ -89,7 +89,9 @@ export const HIGH_ENTROPY_REQUIRES_NON_DIGIT_RE = /[^0-9]/;
// value never takes `%26` (the next encoded parameter; `&` is outside both
// classes), and a quoted value never opens there. The escapes and the encoded
// separator sit in group 1, so offsets and fingerprints stay on the stored
-// bytes. A URL-encoded URL (`https%3A%2F%2F…`) is a reference like a plain one.
+// bytes. A URL-encoded URL (`https%3A%2F%2F…`) is a reference like a plain one,
+// unless it carries userinfo (`%40`): the plain form's userinfo is caught by
+// db_url_credentials, which never sees the encoded form.
export const assignmentKey = (boundary: string) =>
`${boundary}(?:(?:secret|token|passwd|password|passphrase|credential|api[_-]?key|apikey)[A-Za-z0-9_-]{0,64}|[A-Za-z][A-Za-z0-9_-]{0,63}[_-]key)(?:\\\\{0,3}["'])?(?:\\s*[:=]\\s*|%3[AaDd])`;
export const ASSIGNMENT_QUOTED_SOURCE = (key: string) => `(${key}(?<!%3[AaDd])\\\\{0,3}["'])([^"'\\s]{11,4095}[^"'\\s\\\\])`;
@@ -114,7 +116,8 @@ const DOTTED_IDENTIFIER_RE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/;
* with a letter is the accepted miss.
*/
export function assignmentValueIsSecretShaped(value: string): boolean {
- if (/^[A-Za-z][A-Za-z0-9+.-]{0,31}(?::\/\/|%3A%2F%2F)/i.test(value)) return false;
+ if (/^[A-Za-z][A-Za-z0-9+.-]{0,31}:\/\//.test(value)) return false;
+ if (/^[A-Za-z][A-Za-z0-9+.-]{0,31}%3A%2F%2F/i.test(value) && !/%40/i.test(value)) return false;
if (value.startsWith('./') || value.startsWith('~/') || value.startsWith('${') || value.startsWith('$(')) return false;
if (value.startsWith('<REDACTED:') || DOTTED_IDENTIFIER_RE.test(value)) return false;
return !(value.startsWith('/') && !LEGACY_ASSIGNMENT_VALUE_RE.test(value));
diff --git a/src/core/trust/backfill.ts b/src/core/trust/backfill.ts
index f30d93dc63..8991385972 100644
--- a/src/core/trust/backfill.ts
+++ b/src/core/trust/backfill.ts
@@ -182,17 +182,20 @@ function classifier(cols: Columns, assumeClaimed: readonly string[] = [], ceilin
const least = (terms: string[]) => (terms.length ? `LEAST(${terms.join(', ')})` : 'NULL::int');
/**
* #9284: a legacy Life Chronicle event is model-extracted from its depth page (`event.depth`, a live page in the
- * same source), so it ranks no higher than that page: its stored tier (when classified) and its frontmatter caps.
- * A missing depth page adds no cap (the event's own agent_written cap still applies).
+ * same source), so it ranks no higher than that page: its stored tier and frontmatter caps when classified, else
+ * what the same statement classifies it as (its frontmatter caps and page signals: source kind, connector source,
+ * write request), since an UPDATE reads the depth page as it was before. A missing depth page adds no cap (the
+ * event's own agent_written cap still applies).
*/
- const chronicleDepthCap = (p: string) => {
- const d = 'chronicle_depth';
+ const chronicleDepthCap = (p: string, s: string) => {
+ const d = 'chronicle_depth', dr = 'chronicle_depth_r';
const depthCaps = least(frontmatterTrustCapsSql(`${d}.frontmatter`));
+ const projected = least([...frontmatterTrustCapsSql(`${d}.frontmatter`), ...pageTerms(d, s, dr)]);
return `CASE WHEN ${p}.type = 'event' AND jsonb_typeof(${p}.frontmatter->'captured_via') = 'string'
AND ${edgeTrimSql(`${p}.frontmatter->>'captured_via'`)} = '${CHRONICLE_CAPTURED_VIA}'
AND jsonb_typeof(${p}.frontmatter->'event') = 'object' AND jsonb_typeof(${p}.frontmatter->'event'->'depth') = 'string'
- THEN (SELECT ${cols.has('pages', 'trust_tier') ? `CASE WHEN ${d}.trust_tier <> 'unknown' THEN LEAST(${trustRankSql(`${d}.trust_tier`)}, ${depthCaps}) ELSE ${depthCaps} END` : depthCaps}
- FROM pages ${d} WHERE ${d}.source_id = ${p}.source_id AND ${d}.slug = ${p}.frontmatter->'event'->>'depth'${cols.has('pages', 'deleted_at') ? ` AND ${d}.deleted_at IS NULL` : ''}
+ THEN (SELECT ${cols.has('pages', 'trust_tier') ? `CASE WHEN ${d}.trust_tier <> 'unknown' THEN LEAST(${trustRankSql(`${d}.trust_tier`)}, ${depthCaps}) ELSE ${projected} END` : projected}
+ FROM pages ${d} ${requestJoin('pages', 'revision_write_request_id', dr, d)} WHERE ${d}.source_id = ${p}.source_id AND ${d}.slug = ${p}.frontmatter->'event'->>'depth'${cols.has('pages', 'deleted_at') ? ` AND ${d}.deleted_at IS NULL` : ''}
LIMIT 1) END`;
};
/**
@@ -204,7 +207,7 @@ function classifier(cols: Columns, assumeClaimed: readonly string[] = [], ceilin
const terms = pageTerms(p, s, r);
const c = claimed(s);
if (!c) return least(terms);
- const caps = cols.has('pages', 'frontmatter') ? [...frontmatterTrustCapsSql(`${p}.frontmatter`), chronicleDepthCap(p)] : [];
+ const caps = cols.has('pages', 'frontmatter') ? [...frontmatterTrustCapsSql(`${p}.frontmatter`), chronicleDepthCap(p, s)] : [];
return `CASE WHEN ${c} AND ${legacyRowSql('pages', p, ceilings)} THEN ${least([String(rank('operator_curated')), ...caps, ...terms])} ELSE ${least(terms)} END`;
};
const hasTrust = cols.has('pages', 'trust_tier');
diff --git a/test/drift-report-derivation-9208.test.ts b/test/drift-report-derivation-9208.test.ts
index 0652d2ac16..44e87dd850 100644
--- a/test/drift-report-derivation-9208.test.ts
+++ b/test/drift-report-derivation-9208.test.ts
@@ -43,9 +43,11 @@ beforeEach(async () => {
await resetPgliteState(engine);
});
-async function seed(engine: BrainEngine, tier: TrustTier) {
- await engine.transaction(tx => withWriteTrust(tx, { tier, origin: { channel: 'sync' } }, async () => {
- const page = await tx.putPage('people/alice-example', { type: 'person', title: 'Alice Example', compiled_truth: 'A person at Acme.', timeline: '', frontmatter: {} });
+/** The judged page at `tier`; its take and timeline evidence at `rowsTier` (default: the page's). */
+async function seed(engine: BrainEngine, tier: TrustTier, rowsTier: TrustTier = tier) {
+ const page = await engine.transaction(tx => withWriteTrust(tx, { tier, origin: { channel: 'sync' } }, () =>
+ tx.putPage('people/alice-example', { type: 'person', title: 'Alice Example', compiled_truth: 'A person at Acme.', timeline: '', frontmatter: {} })));
+ await engine.transaction(tx => withWriteTrust(tx, { tier: rowsTier, origin: { channel: 'sync' } }, async () => {
await tx.addTakesBatch([{ page_id: page.id, row_num: 1, claim: 'Acme will ship the widget this year', kind: 'take', holder: 'world', weight: 0.6 }]);
await tx.addTimelineEntriesBatch([{ slug: 'people/alice-example', date: '2031-04-10', source: 'meeting', summary: 'Widget launch slipped' }]);
}));
@@ -85,4 +87,20 @@ describe('#9208 drift report carries a derive:drift derivation', () => {
}, { setup: ({ engine }) => seed(engine, input) });
}, 180_000);
}
+
+ test('the take and timeline evidence the judge read cap the report and are its recorded inputs', async () => {
+ await seed(engine, 'operator_curated', 'external_untrusted');
+ const [take] = await engine.executeRaw<{ trust_tier: string }>('SELECT trust_tier FROM takes');
+ expect(take!.trust_tier).toBe('external_untrusted');
+ expect(await drift(engine)).toEqual({ tier: 'external_untrusted', channel: 'derive:drift' });
+ const inputs = await engine.executeRaw<{ input_table: string }>(`SELECT DISTINCT d.input_table FROM derivation_inputs d
+ JOIN pages p ON d.derived_table = 'pages' AND d.derived_id = p.id::text WHERE p.slug = $1 ORDER BY 1`, [REPORT]);
+ expect(inputs.map(r => r.input_table)).toEqual(['pages', 'takes', 'timeline_entries']);
+ }, 120_000);
+
+ test('managed: the take and timeline evidence the judge read cap the report', async () => {
+ await managedBrain(async ({ engine }) => {
+ expect(await drift(engine)).toEqual({ tier: 'external_untrusted', channel: 'derive:drift' });
+ }, { setup: ({ engine }) => seed(engine, 'operator_curated', 'external_untrusted') });
+ }, 180_000);
});
diff --git a/test/purge-slug-stores-9146.test.ts b/test/purge-slug-stores-9146.test.ts
index a9f6bc4026..fcd10bbf1d 100644
--- a/test/purge-slug-stores-9146.test.ts
+++ b/test/purge-slug-stores-9146.test.ts
@@ -53,10 +53,10 @@ const ctx = (engine: BrainEngine): OperationContext => ({ engine, sourceId: 'def
logger: { info() {}, warn() {}, error() {} } } as OperationContext);
const op = (name: string) => operations.find(o => o.name === name)!;
-/** A write-gate hold for the slug created `ago` before now, labelled `when`, with its receipt. */
+/** A write-gate hold for the slug created and last seen `ago` before now, labelled `when`, with its receipt. */
async function hold(engine: BrainEngine, sourceId: string, slug: string, when: string, ago = '0 seconds') {
- const [row] = await engine.executeRaw<{ id: string }>(`INSERT INTO write_gate_holds (kind, source_id, slug, fingerprint, detector_version, tier, payload, created_at)
- VALUES ('fact', $1, $2, $3, 1, 'quarantine', $4::text::jsonb, now() - $5::interval) RETURNING id::text AS id`,
+ const [row] = await engine.executeRaw<{ id: string }>(`INSERT INTO write_gate_holds (kind, source_id, slug, fingerprint, detector_version, tier, payload, created_at, last_seen_at)
+ VALUES ('fact', $1, $2, $3, 1, 'quarantine', $4::text::jsonb, now() - $5::interval, now() - $5::interval) RETURNING id::text AS id`,
[sourceId, slug, randomUUID(), JSON.stringify({ when }), ago]);
await engine.executeRaw(`INSERT INTO write_gate_receipts (target_table, target_id, source_id, content_hash, tier, detector_version, verdict, request_id)
VALUES ('write_gate_holds', $1, $2, $3, 'quarantine', 1, 'quarantine', $4)`, [row.id, sourceId, randomUUID(), `${slug}|${when}`]);
@@ -150,6 +150,23 @@ describe('#9146 every hard delete removes the page\'s slug-keyed stores', () =>
}
}), 120_000);
+ test('(B) the expired-tombstone purge keeps a hold the same content re-opened after the soft delete', () => withEnv({ GBRAIN_HOME: home }, async () => {
+ for (const engine of engines) {
+ const slug = 'people/erin-example';
+ await seed(engine, slug);
+ await engine.softDeletePage(slug, { sourceId: 'default' });
+ await engine.executeRaw(`UPDATE write_gate_holds SET status = 'held', last_seen_at = now(), seen_count = seen_count + 1,
+ payload = jsonb_set(payload, '{when}', '"reopened"') WHERE source_id = 'default' AND slug = $1`, [slug]);
+ await engine.executeRaw(`UPDATE write_gate_receipts SET request_id = $1 WHERE target_table = 'write_gate_holds'
+ AND target_id IN (SELECT id::text FROM write_gate_holds WHERE source_id = 'default' AND slug = $2)`, [`${slug}|reopened`, slug]);
+ const purged = await purgeDeletedPagesCoordinated(engine, 0);
+ expect(purged.slugs).toContain(slug);
+ expect({ engine: engine.kind, residue: await residue(engine, slug) })
+ .toEqual({ engine: engine.kind, residue: only(['source-b'], ['default:reopened', 'source-b:before']) });
+ await otherUntouched(engine);
+ }
+ }), 120_000);
+
test('(D) the batch deletePages scrubs the rows and the slug\'s holds', () => withEnv({ GBRAIN_HOME: home }, async () => {
for (const engine of engines) {
const slug = 'people/carol-example';
diff --git a/test/secret-scan-encoded-assignment-8265.test.ts b/test/secret-scan-encoded-assignment-8265.test.ts
index 2f0d10988b..10b61a38b1 100644
--- a/test/secret-scan-encoded-assignment-8265.test.ts
+++ b/test/secret-scan-encoded-assignment-8265.test.ts
@@ -66,6 +66,12 @@ describe('#8265 URL-encoded separators', () => {
expect(redactFindings(`client_secret%3D${v}%26x%3D1`, OPTS).text).toBe(`client_secret%3D${MARK}%26x%3D1`);
});
+ test('a URL-encoded URL that carries userinfo is still claimed', () => {
+ const v = secret();
+ expect(found(`password=postgres%3A%2F%2Fu%3A${v}%40db.example%2Fapp`)).toContain('high_entropy_assignment');
+ expect(found(`api_key%3Dhttps%3A%2F%2Fu%3A${v}%40x.example`)).toContain('high_entropy_assignment');
+ });
+
test('a plain separator still keeps a %26 that sits inside the value', () => {
const v = `${alnum(10)}%26${alnum(10)}4`;
expect(redactFindings(`password=${v} next`, OPTS).text).toBe(`password=${MARK} next`);
diff --git a/test/trust-claim-chronicle-9284.test.ts b/test/trust-claim-chronicle-9284.test.ts
index 7d921fc5d6..55f3df2b37 100644
--- a/test/trust-claim-chronicle-9284.test.ts
+++ b/test/trust-claim-chronicle-9284.test.ts
@@ -102,6 +102,17 @@ for (const backend of testBackends()) {
expect((await relowerClaimedRows(engine, { dryRun: true })).rows).toBe(0);
}, 120_000);
+ test('an unclassified depth page caps its event by the tier the same claim gives it, not by its old snapshot', async () => {
+ await source('source-w');
+ const depth = await page('source-w', 'inbox/acme-example-webhook', 'note', {});
+ await engine.executeRaw("UPDATE pages SET source_kind = 'webhook' WHERE id = $1", [depth]);
+ const event = await page('source-w', 'life/events/2026-09-09-ffff6666', 'event', eventFm('inbox/acme-example-webhook'));
+ await recordSourceClaims(engine, ['source-w']);
+ await liftClaimedSources(engine);
+ expect((await tier('pages', depth)).t).toBe('external_untrusted');
+ expect((await tier('pages', event)).t).toBe('external_untrusted');
+ }, 120_000);
+
test('relower lowers an event a claim already lifted to its depth page tier, and doctor counts it with the dry-run command', async () => {
await source('source-b');
const depth = await page('source-b', 'email/acme-example-inbound', 'email', {});