Treat finished PCB review as complete, not a raw SSE error.

The status watcher synthesized pcb_error with pcb_status=complete (terminal)
when the worker finished before pcb_complete arrived. Map that hatch to
pcb_complete, publish the event before flipping status, and send /pcb to
the layout report tree.
This commit is contained in:
2026-09-20 10:23:53 +02:00
parent 1f3876eadc
commit 187605763d
6 changed files with 136 additions and 22 deletions
+9 -9
View File
@@ -892,16 +892,16 @@ async def pcb_events(project_id: str, request: Request):
if crash_detected["reason"] is not None:
cur = proj_svc.get_project(storage, owner_user_id, project_id)
err = None
if cur and cur.pcb_state:
err = cur.pcb_state.get("error")
from backend.services.pcb_pipeline import pcb_sse_terminal_from_status
ev, payload = pcb_sse_terminal_from_status(
cur.pcb_status if cur else None,
cur.pcb_state if cur else None,
crash_detected["reason"],
)
yield {
"event": "pcb_error",
"data": json.dumps({
"error": err or crash_detected["reason"]
or "pcb worker terminated without a terminal event",
"synthetic": True,
}),
"event": ev,
"data": json.dumps(payload),
}
finally:
watcher.cancel()