fix: xref member-mark regex covers single-letter marks; recheck sheet diversity after cap

This commit is contained in:
2026-08-10 11:23:06 -05:00
parent f21eb5d912
commit c8af430143
2 changed files with 32 additions and 2 deletions
+5 -2
View File
@@ -38,7 +38,7 @@ def _xref_keys(assertion: Dict) -> List[str]:
if ref:
keys.append(f"detail:{ref}")
tag = re.sub(r"\s+", "", str(location.get("tag") or "")).upper()
if re.match(r"^[A-Z]{2,}\d", tag): # member marks: HSS16X4X5/8, W12X26, ...
if re.match(r"^[A-Z]+\d", tag): # member marks: W12X26, HSS16X4X5/8, ...
keys.append(f"tag:{tag}")
return keys
@@ -76,9 +76,12 @@ def build_link_scopes(sheets: List[Dict]) -> List[AgentScope]:
sheets_present = {a.get("sheet_number") for a in assertions}
if len(assertions) < 2 or len(sheets_present) < 2:
continue
chunk = assertions[:cap]
if len({a.get("sheet_number") for a in chunk}) < 2:
continue # cap landed on a single sheet — xref adds nothing
scopes.append(AgentScope(
scope_id=f"xref:{key}",
payload={"assertions": assertions[:cap],
payload={"assertions": chunk,
"level": "xref", "family": key},
))
return scopes