Skip to content

Commit 693a6cb

Browse files
committed
fix(ci): declare @loopover/contract#build on the three typecheck tasks that transitively need it
validate-code failed on this PR with 'Cannot find module @loopover/contract/tools' plus five downstream implicit-any errors in src/mcp/server.ts -- none of which this PR touches. #9530 added @loopover/contract, and src/mcp/server.ts imports @loopover/contract/tools. Three turbo typecheck tasks pull that file into their program without any build edge to the package: - @loopover/ui#typecheck: apps/loopover-ui/tsconfig.json includes $TURBO_ROOT$/worker-configuration.d.ts, which imports './src/index' -- so the ENTIRE Worker is in the UI's typecheck program (src/index.ts -> src/api/routes.ts -> src/mcp/server.ts -> @loopover/contract/tools). Confirmed with tsc --explainFiles, not inferred. apps/loopover-ui has no package.json dependency on contract, so ^build never builds it. - //#typecheck: a root task, where a root package.json dependency creates no build edge. - @loopover/ui-miner#typecheck: reaches packages/loopover-miner/lib/**, which imports the package, and miner-ui has no dependency on it either. Each already carries an explicit @loopover/engine#build edge for precisely this reason -- turbo.json's own comment there describes the same scheduling race, observed intermittently in validate-code, that bit here. Cache-dependent, which is why it looked like flakiness: turbo caches these tasks, so the failure only appears on a cache MISS. Other open PRs are green on cache hits. Verified both directions from a clean contract build state (dist/ and .tsbuildinfo both removed, --force): - with the edges: 4 tasks successful, contract built first, typecheck passes - without them: the identical six errors CI reported
1 parent b50d2e3 commit 693a6cb

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

turbo.json

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
"$schema": "https://turborepo.com/schema.json",
33
"tasks": {
44
"//#typecheck": {
5-
"dependsOn": ["@loopover/engine#build"],
5+
// @loopover/contract#build joins @loopover/engine#build for the identical reason spelled out at
6+
// @loopover/ui-miner#typecheck below: src/mcp/server.ts imports "@loopover/contract/tools", whose
7+
// "types" resolve to packages/loopover-contract/dist/tools/index.d.ts. The root package.json dependency
8+
// does NOT create a build edge for a root ("//#") task, so without this turbo schedules the contract
9+
// build CONCURRENTLY with this typecheck and a cache MISS on the build races the dist emit.
10+
"dependsOn": ["@loopover/engine#build", "@loopover/contract#build"],
611
// Root tsconfig.json's own "include" list ("src", "test", plus a handful of named config files) is
712
// NOT a complete accounting of what tsc actually type-checks: "include" only seeds the starting file
813
// set, and tsc's real surface expands to everything transitively imported from there, regardless of
@@ -79,8 +84,15 @@
7984
// driver-factory.ts as an input) since engine has no default inputs override -- its whole src/** is
8085
// already hashed by that task, so depending on it transitively covers this file (and any other engine
8186
// file a future test might import) without needing to track individual paths here too.
87+
// @loopover/contract#build is a third explicit edge (added after #9530 introduced the package): this
88+
// app's tsconfig includes $TURBO_ROOT$/worker-configuration.d.ts, which imports "./src/index" -- so the
89+
// ENTIRE Worker is in this typecheck's program (src/index.ts -> src/api/routes.ts -> src/mcp/server.ts ->
90+
// "@loopover/contract/tools"), and apps/loopover-ui has no package.json dependency on contract to create
91+
// the edge via ^build. Confirmed with `tsc --explainFiles`, not inferred. This one bit in CI as a
92+
// cache-dependent failure: turbo caches this task, so it passed on PRs that hit the cache and failed with
93+
// "Cannot find module '@loopover/contract/tools'" (plus five downstream implicit-any errors) on a miss.
8294
"@loopover/ui#typecheck": {
83-
"dependsOn": ["^build", "@loopover/engine#build"],
95+
"dependsOn": ["^build", "@loopover/engine#build", "@loopover/contract#build"],
8496
"inputs": [
8597
"$TURBO_DEFAULT$",
8698
"$TURBO_ROOT$/worker-configuration.d.ts",
@@ -122,8 +134,11 @@
122134
// fail with phantom "Cannot find module '@loopover/engine'" errors (observed intermittently in CI's
123135
// validate-code job -- a scheduling race, so it only bit when the engine cache missed AND the
124136
// scheduler interleaved the two tasks the wrong way).
137+
// @loopover/contract#build is here for the same reason as the engine edge described just above: those
138+
// reached-into packages/loopover-miner/lib/** files import @loopover/contract, and miner-ui has no
139+
// package.json dependency on it either.
125140
"@loopover/ui-miner#typecheck": {
126-
"dependsOn": ["^build", "@loopover/engine#build"],
141+
"dependsOn": ["^build", "@loopover/engine#build", "@loopover/contract#build"],
127142
"inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/packages/loopover-miner/lib/**"],
128143
"outputs": []
129144
},

0 commit comments

Comments
 (0)