@@ -570,8 +570,49 @@ jobs:
570570 else
571571 PKG="${LEG%%=*}"
572572 SLICE="${LEG#*=}"
573+ # ⛔ THE SLICE'S DEPENDENCY CLOSURE IS BUILT IN ITS OWN RUN, and the
574+ # sharded run below is `--only` (#16395). Turbo folds a run-level
575+ # passthrough -- the `-- "--shard=$SLICE"` this leg exists to pass --
576+ # into the hash of EVERY task in the run, not only the task that
577+ # receives it. Measured on turbo 2.10.10, `--filter=@objectstack/cli`,
578+ # `turbo run test ... --dry=json` (60 tasks: 59 `build` + 1 `test`):
579+ # plain vs plain 60 identical, 0 changed <- control
580+ # plain vs -- --shard=1/2 0 identical, 60 changed
581+ # --shard=1/2 vs 2/2 0 identical, 60 changed
582+ # So this leg could hit NEITHER the main-seeded cache restored above
583+ # NOR the builds the whole leg ran seconds earlier in this same job:
584+ # it rebuilt the closure a second time on every run, and shards 5/6
585+ # and 6/6 -- the two that carry a slice -- paid it twice per job.
586+ # Live reading, shard 5/6 of run 34193080219 (a `packages/spec` PR,
587+ # so the affected set reaches cli): the slice leg reported
588+ # `Cached: 2 cached, 58 total` / `Time: 9m18.941s` while
589+ # `@objectstack/cli:test` itself measured `Duration 187.49s`. That is
590+ # the rebuild the #16395 measurement was paying for, on a job then
591+ # standing against a 30-minute wall.
592+ #
593+ # `turbo run build --filter=$PKG` is that closure and nothing more:
594+ # measured 59 build tasks, all 59 hash-IDENTICAL to the ones in the
595+ # passthrough-free test plan (0 differing, 0 extra, 0 missing vs the
596+ # test's own `^build` closure), so they REPLAY instead of executing.
597+ # `--filter=...^$PKG` was measured too and schedules 12 packages this
598+ # closure does not need.
599+ #
600+ # ⚠ `--only` is what keeps the poisoned hashes off the build graph,
601+ # and it makes the run below load-bearing: it must stay immediately
602+ # before the test run. A sliced package with no `build` script would
603+ # schedule nothing here, and the failure is LOUD -- the test's imports
604+ # resolve to a missing dist -- never a silent green.
605+ #
606+ # The build leg tees to its own log and is deliberately NOT added to
607+ # LOGS: check-test-completeness reads `<pkg>:test:` prefixes, and a
608+ # roster of `<pkg>:build:` lines is not its input.
609+ BUILD_LOG="$RUNNER_TEMP/test-core-slice-build-$(printf '%s' "$PKG" | tr -c 'A-Za-z0-9' '-').log"
610+ node scripts/run-with-stall-guard.mjs --log "$BUILD_LOG" --stall-minutes 10 \
611+ --report-dir "$RUNNER_TEMP/stall-reports" -- \
612+ pnpm turbo run build "--filter=$PKG" --concurrency=4 --log-order=stream \
613+ || { STATUS=$?; break; }
573614 LOG="$RUNNER_TEMP/test-core-slice-$(printf '%s' "$PKG" | tr -c 'A-Za-z0-9' '-').log"
574- set -- pnpm turbo run test "--filter=$PKG" --concurrency=4 --summarize --log-order=stream -- "--shard=$SLICE"
615+ set -- pnpm turbo run test "--filter=$PKG" --only -- concurrency=4 --summarize --log-order=stream -- "--shard=$SLICE"
575616 fi
576617 LOGS="$LOGS $LOG"
577618 node scripts/run-with-stall-guard.mjs --log "$LOG" --stall-minutes 10 \
0 commit comments