Skip to content

Commit 21835be

Browse files
committed
fix(framework-build-base): keep ui/ out of the typeless build closure
The !./ui/** filter takes ui/ packages out of scope only; turbo still builds the dependencies of every package in scope. The dogfood suite's devDependency on @object-ui/data-objectstack dragged four ui/ packages into the OS_SKIP_DTS build, where @object-ui/types fails TS7016 against a spec dist with no .d.ts, so every push run since has failed. Exclude the test-only dogfood suite (no build script, no dependents), and read the closure with --dry=json before building: any task under ui/ stops the build and names the package that pulls it in. Claude-Session: https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5f741ed commit 21835be

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

‎docker/framework-build-base/Dockerfile‎

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
# with the same arguments: `pnpm install --frozen-lockfile --prod=false`, the
2727
# typeless build of every package except docs and `ui/`, then the typed Console
2828
# build. Keep them in step: an image built here with different arguments is not
29-
# a drop-in for that stage.
29+
# a drop-in for that stage. The one argument added here, excluding the
30+
# test-only @objectstack/dogfood suite (it has no build script and nothing
31+
# depends on it), keeps `ui/` out of the typeless build's closure; see the
32+
# closure check above that build.
3033
#
3134
# Only this repository's own tree goes in (Apache-2.0 outside `ui/`, MIT inside
3235
# it, LICENSING.md). The image is public, so: no `.git` (it carries the
@@ -90,13 +93,42 @@ WORKDIR /repo/objectstack
9093
# loads the whole schema set in one tsx worker thread, which outgrew 8 GB
9194
# (ERR_WORKER_OUT_OF_MEMORY is a per-worker V8 limit, not an OS kill), and
9295
# --concurrency=1 keeps that one heavy worker alone on a 16 GB runner.
96+
#
97+
# The `!./ui/**` filter only takes ui/ packages out of SCOPE: turbo still builds
98+
# every dependency of a package in scope (`build` dependsOn `^build`), so one
99+
# workspace dependency on an @object-ui/* package from outside ui/ drags ui/
100+
# packages into this typeless build, where they fail (they compile against
101+
# @objectstack/spec's dist/*.d.ts, which OS_SKIP_DTS leaves out). The dogfood
102+
# suite is such a package (a devDependency for one of its tests) and is
103+
# excluded: it has no build script, nothing depends on it, and no downstream
104+
# links it. Before building, the closure is read with the same filters
105+
# (`--dry=json`) and the build stops when any task in it is under ui/, naming
106+
# the package that pulls it in, instead of failing minutes later in tsc.
93107
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
94108
--mount=type=cache,id=fw-turbo,target=/repo/objectstack/.turbo,sharing=locked \
95109
--mount=type=cache,id=fw-node-cache,target=/repo/objectstack/node_modules/.cache,sharing=locked \
110+
set -eu; \
111+
set -- --filter='!@objectstack/docs' --filter='!./ui/**' --filter='!@objectstack/dogfood'; \
96112
npm_config_registry=https://registry.npmjs.org \
97113
NODE_OPTIONS=--max-old-space-size=12288 \
98-
pnpm install --frozen-lockfile --prefer-offline --prod=false \
99-
&& NODE_OPTIONS=--max-old-space-size=12288 pnpm exec turbo run build --filter='!@objectstack/docs' --filter='!./ui/**' --concurrency=1
114+
pnpm install --frozen-lockfile --prefer-offline --prod=false; \
115+
pnpm exec turbo run build "$@" --dry=json > /tmp/build-closure.json; \
116+
node -e ' \
117+
const d = require(process.argv[1]); \
118+
const isUi = (t) => t.directory === "ui" || t.directory.startsWith("ui/"); \
119+
const ui = d.tasks.filter(isUi); \
120+
if (ui.length > 0) { \
121+
const ids = new Set(ui.map((t) => t.taskId)); \
122+
const pullers = [...new Set(d.tasks.filter((t) => !isUi(t) && t.dependencies.some((x) => ids.has(x))).map((t) => t.package + " (" + t.directory + ")"))]; \
123+
console.error("✗ the typeless build closure reaches ui/: " + [...new Set(ui.map((t) => t.package))].join(", ")); \
124+
console.error(" pulled in by: " + pullers.join(", ")); \
125+
console.error(" turbo builds the dependencies of a package in scope whatever the !./ui/** filter says, and a ui/ package does not build without .d.ts. A test-only puller that no downstream links goes in the exclusion filters of this RUN; anything else must not depend on an @object-ui/* package."); \
126+
process.exit(1); \
127+
} \
128+
console.log("→ typeless build closure: " + d.tasks.length + " tasks, none under ui/"); \
129+
' /tmp/build-closure.json; \
130+
rm -f /tmp/build-closure.json; \
131+
NODE_OPTIONS=--max-old-space-size=12288 pnpm exec turbo run build "$@" --concurrency=1
100132

101133
# The Console, built from this tree's ui/apps/console into
102134
# packages/console/dist (the directory the CLI serves) by the root
@@ -119,7 +151,9 @@ RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store \
119151
# never on a command chained after it.
120152
#
121153
# ui/ is removed at the end: the runtime serves packages/console/dist, and no
122-
# package outside ui/ depends on an @object-ui/* one.
154+
# package the image builds depends on an @object-ui/* one (the closure check
155+
# above holds that; the excluded dogfood suite's link into ui/ is left dangling,
156+
# and nothing in the image resolves it).
123157
ARG FRAMEWORK_SHA
124158
RUN --mount=type=cache,id=fw-turbo,target=/repo/objectstack/.turbo,sharing=locked \
125159
--mount=type=cache,id=fw-node-cache,target=/repo/objectstack/node_modules/.cache,sharing=locked \

0 commit comments

Comments
 (0)