Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(guards): the unmanaged connector fence carry reads inline pages only (#7292)

garrytan10d1ffb67469
diff --git a/scripts/page-body-readers-baseline.tsv b/scripts/page-body-readers-baseline.tsv
index b3a74bb6be..e37a393c42 100644
--- a/scripts/page-body-readers-baseline.tsv
+++ b/scripts/page-body-readers-baseline.tsv
@@ -270,6 +270,9 @@ src/core/fence-repair/repair-tiers.ts holderAt field STREAM
src/core/fence-repair/tier1.ts pageHasFenceText field STREAM
src/core/fts-language.ts pageSearchVectorTriggerFnSql sql LEAD
src/core/google/loops-extract.ts runLoopsExtract field STREAM tail slice(-12000) of a getPage body; per-job: segmented page: getter throws page_body_segmented
+src/core/google/sweep-shared.ts carryStoredFences call:serializePageToMarkdown INLINE asserts inline (assertInlineBody); importRendered refuses a segmented page first
+src/core/google/sweep-shared.ts carryStoredFences field INLINE asserts inline (assertInlineBody); importRendered refuses a segmented page first
+src/core/google/sweep-shared.ts withStoredFactsFence field INLINE asserts inline (assertInlineBody); importRendered refuses a segmented page first
src/core/import-file.ts applyImportTransaction call:putPage SEGW lane 1d file (streaming ingest); code/image pages inline
src/core/import-file.ts importCodeFile call:putPage SEGW lane 1d file (streaming ingest); code/image pages inline
src/core/import-file.ts importFromContent call:contentHash META lane 1d file
diff --git a/src/core/google/sweep-shared.ts b/src/core/google/sweep-shared.ts
index 409289a9a7..aae0b0d6f7 100644
--- a/src/core/google/sweep-shared.ts
+++ b/src/core/google/sweep-shared.ts
@@ -135,7 +135,9 @@ const hasFence = (text: string | null | undefined) => [FACTS_FENCE_BEGIN, TAKES_
* `connector_fence_below_timeline` instead of expiring its rows.
*/
async function carryStoredFences(sourceId: string, slug: string, relPath: string, existing: Page | null, markdown: string): Promise<string> {
- if (!existing || !(hasFence(existing.compiled_truth) || hasFence(existing.timeline))) return markdown;
+ if (!existing) return markdown;
+ assertInlineBody(existing, 'Google connector fence carry');
+ if (!(hasFence(existing.compiled_truth) || hasFence(existing.timeline))) return markdown;
const parsed = parseMarkdown(markdown, relPath);
if (hasFence(parsed.compiled_truth)) return markdown;
const hold = conceptPreservationHold(existing);
@@ -146,6 +148,7 @@ async function carryStoredFences(sourceId: string, slug: string, relPath: string
/** GBRA-133 (#7292): the checkout file with the live page's `## Facts` fence put back, for `replaceableFile`; null when it has a fence of its own. */
function withStoredFactsFence(existing: Page): (fileBytes: string) => string | null {
+ assertInlineBody(existing, 'Google connector file comparison');
const body = existing.compiled_truth ?? '';
const start = body.indexOf(FACTS_FENCE_BEGIN);
const stop = start === -1 ? -1 : body.indexOf(FACTS_FENCE_END, start + FACTS_FENCE_BEGIN.length);