Problem
The demo crashes at the end with: Station index -1 is out of range [0, 7).
Root cause
In run-to-catwalk.ts, buildOrchestrator() returns stationIndex = -1 as a sentinel value when the run status is not completed or in_progress (e.g., failed, needs_manual_review).
The initial build path (addOrchestrator() in CatwalkScene.ts) correctly guards against this:
if (config.orchestrator.stationIndex < 0) return;
But the update path (applyDiff()) does NOT guard against it:
if (diff.orchestrator.moved !== null && this.orchestratorRef !== undefined) {
const pos = layout.orchestratorPosition(diff.orchestrator.moved.to); // ← no -1 check
this.orchestratorRef.animateMoveTo(vec(pos.x, pos.y));
}
When the demo transitions from completed (station 6) to a terminal state (station -1), applyDiff() passes -1 to orchestratorPosition(), which calls stationX(-1), which throws the range error.
Fix
Add a guard in applyDiff() for negative station indices. When the orchestrator moves to -1, it should be hidden (fade out + remove) rather than positioned.
Key files
packages/factory/src/client/visualizations/catwalk/scene/CatwalkScene.ts:82-87 — applyDiff() missing guard
packages/factory/src/client/visualizations/catwalk/mappers/run-to-catwalk.ts:181-190 — sentinel -1 value
packages/factory/src/client/visualizations/catwalk/layout/catwalk-layout.ts — stationX() validation
Problem
The demo crashes at the end with:
Station index -1 is out of range [0, 7).Root cause
In
run-to-catwalk.ts,buildOrchestrator()returnsstationIndex = -1as a sentinel value when the run status is notcompletedorin_progress(e.g.,failed,needs_manual_review).The initial build path (
addOrchestrator()inCatwalkScene.ts) correctly guards against this:But the update path (
applyDiff()) does NOT guard against it:When the demo transitions from
completed(station 6) to a terminal state (station -1),applyDiff()passes -1 toorchestratorPosition(), which callsstationX(-1), which throws the range error.Fix
Add a guard in
applyDiff()for negative station indices. When the orchestrator moves to -1, it should be hidden (fade out + remove) rather than positioned.Key files
packages/factory/src/client/visualizations/catwalk/scene/CatwalkScene.ts:82-87—applyDiff()missing guardpackages/factory/src/client/visualizations/catwalk/mappers/run-to-catwalk.ts:181-190— sentinel -1 valuepackages/factory/src/client/visualizations/catwalk/layout/catwalk-layout.ts—stationX()validation