Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(large pages): the held-count proxy slows only scans outside the held set

garrytan52c28bb335ae
diff --git a/test/held-embedding-budgets.test.ts b/test/held-embedding-budgets.test.ts
index 1abc315c0c..60df7aa72d 100644
--- a/test/held-embedding-budgets.test.ts
+++ b/test/held-embedding-budgets.test.ts
@@ -154,7 +154,8 @@ for (const backend of testBackends()) {
get(target, key) {
if (key === 'executeRaw') {
return async (sql: string, params?: unknown[], opts?: unknown) => {
- if (/octet_length\(p\.compiled_truth\)/.test(sql)) await new Promise(r => setTimeout(r, 1500));
+ // The held count's size check reads only TOAST size headers; held-budget-count-list.test.ts's 0-TOAST-block work count is the direct guard that partial_embedding never reads bodies.
+ if (/octet_length\(p\.compiled_truth\)/.test(sql) && !/page_embedding_budget/.test(sql)) await new Promise(r => setTimeout(r, 1500));
return target.executeRaw(sql, params, opts as never);
};
}
diff --git a/test/large-pages/held-budget-count-list.test.ts b/test/large-pages/held-budget-count-list.test.ts
index 57751da310..f620cdd7a5 100644
--- a/test/large-pages/held-budget-count-list.test.ts
+++ b/test/large-pages/held-budget-count-list.test.ts
@@ -7,7 +7,10 @@
* applies: its page is above the inline bound (budgetRowAppliesFilter). Rows
* on large inline and segmented pages count; rows on pages that shrank to
* the bound or under (inline, still segmented inside the demotion
- * hysteresis, or demoted) and on pages exactly at the bound do not.
+ * hysteresis, or demoted) and on pages exactly at the bound do not. The
+ * size check reads only TOAST size headers, never a page body (the work
+ * count below). The list still includes embed_skip pages and pages with no
+ * pending chunks, which the count leaves out; the fixture has neither.
* 2. Fails when: either side applies a held row the other skips, so doctor
* reports held pages `gbrain embed --held` cannot list, or the reverse.
* 3. Why existing coverage misses it: held-budget-shrink.test.ts checks the