Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(large-pages): pin the page-size policy; permit it test-only until wired

garrytan7e11268973f9
diff --git a/scripts/check-orphan-modules.mjs b/scripts/check-orphan-modules.mjs
index 4fd946fb5b..138c6b9792 100644
--- a/scripts/check-orphan-modules.mjs
+++ b/scripts/check-orphan-modules.mjs
@@ -54,6 +54,7 @@ const ALLOWLIST = new Map([
// reason 'script-reachable', which the guard verifies.
const PERMITTED_TEST_ONLY = [
{ path: 'src/core/bootstrap/template-repo.ts', reason: 'script-reachable' },
+ { path: 'src/core/page-size-policy.ts', reason: 'held: Wave A large-pages policy module; the large-pages ingress lane wires PAGE_MAX_BYTES / isLargePageBytes into the import screens and drops this row' },
{ path: 'src/eval/longmemeval/diagnostics.ts', reason: 'script-reachable' },
{ path: 'src/eval/longmemeval/evidence-brief.ts', reason: 'held: eval-only wave 1 brief builder (10x memory advantage plan A3), loaded by path from gbrain-evals eval/runner/pilot; product wiring is plan item A8, conditional on the A5 pilot' },
{ path: 'src/eval/longmemeval/evidence-packet.ts', reason: 'script-reachable' },
diff --git a/test/page-size-policy.test.ts b/test/page-size-policy.test.ts
new file mode 100644
index 0000000000..3d1d773531
--- /dev/null
+++ b/test/page-size-policy.test.ts
@@ -0,0 +1,22 @@
+/**
+ * Wave A page-size policy: the published constants and the large-page
+ * threshold the ingress bounds and the large-page paths derive from.
+ */
+import { describe, expect, test } from 'bun:test';
+import { CODE_FILE_MAX_BYTES, PAGE_INLINE_MAX_BYTES, PAGE_MAX_BYTES, isLargePageBytes } from '../src/core/page-size-policy.ts';
+
+describe('page-size policy', () => {
+ test('the ceilings are 24 MiB per page, 5 MB per code file and 1 MiB inline', () => {
+ expect(PAGE_MAX_BYTES).toBe(25_165_824);
+ expect(CODE_FILE_MAX_BYTES).toBe(5_000_000);
+ expect(PAGE_INLINE_MAX_BYTES).toBe(1_048_576);
+ expect(PAGE_INLINE_MAX_BYTES).toBeLessThan(PAGE_MAX_BYTES);
+ });
+
+ test('a page is large only above the inline threshold', () => {
+ expect(isLargePageBytes(0)).toBe(false);
+ expect(isLargePageBytes(PAGE_INLINE_MAX_BYTES)).toBe(false);
+ expect(isLargePageBytes(PAGE_INLINE_MAX_BYTES + 1)).toBe(true);
+ expect(isLargePageBytes(PAGE_MAX_BYTES)).toBe(true);
+ });
+});