Summary
validate-code fails intermittently with errors in files the PR never touched:
../../src/mcp/server.ts(22,8): error TS2307: Cannot find module '@loopover/contract/tools' or its corresponding type declarations.
../../src/mcp/server.ts(2239,14): error TS7006: Parameter 'input' implicitly has an 'any' type.
...four more implicit-any errors, all downstream of the first
#9530 added @loopover/contract, and src/mcp/server.ts imports @loopover/contract/tools. Three turbo typecheck tasks pull that file into their compilation program with no build edge to the package:
| task |
how it reaches src/mcp/server.ts |
why ^build does not cover it |
@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 program (src/index.ts → src/api/routes.ts → src/mcp/server.ts) |
apps/loopover-ui has no package.json dependency on @loopover/contract |
//#typecheck |
root tsconfig includes src/** directly |
a root (//#) task gets no build edge from a root package.json dependency |
@loopover/ui-miner#typecheck |
reaches packages/loopover-miner/lib/**, which imports the package |
miner-ui has no dependency on it either |
The UI chain was confirmed with tsc --explainFiles, not inferred.
Why it reads as flakiness
Turbo caches these tasks, so the failure only appears on a cache miss. PRs that hit the cache are green, which is why this presents as an unrelated PR "randomly" failing.
Prior art — this exact class is already documented in the file
All three tasks already carry an explicit @loopover/engine#build edge, and turbo.json's own comment on @loopover/ui-miner#typecheck describes the identical scheduling race for engine:
Without it, turbo runs engine build CONCURRENTLY with this typecheck; on an engine-build cache miss the typecheck can race ahead of the dist emit and fail with phantom "Cannot find module '@loopover/engine'" errors (observed intermittently in CI's validate-code job [...]).
@loopover/contract reintroduced the same gap for a new package.
Fix
Add @loopover/contract#build to all three tasks' dependsOn.
Verified both directions from a clean contract build state (dist/ and .tsbuildinfo removed — turbo caches both, so removing only dist/ produces a state turbo never creates, and tsc then silently no-ops):
- with the edges: 4 tasks successful, contract built first, typecheck passes
- without them: the identical six errors CI reported
Summary
validate-codefails intermittently with errors in files the PR never touched:#9530 added
@loopover/contract, andsrc/mcp/server.tsimports@loopover/contract/tools. Three turbotypechecktasks pull that file into their compilation program with no build edge to the package:src/mcp/server.ts^builddoes not cover it@loopover/ui#typecheckapps/loopover-ui/tsconfig.jsonincludes$TURBO_ROOT$/worker-configuration.d.ts, which imports./src/index— so the entire Worker is in the UI's program (src/index.ts→src/api/routes.ts→src/mcp/server.ts)apps/loopover-uihas nopackage.jsondependency on@loopover/contract//#typechecksrc/**directly//#) task gets no build edge from a rootpackage.jsondependency@loopover/ui-miner#typecheckpackages/loopover-miner/lib/**, which imports the packageThe UI chain was confirmed with
tsc --explainFiles, not inferred.Why it reads as flakiness
Turbo caches these tasks, so the failure only appears on a cache miss. PRs that hit the cache are green, which is why this presents as an unrelated PR "randomly" failing.
Prior art — this exact class is already documented in the file
All three tasks already carry an explicit
@loopover/engine#buildedge, andturbo.json's own comment on@loopover/ui-miner#typecheckdescribes the identical scheduling race for engine:@loopover/contractreintroduced the same gap for a new package.Fix
Add
@loopover/contract#buildto all three tasks'dependsOn.Verified both directions from a clean contract build state (
dist/and.tsbuildinforemoved — turbo caches both, so removing onlydist/produces a state turbo never creates, andtscthen silently no-ops):