From 98421de805fb68652bcd5d0877116a469255590e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 1 Oct 2026 00:19:48 -0700 Subject: [PATCH] fix(packaging): include Kysely generator import closure #162288 added a guarded generator import to the packaged prepare hook but omitted it from package.json files. The docker-seed-e2e package integrity check therefore rejected the tarball before any image build. Include the generator and its sole relative dependency, lib/direct-run.mjs, and guard the packaged script inventory with the existing runtime closure checker. Source-less Docker dependency stages already skip generation and need no copy-list changes. The exact CI package command fails before with the missing-generator error and passes after. The functional Linux Docker image builds and runs the packaged prepare hook and CLI. All 17 import-closure tests, both restricted Docker lifecycle tests, scoped changed checks and independent review pass. The new closure assertion costs 144ms; existing wrapper/bootstrap tests dominate the full file's runtime. Test cost: node scripts/run-vitest.mjs test/scripts/eager-import-closure.test.ts --maxWorkers=1: 90.56s wall. --- package.json | 2 ++ test/scripts/eager-import-closure.test.ts | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/package.json b/package.json index f49e59e2e971..38e2d9573e67 100644 --- a/package.json +++ b/package.json @@ -408,6 +408,8 @@ "custodian-skills/", "scripts/check-install-dependency-ownership.mjs", "scripts/freebsd-service-inspect.mjs", + "scripts/generate-kysely-types.mts", + "scripts/lib/direct-run.mjs", "scripts/lib/freebsd-service-discovery.d.mts", "scripts/lib/freebsd-service-discovery.mjs", "scripts/lib/fs-safe-prebuild.mjs", diff --git a/test/scripts/eager-import-closure.test.ts b/test/scripts/eager-import-closure.test.ts index 2975ad7519b5..7887cf285e08 100644 --- a/test/scripts/eager-import-closure.test.ts +++ b/test/scripts/eager-import-closure.test.ts @@ -26,6 +26,20 @@ const inventoryCheck = const wrapperFailure = (output: string) => `${output}\nCheck the inventory first: ${inventoryCheck}`; +it("keeps packaged scripts closed over runtime imports", () => { + const files: string[] = JSON.parse(readFileSync("package.json", "utf8")).files; + const scripts = files.filter( + (file) => file.startsWith("scripts/") && !/\.d\.[cm]?ts$/.test(file), + ); + const closure = collectRuntimeImportClosure(process.cwd(), scripts, { + includeDynamicImports: true, + }); + expect( + closure.filter((file) => !files.includes(file)), + "Package lifecycle scripts must ship their guarded imports and transitive dependencies.", + ).toEqual([]); +}); + it("keeps the PR wrapper inventory closed over runtime imports", () => { const components = readFileSync(wrapperInventory, "utf8").trim().split("\n"); const stale = components.filter((file) => !existsSync(file)).toSorted();