Skip to content

Commit 1e88fa2

Browse files
committed
fix(bench): reject missing lockfiles and failed prepares
1 parent f5210b2 commit 1e88fa2

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

bench/pm-bench-phases.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,22 @@ seed_for_phase() {
401401
[ -f aube-lock.yaml ] && cp -f aube-lock.yaml "$LOCK_STASH/aube-lock.yaml"
402402
;;
403403
esac
404+
# A successful lock-generation command is not enough: some PM/config
405+
# combinations can exit zero without writing the expected lockfile. Never
406+
# let prepare fall through and time an install against stale state.
407+
if [[ "$phase" == p3_* || "$phase" == p4_* ]]; then
408+
local expected_lock
409+
case "$pm" in
410+
bun) expected_lock="$LOCK_STASH/bun.lock" ;;
411+
pnpm) expected_lock="$LOCK_STASH/pnpm-lock.yaml" ;;
412+
aube) expected_lock="$LOCK_STASH/aube-lock.yaml" ;;
413+
*) expected_lock="$LOCK_STASH/package-lock.json" ;;
414+
esac
415+
if [ ! -f "$expected_lock" ]; then
416+
echo -e " ${RED}$pm $phase did not produce expected lockfile: $expected_lock${NC}" >&2
417+
return 1
418+
fi
419+
fi
404420
# Phase 4 also needs a pre-warmed cache.
405421
if [[ "$phase" == p4_* ]]; then
406422
local cache
@@ -505,7 +521,10 @@ run_phase_matrix() {
505521
# CDN edge POP populated per PM before any timed window opens.
506522
echo -e " ${CYAN}warmup round${NC} (${live_pms[*]})"
507523
for pm in "${live_pms[@]}"; do
508-
bash "$RESULTS_DIR/prep_${phase}_${pm}.sh" > /dev/null 2>&1 || true
524+
if ! bash "$RESULTS_DIR/prep_${phase}_${pm}.sh" > /dev/null 2>&1; then
525+
echo -e " ${RED}$pm $phase warmup prepare failed — aborting invalid phase${NC}" >&2
526+
return 1
527+
fi
509528
bash "$RESULTS_DIR/cmd_${phase}_${pm}.sh" \
510529
> "$RESULTS_DIR/warmup_${phase}_${pm}.log" 2>&1 || true
511530
done
@@ -527,7 +546,10 @@ run_phase_matrix() {
527546
fi
528547
echo -e " ${CYAN}round $r/$runs${NC} (${round_order[*]})"
529548
for pm in "${round_order[@]}"; do
530-
bash "$RESULTS_DIR/prep_${phase}_${pm}.sh" > /dev/null 2>&1 || true
549+
if ! bash "$RESULTS_DIR/prep_${phase}_${pm}.sh" > /dev/null 2>&1; then
550+
echo -e " ${RED}$pm $phase round $r prepare failed — aborting invalid phase${NC}" >&2
551+
return 1
552+
fi
531553
if ! bash "$METRICS_WRAPPER" \
532554
"$RESULTS_DIR/${PROJECT}_${phase}_${pm}_metrics.jsonl" \
533555
bash "$RESULTS_DIR/cmd_${phase}_${pm}.sh" \

0 commit comments

Comments
 (0)