Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/coil/desktop-bundle-size.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,20 @@ describe("verifyPackagedApp over a real asar", () => {
});
});

// The Bun-runtime variants are imported behind runtime detection the shipped app (always Node,
// via ELECTRON_RUN_AS_NODE) can never satisfy, and upstream's Windows sidecar deliberately omits
// them — their absence is not a break. Release run 31839839479 failed on exactly this.
it("does not require Bun-runtime-only packages the shipped app cannot load", () => {
withTempDir((dir) => {
const asarPath = writeAsar(dir, {
"apps/server/dist/bin.mjs":
'import("@effect/platform-bun/BunHttpServer");import("@effect/sql-sqlite-bun/SqliteClient");',
"apps/desktop/dist-electron/main.cjs": "const x = 1;",
});
assert.ok(verifyPackagedApp(asarPath).ok, "unreachable Bun-runtime imports are not breaks");
});
});

// A packaging-topology change that hides a whole bundle directory must be an error, not an empty
// green result — the pre-#102 gate verified only the Electron bundle on Windows and passed.
it("fails when a first-party bundle directory is invisible to the checker", () => {
Expand Down
17 changes: 17 additions & 0 deletions scripts/coil/verify-desktop-bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,22 @@ export const FIRST_PARTY_BUNDLE_DIRS = ["apps/desktop/dist-electron", "apps/serv
const RUNTIME_PROVIDED = new Set(["electron"]);
const BUNDLED_WORKSPACE_PREFIXES = ["@t3tools/"];

/*
* Imports the shipped app can never reach, so their absence is not a break.
*
* The server bundle imports these behind Bun-runtime detection (`typeof Bun !== "undefined"` in
* server.ts's HttpServerLive, `process.versions.bun !== undefined` in persistence/Layers/Sqlite.ts),
* and the shipped desktop app always runs the server under Node via ELECTRON_RUN_AS_NODE — the Bun
* branch cannot execute. Upstream agrees by construction: its Windows server.asar sidecar stages
* only the CLI's runtime external dependencies, which exclude both (that omission is what surfaced
* this list — release run 31839839479). The macOS artifact carries them incidentally, because its
* staging installs the full production dependency set.
*
* If the shipped server ever runs under Bun, this list is wrong and the failure is a MODULE_NOT_FOUND
* at startup on the Bun path — re-check both guard sites before growing or trusting it.
*/
const UNREACHABLE_IN_SHIPPED_RUNTIME = new Set(["@effect/platform-bun", "@effect/sql-sqlite-bun"]);

/**
* @typedef {object} PackagedFile
* @property {number} size
Expand Down Expand Up @@ -219,6 +235,7 @@ export function isPackagedSpecifier(specifier) {
const name = packageNameFromSpecifier(specifier);
if (name === undefined) return false;
if (RUNTIME_PROVIDED.has(name)) return false;
if (UNREACHABLE_IN_SHIPPED_RUNTIME.has(name)) return false;
return !BUNDLED_WORKSPACE_PREFIXES.some((prefix) => name.startsWith(prefix));
}

Expand Down
Loading