From 53e737894d1b317c0033252fe5ff478efdaeca2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 1 Jul 2026 10:11:22 +0200 Subject: [PATCH] fix: exempt sdk/ public barrels from R3 platforms-seam (unblock main) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #984 added the R3 platforms-seam layering rule and #986 moved the public SDK entry barrels into src/sdk/; the two merged mutually inconsistent, so the Layering Guard is failing on main. sdk/ are public re-export barrels that legitimately expose platform symbols and are off the CLI cold path (not imported by bin.ts), so they are a correct R3 exemption alongside core/interactors and the daemon server — not a cold-start regression. --- scripts/layering/check.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/layering/check.ts b/scripts/layering/check.ts index 0adacb1bf..f2682152c 100644 --- a/scripts/layering/check.ts +++ b/scripts/layering/check.ts @@ -89,6 +89,14 @@ function isDaemonServer(rel: string): boolean { return rel.startsWith('src/daemon/') && !rel.startsWith('src/daemon/client/'); } +// sdk/ are the package's PUBLIC re-export barrels (§5.5 "sdk = re-export barrels +// only"). They legitimately re-export platform symbols as part of the public API, +// and are OFF the CLI cold path (not imported by bin.ts/cli), so exempting them +// from R3 does not regress cold-start — they sit above the internal DAG R3 governs. +function isSdkBarrel(rel: string): boolean { + return rel.startsWith('src/sdk/'); +} + // ── Import extraction ─────────────────────────────────────────────────────── function scanDynamicImports(line: string, lineNo: number): ImportEdge[] { @@ -180,7 +188,7 @@ function ruleCommandsFloor(ctx: EdgeContext): Violation | null { // daemon server; everywhere else use a dynamic import() or a type-only import. function rulePlatformsSeam(ctx: EdgeContext): Violation | null { if (ctx.toTop !== 'platforms' || ctx.imp.dynamic || ctx.imp.typeOnly) return null; - if (isCoreInteractor(ctx.file) || isDaemonServer(ctx.file)) return null; + if (isCoreInteractor(ctx.file) || isDaemonServer(ctx.file) || isSdkBarrel(ctx.file)) return null; return { rule: 'R3 platforms-seam', file: ctx.file,