fix(pid): pid_from_spec refuses non-finite numbers by path and rolls back on any interruption

_num let NaN/inf (and a 400-digit int, as OverflowError) through, so an
INSERT was placed at [nan, 0] and the refusal, when it came, named the
line instead of equipment[0].x. run_spec caught Exception only, so a
CancelledError mid-run left the placed symbols inside an open transaction
(an open undo mark on COM). Finite check in _num; except BaseException.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
Umut CAN
2026-09-18 10:51:45 +03:00
co-authored by Claude Opus 5
parent a51c1b6e14
commit ac1fba80b7
3 changed files with 71 additions and 7 deletions
+7 -5
View File
@@ -6837,11 +6837,13 @@ async def pid_from_spec(
) -> dict:
"""Equipment, valves, instruments and connectors placed, then every line
drawn port-to-port, inside one transaction: any bad item rolls the whole
sheet back and the error names it (`lines[2].to`). The response carries the
graph read back from the drawing and the P&ID critique issues, so the
caller sees dangling ends or duplicate tags in the same round trip.
`dry_run` returns the planned vertices and crossings without touching the
drawing.
sheet back and the error names it (`lines[2].to`); so does an interruption
(a client cancellation mid-run leaves no half-drawn sheet and no open
transaction). A non-finite coordinate, rotation, scale or stub is refused
by path before anything is placed. The response carries the graph read
back from the drawing and the P&ID critique issues, so the caller sees
dangling ends or duplicate tags in the same round trip. `dry_run` returns
the planned vertices and crossings without touching the drawing.
"""
from engineering.pid.spec import run_spec