From 0de2db14aee6fd068bcfa1c3ced195dddad1dd07 Mon Sep 17 00:00:00 2001 From: yunyingk Date: Sun, 11 Oct 2026 19:51:32 +0800 Subject: [PATCH] Close the re-export bypass in the helpers freeze ratchet The declaration counter does not see `export { x } from "./y.js"` or `export *`, so a re-export would re-publish helpers from this file's namespace without touching either ceiling. Assert against that syntax. --- src/domains/seal/capabilities/helpers.freeze.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/domains/seal/capabilities/helpers.freeze.test.ts b/src/domains/seal/capabilities/helpers.freeze.test.ts index c161030..a0de027 100644 --- a/src/domains/seal/capabilities/helpers.freeze.test.ts +++ b/src/domains/seal/capabilities/helpers.freeze.test.ts @@ -56,6 +56,13 @@ describe("capabilities/helpers.ts freeze", () => { expect(source).toContain("helpers.freeze.test.ts"); }); + test("no re-export syntax sneaks new symbols into the namespace", () => { + // The declaration counter above does not see `export { x } from "..."` or + // `export *`, which would re-publish helpers from this file's namespace + // without touching either ceiling. + expect(source).not.toMatch(/^export\s*(\{|\*)/m); + }); + test("measures what it claims to measure", () => { // Guard the ratchet itself: a pattern that matches nothing would silently // pin the export ceiling at 0 and pass forever.