Uh oh!
There was an error while loading. Please reload this page.
fix(build): build @objectstack/client through turbo in build-console.sh, and guard on the declaration - #9396
Merged
Conversation
…sh, and guard on the declaration Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XqDQYVU5smx29ts9pAErja
os-steve
marked this pull request as ready for review
August 17, 2026 22:56
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes#9307
scripts/build-console.shpre-built@objectstack/clientby shelling into the package(
cd "$CLIENT_PKG" && pnpm build), which bypasses the orderingturbo.jsonalreadydeclares (
"build": { "dependsOn": ["^build"] }). On a cold treepackages/spec/distand
packages/core/distdo not exist, the client's subpath imports resolve to nothing,and the tsup DTS pass dies.
This is latent, not a fresh regression.
git log -L 136,141:scripts/build-console.shreturns exactly one commit,
b990bc258(2026-07-02, #2513) — the block has been unchangedfor 3549 commits. It only bites on a genuinely cold tree, which is why it stayed invisible.
What changed
Two edits, both inside the client pre-build block:
^buildsupplies the dependency closure:
(cd "$FRAMEWORK_ROOT" && pnpm exec turbo run build --filter=@objectstack/client)dist/index.d.tsinstead ofdist/index.mjs. tsup writesthe CJS/ESM bundles before the DTS pass, so a client build that died in DTS still left
dist/index.mjson disk and the next run skipped the build entirely.The run is also pinned to
$FRAMEWORK_ROOT; the old code cd'd into the package, so the newcommand must not inherit whatever cwd the caller had.
Measured, not assumed
The card was explicit that its failure mode came from static reading plus a one-commit
git log -L, not an executed bisect. It was reproduced for real here, on a freshgit worktree+pnpm installwith zerodist/directories anywhere underpackages/.Red, before. Cold tree, unmodified script — exit 1 in 6.4s, the same nine diagnostics
the card reports:
packages/client/distwas left holdingindex.js,index.mjsand their maps — and zerodeclaration files.
Green, after. Same tree returned to cold (all
dist/removed,.turboremoved),patched script — exit 0 in 1m32s, full console SPA built and copied:
Second-order leg — the half that makes this deterministic rather than flaky. A failed
client build was reproduced exactly as the old code invoked it, leaving
index.mjswith nodeclarations. Both guards evaluated against that state:
Running the patched script against that half-built dist rebuilt the client and finished
green, with
index.d.tsandindex.d.mtspresent afterwards. The old script, run twice onthe cold tree, genuinely skipped the client stage on its second invocation — the
"dist missing" line is absent from that log.
One correction to the card
The card predicts the second invocation "appears to succeed". On a purely cold tree it
does not — it fails much later and more confusingly, 74s into the console SPA build:
The silent pass needs
packages/spec/distandpackages/core/distto have been populatedby something else in between (a concurrent
pnpm buildortypecheck— the card's own Run 2notes exactly that interleaving). So the guard defect is real and worth fixing on both
counts: in one state it hides a declaration-less client behind a green run, and in the other
it converts a 6s, precisely-worded failure into a 74s one that points at the client dist
rather than at the missing dependency dists. Neither is affected by which state you land in
after this change.
Filter form
The card's workaround used
--filter=@objectstack/client...and its suggested fix used--filter=@objectstack/client; those are different filters, so this was measured. The bareform is sufficient —
--filter=@objectstack/clientputs 1 package in scope and turbo stillruns 32 build tasks, because the closure comes from
dependsOn: ["^build"], not from thefilter suffix.
packages/spec/dist(107 entries) andpackages/core/dist(12 entries) areboth populated by it.
Declaration artifact
tsup 8.5.1 emits both
dist/index.d.mtsanddist/index.d.tshere, in the same DTSpass.
dist/index.d.tsis the sentinel used, because it is the file this package declaresas its type entrypoint in
package.json("types"andexports["."].types) — its absenceis the actual defect, not an incidental artifact. Under
OS_SKIP_DTSthere is legitimatelyno declaration, so the guard re-fires every run; that is harmless, since the turbo build it
guards is cached.
Scope
scripts/build-console.shonly. Noturbo.jsonchange, and no sweep of otherpnpm buildshell-outs. Two observations recorded rather than acted on: the script's header already
states a "no if-exists-skip shortcut" principle that this block predated, and the shared
turbo worktree cache noted below.
Verification
node scripts/pm/dispatch-gates.mjs scripts/build-console.shmatches 0 check families(35 undetermined, 69 silent). That is a
silentverdict and not a clearance, which is whythe evidence above is executed cold-tree runs rather than gates.
bash -npasses and thecontrol-character scan is clean.
Note on method: turbo 2.10 reports "Remote caching disabled, using shared worktree cache",
and cache hits in this container were replayed from a sibling agent's worktree. That makes
the turbo leg of the green run a cache restore rather than a from-scratch compile. It does
not affect the verdict — the dependency
dist/trees and the client declarations wereconfirmed present on disk either way — but a fresh CI runner will do the real compile.
No changeset: this is a root build script, nothing published changes.
Generated by Claude Code
Generated by Claude Code