Skip to content

Commit 2cd07a4

Browse files
committed
Keep release gates from masking CI regressions
Install browser dependencies before DOM contract tests, make the daemon chaos process probe count only real Node daemons, and document both failures as release blockers. Constraint: GitHub Actions clean runners do not have Playwright Chromium installed after bun install. Rejected: Rerun failed releases without code changes | old runs showed repeat failures on the same two suites. Confidence: high Scope-risk: narrow Directive: Treat daemon-chaos and render-dom failures as release blockers before tagging or publishing. Tested: bunx playwright install chromium; bun run build; bash -n scripts/pre-release-check.sh; bun tests/daemon-chaos.test.ts; bun tests/contract/render-dom.test.ts; bunx prettier --check tests/daemon-chaos.test.ts Not-tested: actionlint unavailable locally
1 parent e1fed4a commit 2cd07a4

6 files changed

Lines changed: 57 additions & 24 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ jobs:
2222
- uses: oven-sh/setup-bun@v2
2323

2424
- run: bun install --frozen-lockfile
25+
- run: bunx playwright install --with-deps chromium
2526
- run: bun run build
2627
- run: bun run format:check
2728
- run: bun run lint

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- uses: oven-sh/setup-bun@v2
2424

2525
- run: bun install --frozen-lockfile
26+
- run: bunx playwright install --with-deps chromium
2627
- run: bun run build
2728
- run: bun run format:check
2829
- run: bun run lint

‎docs/guides/BEST-PRACTICES.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ private async save(data: Data): Promise<void> {
314314

315315
Before release, verify:
316316

317+
- [ ] `scripts/pre-release-check.sh` passes before tagging or publishing
318+
- [ ] `tests/daemon-chaos.test.ts` passes; daemon spawn races block release
319+
- [ ] `tests/contract/render-dom.test.ts` passes with Playwright Chromium installed
317320
- [ ] All methods have JSDoc with descriptions
318321
- [ ] All parameters are documented
319322
- [ ] Error cases throw descriptive errors

‎scripts/pre-release-check.sh‎

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,21 @@ fi
143143
echo " ✓ bun install dry-run passes (bun.lock in sync)"
144144
echo ""
145145

146-
# ─── 3. Build verification ───────────────────────────
147-
echo "▶ Step 3: Full build"
146+
# ─── 3. CI browser dependency pre-flight ─────────────
147+
echo "▶ Step 3: CI browser dependency"
148+
bunx playwright install --with-deps chromium
149+
echo " ✓ Playwright Chromium is installed for DOM contract tests"
150+
echo ""
151+
152+
# ─── 4. Build verification ───────────────────────────
153+
echo "▶ Step 4: Full build"
148154
bun run build
149155
bun run build:beam
150156
echo " ✓ Build passes"
151157
echo ""
152158

153-
# ─── 3. Test suite ───────────────────────────────────
154-
echo "▶ Step 4: Test suite"
159+
# ─── 5. Test suite ───────────────────────────────────
160+
echo "▶ Step 5: Test suite"
155161
if [ "${PHOTON_RELEASE_ASSUME_TESTED:-}" = "1" ]; then
156162
echo " ✓ Tests already passed in this release session"
157163
else
@@ -160,8 +166,15 @@ else
160166
fi
161167
echo ""
162168

163-
# ─── 5. Yield pattern check ─────────────────────────
164-
echo "▶ Step 5: Yield pattern verification"
169+
# ─── 6. Release-blocker regression checks ────────────
170+
echo "▶ Step 6: Release-blocker regressions"
171+
bun tests/daemon-chaos.test.ts
172+
bun tests/contract/render-dom.test.ts
173+
echo " ✓ Daemon spawn-race and DOM rendering regressions pass"
174+
echo ""
175+
176+
# ─── 7. Yield pattern check ─────────────────────────
177+
echo "▶ Step 7: Yield pattern verification"
165178
# Check multi-line yields: line with 'yield {' must be followed by emit:/ask:/checkpoint:
166179
# Uses awk to pair yield lines with their next line
167180
# Check that each 'yield {' has emit:/ask:/checkpoint: on same line or next line
@@ -186,8 +199,8 @@ fi
186199
echo " ✓ All generator yields use emit pattern"
187200
echo ""
188201

189-
# ─── 6. Dependency audit ────────────────────────────
190-
echo "▶ Step 6: Runtime dependency check"
202+
# ─── 8. Dependency audit ────────────────────────────
203+
echo "▶ Step 8: Runtime dependency check"
191204
# Check that key runtime imports are in dependencies, not devDependencies
192205
DEPS=$(node -e "const p=require('./package.json'); console.log(Object.keys(p.dependencies||{}).join(' '))")
193206
MISSING=""
@@ -203,8 +216,8 @@ fi
203216
echo " ✓ Runtime dependencies present"
204217
echo ""
205218

206-
# ─── 7. Fresh install simulation ────────────────────
207-
echo "▶ Step 7: Fresh install simulation"
219+
# ─── 9. Fresh install simulation ────────────────────
220+
echo "▶ Step 9: Fresh install simulation"
208221
FRESH_DIR=$(mktemp -d)
209222
FRESH_HOME="$FRESH_DIR/.photon-home"
210223
export PHOTON_DIR="$FRESH_DIR"
@@ -218,7 +231,7 @@ cleanup_fresh() {
218231
}
219232
trap cleanup_fresh EXIT
220233

221-
# Test 6a: Beam starts with only internal photons
234+
# Test 9a: Beam starts with only internal photons
222235
echo " Testing Beam startup..."
223236
BEAM_LOG=$(mktemp)
224237
PHOTON_DIR="$FRESH_DIR" PHOTON_HOME="$FRESH_HOME" node dist/cli.js beam > "$BEAM_LOG" 2>&1 &
@@ -259,7 +272,7 @@ fi
259272
echo " ✓ No errors during startup"
260273
rm -f "$BEAM_LOG"
261274

262-
# Test 6b: Marketplace search works
275+
# Test 9b: Marketplace search works
263276
echo " Testing marketplace search..."
264277
SEARCH_OUT=$(PHOTON_DIR="$FRESH_DIR" PHOTON_HOME="$FRESH_HOME" node dist/cli.js search web 2>&1)
265278
if echo "$SEARCH_OUT" | grep -q "web"; then
@@ -270,7 +283,7 @@ else
270283
exit 1
271284
fi
272285

273-
# Test 6c: Photon install works
286+
# Test 9c: Photon install works
274287
echo " Testing photon install..."
275288
ADD_OUT=$(PHOTON_DIR="$FRESH_DIR" PHOTON_HOME="$FRESH_HOME" node dist/cli.js add web 2>&1)
276289
if echo "$ADD_OUT" | grep -q "Added web"; then
@@ -286,9 +299,9 @@ rm -rf "$FRESH_DIR"
286299
unset PHOTON_DIR
287300
unset PHOTON_HOME
288301

289-
# ─── 8. Visual tests (optional — requires lookout + MLX) ────
302+
# ─── 10. Visual tests (optional — requires lookout + MLX) ────
290303
echo ""
291-
echo "▶ Step 8: Visual tests (lookout AI)"
304+
echo "▶ Step 10: Visual tests (lookout AI)"
292305
if command -v photon >/dev/null 2>&1 && photon lookout status -y 2>/dev/null | grep -q '"ready": true\|ready.*true'; then
293306
echo " Lookout available — running visual tests..."
294307
bun run test:visual
@@ -297,16 +310,16 @@ else
297310
echo " ⏭ Lookout not available (no MLX or photon not installed) — skipping"
298311
fi
299312

300-
# ─── 9. Promise validation (core intents — release gate) ────
313+
# ─── 11. Promise validation (core intents — release gate) ────
301314
echo ""
302-
echo "▶ Step 9: Promise validation"
303-
echo " ✓ Platform promises validated by Step 4 full suite"
315+
echo "▶ Step 11: Promise validation"
316+
echo " ✓ Platform promises validated by Step 5 full suite"
304317
# Restore test fixture data files
305318
git checkout -- tests/fixtures/.data/ 2>/dev/null || true
306319

307-
# ─── 10. Global install simulation ────
320+
# ─── 12. Global install simulation ────
308321
echo ""
309-
echo "▶ Step 10: Global install simulation"
322+
echo "▶ Step 12: Global install simulation"
310323
PACK_TGZ=$(bun pm pack --quiet 2>/dev/null | tail -1)
311324
PACK_ABS="$(pwd)/$PACK_TGZ"
312325
if [ -f "$PACK_ABS" ]; then
@@ -327,9 +340,9 @@ else
327340
echo " ⏭ bun pack failed — skipping install test"
328341
fi
329342

330-
# ─── 10. Production dependency verification ────
343+
# ─── 13. Production dependency verification ────
331344
echo ""
332-
echo "▶ Step 11: Production dependency verification"
345+
echo "▶ Step 13: Production dependency verification"
333346
PROD_DIR=$(mktemp -d)
334347
PACK_CHECK=$(bun pm pack --quiet 2>/dev/null | tail -1)
335348
if [ -f "$PACK_CHECK" ]; then

‎tests/daemon-chaos.test.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ function daemonPid() {
8989
9090
function daemonProcessCount() {
9191
try {
92-
const out = execSync('pgrep -f "daemon/server.js ' + sockPath + '"', { encoding: 'utf-8' });
93-
return out.trim().split('\\n').filter(Boolean).length;
92+
const out = execSync('ps -eo pid=,args=', { encoding: 'utf-8' });
93+
return out
94+
.trim()
95+
.split('\\n')
96+
.filter((line) => line.includes('daemon/server.js ' + sockPath))
97+
.filter((line) => /\\bnode\\b/.test(line) || /\\/node\\b/.test(line))
98+
.length;
9499
} catch { return 0; }
95100
}
96101

‎wiki/conformance-and-enforcement.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ chain: registry declares coverage, conformance proves transport,
9393
this proves data reaches the DOM. chart:* asserts on its offline data
9494
table fallback.
9595

96+
Release gate: CI, Release, and `scripts/pre-release-check.sh` must install
97+
Playwright Chromium before the suite runs. A missing browser is a release
98+
blocker, not a flaky test to rerun around, because it means DOM contract
99+
coverage did not execute on the release surface.
100+
96101
## Daemon Chaos Suite
97102

98103
`tests/daemon-chaos.test.ts` inflicts the daemon's historical failure
@@ -103,6 +108,11 @@ to clean-boot state. Scenario 5 cache-busts the photon source so the
103108
respawn recompiles through cwd-sensitive child processes (verified red
104109
without the chdir fix).
105110

111+
Release gate: every release must address failures here before tagging or
112+
publishing. The spawn-race scenario protects the one-daemon-per-HOME
113+
contract; if it fails, fix daemon startup or the process-count assertion
114+
with evidence before proceeding.
115+
106116
## Identity Module
107117

108118
`src/shared/identity.ts` owns every compound photon identity format:

0 commit comments

Comments
 (0)