Skip to content

Commit 7aeaf9e

Browse files
serpentbladeclaude
andcommitted
fix(ci): cache .d.rozie.ts sidecars as turbo outputs + non-vacuous WR-03 gate
Fixes the red main on 4084548 (5 framework matrices failed with TS2307 on every .rozie import). Root cause: that push touched only examples/demos/ + a VR spec, so every vite-demo build was a turbo CACHE HIT — buildStart never ran, no sidecars were generated on CI's fresh checkout, and turbo's cached outputs (dist/** only) did not include the src/ sidecars. The WR-03 --require-complete gate then passed VACUOUSLY because its missing-sidecar walk derived its directory set from existing sidecars (zero sidecars = zero directories = nothing missing), letting the failure surface as a wall of TS2307s at typecheck instead. Every prior push since Phase 22 invalidated all caches via compiler changes, which is why this never fired before. Fix 1 (root cause): declare src/**/*.d.rozie.ts + app/**/*.d.rozie.ts as build task outputs so cache replay restores sidecars. Verified: delete all 43 sidecars -> FULL TURBO replay -> all 43 restored, Angular exception still 0. Fix 2 (defense): --require-complete now walks every .rozie under examples/consumers/ (except the ANGULAR EXCEPTION tree) independently of which sidecars exist — a zero-sidecar build fails at WR-03 with the right message. Verified: incident simulation (zero sidecars) now exits 1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 16d309b commit 7aeaf9e

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

scripts/check-sidecar-staleness.mjs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,8 @@ function runGate(requireComplete) {
234234
if (!result.ok) stale.push(result.reason);
235235
}
236236

237-
// Missing-declaration gap: a `.rozie` that lives next to OTHER sidecar'd
238-
// siblings (i.e. in a directory that already participates in sidecar
239-
// generation) but has NO sidecar of its own.
237+
// Missing-declaration gap: a `.rozie` consumer source with NO sidecar of its
238+
// own.
240239
//
241240
// Default (dev / pre-push): on a fresh checkout this is expected (sidecars
242241
// are gitignored), and that case is handled by CI ordering (generate before
@@ -249,14 +248,22 @@ function runGate(requireComplete) {
249248
// per-file error in emitSidecarsForRoot) — the consumer's tsc would fall
250249
// back to the wildcard and type-lie, the exact failure this gate exists to
251250
// catch. With the flag, a missing sidecar is a HARD failure (exit 1).
252-
const sidecarDirs = new Set(sidecars.map((p) => dirname(p)));
251+
//
252+
// The walk here MUST be independent of which sidecars exist. The previous
253+
// implementation derived the directory set FROM existing sidecars
254+
// (`new Set(sidecars.map(dirname))`), which passed VACUOUSLY when the build
255+
// produced ZERO sidecars — exactly what happened in the 2026-06-02 incident:
256+
// a turbo cache replay restored `dist/**` (the declared outputs) but not the
257+
// src/ sidecars, buildStart never ran, this gate said "0 sidecar(s) OK", and
258+
// the downstream tsc failed with a wall of TS2307s. Walking the consumer
259+
// tree directly (every `.rozie` under examples/consumers/ except the
260+
// ANGULAR-EXCEPTION tree, which must NEVER have sidecars) makes a
261+
// zero-sidecar build fail HERE, loudly, with the right message.
253262
const missing = [];
254-
for (const dir of sidecarDirs) {
255-
const roziesHere = walk(dir, (n) => n.endsWith('.rozie'));
256-
for (const r of roziesHere) {
257-
const expected = r.replace(/\.rozie$/, '.d.rozie.ts');
258-
if (!existsSync(expected)) missing.push(`${r} (expected ${expected})`);
259-
}
263+
const consumerRozies = walk(CONSUMERS_DIR, (n) => n.endsWith('.rozie'), [], ['angular-analogjs']);
264+
for (const r of consumerRozies) {
265+
const expected = r.replace(/\.rozie$/, '.d.rozie.ts');
266+
if (!existsSync(expected)) missing.push(`${r} (expected ${expected})`);
260267
}
261268

262269
if (stale.length > 0) {

turbo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"tasks": {
44
"build": {
55
"dependsOn": ["^build"],
6-
"outputs": ["dist/**"]
6+
"outputs": ["dist/**", "src/**/*.d.rozie.ts", "app/**/*.d.rozie.ts"]
77
},
88
"@rozie/runtime-svelte#build": {
99
"dependsOn": ["^build"],

0 commit comments

Comments
 (0)