Strengthen pintable layout_rules skill and refresh empty extractions.

Treat PCB/application layout guidance as a first-class extract, keep those pages in PDF trim, and re-run IC extraction once when rules are still empty under older model_version.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-13 18:01:15 +02:00
co-authored by Cursor
parent 86121e6547
commit 21e2be1cd0
10 changed files with 332 additions and 64 deletions
+56
View File
@@ -93,6 +93,62 @@ def validate(data: dict) -> list[str]:
kind = row.get("kind")
if kind not in kinds:
errors.append(f"layout_rules[{i}] unknown kind: {kind!r}")
continue
dist = row.get("max_distance_mm")
if dist is not None and dist is not False:
if isinstance(dist, bool):
errors.append(
f"layout_rules[{i}].max_distance_mm must be a number or null"
)
elif isinstance(dist, (int, float)):
if float(dist) <= 0:
errors.append(
f"layout_rules[{i}].max_distance_mm must be > 0"
)
else:
try:
v = float(str(dist).strip())
except (TypeError, ValueError):
errors.append(
f"layout_rules[{i}].max_distance_mm must be numeric "
f"or null (got {dist!r}) — do not invent distances; "
f"use null when the PDF only says 'close'"
)
else:
if v <= 0:
errors.append(
f"layout_rules[{i}].max_distance_mm must be > 0"
)
via = row.get("min_via_count")
if via is not None and via is not False and not isinstance(via, bool):
if isinstance(via, int):
if via <= 0:
errors.append(
f"layout_rules[{i}].min_via_count must be > 0"
)
else:
try:
iv = int(float(str(via).strip()))
except (TypeError, ValueError):
errors.append(
f"layout_rules[{i}].min_via_count must be an integer "
f"or null (got {via!r})"
)
else:
if iv <= 0:
errors.append(
f"layout_rules[{i}].min_via_count must be > 0"
)
page = row.get("source_page")
if page is not None and not isinstance(page, int):
errors.append(
f"layout_rules[{i}].source_page must be an integer or null"
)
same = row.get("same_layer")
if same is not None and not isinstance(same, bool):
errors.append(
f"layout_rules[{i}].same_layer must be a boolean or null"
)
return errors