Repository navigation
Commit e0c768f
ci(dogfood): carry the shard slice in a task env so the dogfood test hash sees its upstream closure (#21074)
Fixes #20820
Clause-②: no
## What
The required `Dogfood Regression Gate (k/3)` leg ran `turbo run test
--filter=@objectstack/dogfood --only -- --shard=k/3`. `--only` drops the
`^build` closure out of the `dogfood#test` hash, so a PR that changed
only an upstream package could match a main-seeded cache entry and be
replayed green. This ports #19278's shape to the dogfood leg:
- `turbo.json`: `@objectstack/dogfood#test` now declares `OS_TEST_SHARD`
in its `env`. The shared `test` task already declares it (#20824), but a
per-package task entry REPLACES the shared entry's `env` instead of
extending it, so the shared declaration did not cover dogfood: measured,
the pre-change plan listed only `OS_TEST_TIERS` for that task.
- `packages/qa/dogfood/vitest.config.ts`: reads
`process.env.OS_TEST_SHARD` into the root `test.shard` (same spelling as
`packages/cli/vitest.config.ts`).
- `.github/workflows/ci.yml`: the leg exports `OS_TEST_SHARD="k/3"` and
runs `pnpm turbo run test --filter=@objectstack/dogfood
--log-order=stream`: no `--`, no `--only`, no `--force`. Stall guard,
`dogfood.log` tee, `NODE_OPTIONS` / `--report-dir`, cache restore/save
are untouched. The step's comment states the new mechanism.
Also touched (comment only, one deviation from the card's file surface,
flagged): the comment of the preceding closure-build step said it exists
"so that the sharded run in the next step can be `--only`", which is now
false; it now says so. The step itself is unchanged.
No second shard mechanism. `scripts/measure-test-shard-timings.mjs` /
`partition-test-shards.mjs` / `report-test-timings.mjs` are untouched:
the dogfood leg passes no `--summarize` and has no timings consumer, so
there is nothing to reuse or change.
## Measurements
turbo 2.10.10 dry-runs (`--dry=json`) and real vitest runs, in this
worktree at head 55bd9e0.
Pin 1, hash moves (shard 1/3, edit = append a comment line to the file,
restored from HEAD after):
| leg | clean | + `packages/objectql/src/index.ts` |
|---|---|---|
| old (`--only -- --shard=1/3`) | a963b53363c79e20 | a963b53363c79e20
(unchanged: the defect) |
| new, pre-build tree | d6f169ed1431553e | 2ee13c0afd852c96 (moves) |
| new, post-build tree | bd114335fad78510 | 55dc2dd1da35f8e0 (moves) |
The pre-build and post-build clean hashes differ (d6f169ed vs bd114335);
I did not isolate why (suspect built output under the
`examples/app-showcase/**` input). Each row's before/after is on one
tree.
Pin 2, lit control (post-build tree, shard 1/3, clean bd114335fad78510):
- `packages/client-react/src/index.tsx` (a workspace package NOT in the
dogfood closure, checked against the plan): bd114335fad78510, unchanged.
- `packages/qa/dogfood/test/action-params-contract.dogfood.test.ts`
(dogfood-internal): a5dc81d7aadebe29, moves.
Pin 3, shards differ: post-build 1/3 bd114335fad78510, 2/3
0387e6b5b568a93c, 3/3 d3b158ab11f62582; pre-build d6f169ed1431553e /
fd1f57f4bbe9537f / bc48cac953e838cc. Pins 1 to 3 are dry-run hash
readings, not executions.
Pin 4, the shard is honoured: vitest 4.1.11 (lockfile). Real
`OS_TEST_SHARD=k/3 vitest run` in `packages/qa/dogfood` ran 50 / 49 / 49
test files (148 in total, 148 in the union, 0 overlap between any two
shards), 0 failed in each. `vitest list --filesOnly` is NOT a valid
measure of this: it prints all 148 files for any shard, even with
`--shard=1/3` on the command line. #21032's vitest 5.0.2 is NOT
MEASURED; the env-read shape is the one `packages/cli/vitest.config.ts`
already uses, so the dogfood read breaks together with it if a vitest
line stops honouring `test.shard`.
Plan cost of dropping `--only` (`OS_TEST_SHARD=1/3 turbo run test
--filter=@objectstack/dogfood --dry=json`): 66 tasks. Against the cache
the step above fills: 63 HIT / 3 MISS (the test, plus two `#build` nodes
of packages with no `build` script, which never execute); cold cache: 66
MISS. The leg's 65 `build` hashes are identical to `turbo run build
--filter=@objectstack/dogfood`'s plan (65 same, 0 differ, 0 missing), so
the closure replays rather than rebuilds. The old leg planned 1 task.
Pin 5, nothing is replayed green: a replay needs an equal `dogfood#test`
hash. That hash now carries the shard value (pin 3), the upstream
closure (pin 1) and the package's own files (pin 2), the control shows
it is not moving on everything, and pin 4 shows the shard value is what
selects the files that execute. NOT MEASURED: an end-to-end executed
replay across an upstream edit on the new leg.
## Gates
`node scripts/pm/dispatch-gates.mjs --commands`: 79 derived; 78 run, all
exit 0, recorded with `--ran`. `pnpm check:dual-build-cjs-loads` exited
3 (PREREQUISITE NOT MET: `Run pnpm build first`, nothing measured), so
it is NOT MEASURED; the diff changes no built output. `pnpm --filter
@objectstack/dogfood typecheck` exit 0, but that program does not
compile `vitest.config.ts` (0 hits in `tsc --listFiles`), so the
`satisfies` clause is checked only by vitest loading the file.
actionlint is not installed here: NOT MEASURED; `ci.yml` parses as YAML
and `turbo.json` as JSON.
## Changeset
None. `@objectstack/dogfood` is `"private": true`, and `ci.yml` /
`turbo.json` ship in no package's `files[]`.
## Acceptance notes
None beyond the above.
---
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01VDtqoecgES7ScQYGbFVDRv
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 94608a7 commit e0c768f
3 files changed
Lines changed: 53 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1632 | 1632 | | |
1633 | 1633 | | |
1634 | 1634 | | |
1635 | | - | |
1636 | | - | |
| 1635 | + | |
| 1636 | + | |
1637 | 1637 | | |
1638 | 1638 | | |
1639 | 1639 | | |
| |||
1653 | 1653 | | |
1654 | 1654 | | |
1655 | 1655 | | |
1656 | | - | |
1657 | | - | |
1658 | | - | |
1659 | | - | |
1660 | | - | |
1661 | | - | |
1662 | | - | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
1663 | 1666 | | |
1664 | 1667 | | |
1665 | 1668 | | |
| |||
1704 | 1707 | | |
1705 | 1708 | | |
1706 | 1709 | | |
1707 | | - | |
1708 | | - | |
1709 | | - | |
1710 | | - | |
1711 | | - | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
1712 | 1720 | | |
1713 | 1721 | | |
1714 | 1722 | | |
| |||
1728 | 1736 | | |
1729 | 1737 | | |
1730 | 1738 | | |
1731 | | - | |
1732 | | - | |
1733 | | - | |
1734 | | - | |
1735 | | - | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
1739 | 1744 | | |
1740 | 1745 | | |
1741 | | - | |
| 1746 | + | |
1742 | 1747 | | |
1743 | 1748 | | |
1744 | 1749 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
114 | 134 | | |
115 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
116 | 139 | | |
117 | 140 | | |
118 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
0 commit comments