Skip to content

Commit a26ead8

Browse files
committed
ci: drop the e2e Turbopack dev cache and keep /ship's full test gate
1 parent a3d5fd9 commit a26ead8

4 files changed

Lines changed: 24 additions & 101 deletions

File tree

‎.agents/skills/ship/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ When the user runs `/ship`:
4242
- If the diff modifies UI code (any non-test `.tsx` file, or anything under `apps/sim/components/`, `apps/sim/hooks/`, or `apps/sim/stores/`), run `/cleanup`. It fans out the React/UI passes (effects, memo, callbacks, state, React Query, emcn, url-state), the comment pass, and the test-audit pass, and applies fixes so they land in this commit.
4343
- Otherwise, if the diff adds or changes tests (`*.test.ts(x)`, `*.integration.ts`, `**/e2e/**`, `apps/sim/scripts/test-*-e2e.ts`), run `/test-audit audit <changed test files>` on its own. Every new or changed test must pass the authoring gate; delete the ones that don't rather than shipping them.
4444
- Then run the test files the diff adds or changes, plus the existing tests beside changed source files, with `bun run --cwd <workspace> test <paths>` (`bun run --cwd apps/sim test <paths>` for the app; `*.integration.ts` needs the setup in `.claude/rules/sim-testing.md`). A failing test aborts ship.
45-
- Then run `bun run test:scripts` (the `scripts/*.test.ts` suite CI runs; workspace-scoped runs skip it, which is how a `scripts/check-*.test.ts` failure has reached CI) and the suites of the workspaces the change reaches: `bunx turbo run test --filter='...[origin/staging]'` (each changed workspace plus every workspace that depends on it). CI runs every suite, sharded, on every push; the full local suite needs more memory than a laptop reliably has and catches nothing CI does not. When the diff touches root test or build config (`vitest.shared.ts`, `turbo.json`, the root `package.json`, `bun.lock`), the filter selects nothing that config reaches, so run the full root `bun run test` instead. A failing test aborts ship.
45+
- Then run root `bun run test` from the repo root. It chains `test:scripts` (the `scripts/*.test.ts` suite CI runs) before every workspace suite; workspace-scoped runs skip it, which is how a `scripts/check-*.test.ts` failure has reached CI. A failing test aborts ship.
4646
5. **Run migration safety** — only if the diff touches `packages/db/migrations/**` or `packages/db/schema.ts`:
4747
- Run `/db-migrate` to review the migration for zero-downtime safety (expand/contract phasing, backward-compatibility with the deployed app version).
4848
- `(cd packages/db && bunx drizzle-kit generate && git status --porcelain ./migrations)` must print nothing (CI's schema/migration sync step).

‎.github/actions/dev-cache/action.yml‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎.github/scripts/http-e2e.sh‎

Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
# the readiness deadline only has to catch a hung boot: an exited server fails immediately, and
1111
# either way the server log tail lands in the job log.
1212
#
13-
# Each group restores its own Turbopack dev cache (mounted by the dev-cache action, keyed by group
14-
# and by this file's hash, so a cache is only ever read under the NEXT_PUBLIC_* values it was
15-
# compiled with). The app is stopped with SIGINT so its last cache write completes: `next dev`
16-
# SIGKILLs its server 100ms after SIGTERM. A cache Turbopack reports as corrupt is dropped, and a
17-
# startup it aborted is retried once from an empty cache. The app runs in its own session under an
18-
# E2E_APP tag, and stop-session.sh returns only once every process in that session or carrying
19-
# that tag has exited (Next's telemetry flush runs detached and still writes .next/dev).
13+
# Each app starts from an empty Turbopack dev cache: a cache written under other NEXT_PUBLIC_*
14+
# values, by a server that `next dev` SIGKILLs 100ms after SIGTERM, can panic Turbopack or wedge a
15+
# route compile on restore. It runs in its own session under an E2E_APP tag, and stop-session.sh
16+
# returns only once every process in that session or carrying that tag has exited (Next's
17+
# telemetry flush runs detached and still writes .next/dev).
2018
set -euo pipefail
2119

2220
group=${1:?usage: http-e2e.sh <scim|cli|stop-after|desktop-inbox|mobile>}
@@ -29,35 +27,11 @@ app_tag=''
2927
server_log=''
3028
status_log=''
3129

32-
cache_broken() {
33-
grep -qiE 'cache corruption|turbopack.*panic|panicked' "$server_log" 2>/dev/null
34-
}
35-
36-
# The cache directory is a mount point: empty it rather than remove it.
37-
clear_cache() {
38-
local cache="$GITHUB_WORKSPACE/apps/sim/.next/dev"
39-
[ -d "$cache" ] || return 0
40-
find "$cache" -mindepth 1 -maxdepth 1 -exec rm -rf {} +
41-
}
42-
43-
# SIGINT is best-effort; the cleanup always runs, since workers and the detached telemetry flush
44-
# can outlive a server that has already exited.
45-
stop_app() {
46-
if kill -INT "$server_pid" 2>/dev/null; then
47-
for _ in $(seq 1 30); do kill -0 "$server_pid" 2>/dev/null || break; sleep 1; done
48-
fi
49-
bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$server_pid" "$app_tag"
50-
}
51-
5230
finish() {
5331
local status=$?
5432
if [ -n "$server_pid" ]; then
55-
stop_app || status=1
33+
bash "$GITHUB_WORKSPACE/.github/scripts/stop-session.sh" "$server_pid" "$app_tag" || status=1
5634
wait "$server_pid" 2>/dev/null || true
57-
if cache_broken; then
58-
echo "::warning::Turbopack reported a broken dev cache; clearing it for the next run."
59-
clear_cache
60-
fi
6135
if [ -n "$status_log" ]; then
6236
awk '/^ (GET|POST|PUT|PATCH|DELETE|HEAD) \/api\// { print }' "$server_log" > "$status_log"
6337
fi
@@ -69,13 +43,6 @@ finish() {
6943
}
7044
trap finish EXIT
7145

72-
# launch_app <port>
73-
launch_app() {
74-
E2E_APP="$app_tag" setsid node ../../node_modules/next/dist/bin/next dev --hostname 127.0.0.1 \
75-
--port "$1" > "$server_log" 2>&1 &
76-
server_pid=$!
77-
}
78-
7946
# start_app <name> <port> <label> [record-http-status]
8047
start_app() {
8148
local name=$1 port=$2 label=$3
@@ -87,21 +54,14 @@ start_app() {
8754
export NEXT_PUBLIC_APP_URL="http://127.0.0.1:$port"
8855
export BETTER_AUTH_URL="$NEXT_PUBLIC_APP_URL"
8956
export DISABLE_TELEMETRY=true NEXT_TELEMETRY_DISABLED=1
90-
launch_app "$port"
57+
rm -rf .next/dev
58+
E2E_APP="$app_tag" setsid node ../../node_modules/next/dist/bin/next dev --hostname 127.0.0.1 \
59+
--port "$port" > "$server_log" 2>&1 &
60+
server_pid=$!
9161

92-
local started=$SECONDS retried=false
62+
local started=$SECONDS
9363
until curl --fail --silent --max-time 10 "$NEXT_PUBLIC_APP_URL/api/health" > /dev/null; do
9464
if ! kill -0 "$server_pid" 2>/dev/null; then
95-
if [ "$retried" = false ] && cache_broken; then
96-
echo "::warning::Turbopack rejected the restored dev cache; restarting from an empty cache."
97-
tail -n 50 "$server_log"
98-
stop_app
99-
clear_cache
100-
retried=true
101-
launch_app "$port"
102-
started=$SECONDS
103-
continue
104-
fi
10565
echo "::error::Local $label app exited during startup."
10666
exit 1
10767
fi

‎.github/workflows/checks.yml‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,6 @@ jobs:
201201
working-directory: packages/db
202202
run: bun run db:migrate
203203

204-
# One cache per group: each group's app runs under its own fixed NEXT_PUBLIC_* values.
205-
- name: Mount Turbopack dev cache
206-
uses: ./.github/actions/dev-cache
207-
with:
208-
provider: ${{ vars.CI_PROVIDER }}
209-
name: e2e-${{ matrix.group }}
210-
env-hash: ${{ hashFiles('.github/scripts/http-e2e.sh') }}
211-
212204
# No step timeout: the job's bound covers a hang without cutting a slow but healthy suite
213205
# short of writing its report.
214206
- name: Run end-to-end suites
@@ -301,13 +293,21 @@ jobs:
301293
run: bun run db:migrate
302294

303295
# Turbopack's dev cache turns the spec's route warm-up from a cold compile (~4 min) into a
304-
# restore.
296+
# restore. It is content-addressed, so a pull request's changed modules still recompile; the
297+
# key carries the installed Next version so an upgrade starts from an empty cache, and the
298+
# event and fork segments keep untrusted runs off the cache trusted runs read.
299+
- name: Resolve Turbopack dev cache key
300+
id: next-cache
301+
run: echo "key=${GITHUB_REPOSITORY}-next-dev-desktop-live-${GITHUB_EVENT_NAME}${FORK_SUFFIX}-$(jq -r .version node_modules/next/package.json)" >> "$GITHUB_OUTPUT"
302+
env:
303+
FORK_SUFFIX: ${{ github.event.pull_request.head.repo.fork && '-fork' || '' }}
304+
305305
- name: Mount Turbopack dev cache
306-
uses: ./.github/actions/dev-cache
306+
uses: ./.github/actions/cache
307307
with:
308308
provider: ${{ vars.CI_PROVIDER }}
309-
name: desktop-live
310-
env-hash: ${{ hashFiles('.github/workflows/checks.yml') }}
309+
key: ${{ steps.next-cache.outputs.key }}
310+
path: ./apps/sim/.next/dev
311311

312312
# Chat switches, Stop, sign-out, approval, the dormant-executor round trip, and background
313313
# runs across a chat switch and a network cut. The spec runs the recording proxy (the app's

0 commit comments

Comments
 (0)