feat: close builder mutation and roundtrip evidence gaps

This commit is contained in:
2026-08-10 21:27:42 -04:00
parent 3907f50ff1
commit 26ea9b57d7
49 changed files with 5797 additions and 687 deletions

View File

@@ -10,6 +10,12 @@ import Sketcher
FREECAD_COMMIT = "0108fd4b4850cc46e625b60e53cea7a7bbe69f8d"
BUILDER_STAGE_TYPES = {
"Part::Fuse", "Part::Cut", "Part::Common", "Part::Extrusion", "Part::Revolution", "Part::Loft", "Part::Sweep", "Part::Fillet", "Part::Chamfer",
"PartDesign::Pad", "PartDesign::Pocket", "PartDesign::Revolution", "PartDesign::Groove", "PartDesign::AdditiveLoft", "PartDesign::SubtractiveLoft",
"PartDesign::AdditivePipe", "PartDesign::SubtractivePipe", "PartDesign::Fillet", "PartDesign::Chamfer", "PartDesign::Draft", "PartDesign::Thickness",
"PartDesign::Mirrored", "PartDesign::MultiTransform", "PartDesign::LinearPattern", "PartDesign::PolarPattern", "PartDesign::Hole",
}
def version_text():
@@ -97,6 +103,7 @@ def stage_report(obj):
native_evidence_complete = True
mapped_name_entries = 0
indexed_name_entries = 0
history_entry_count = 0
for kind, count in (("Face", len(shape.Faces)), ("Edge", len(shape.Edges)), ("Vertex", len(shape.Vertexes))):
for index in range(1, count + 1):
name = "%s%d" % (kind, index)
@@ -109,6 +116,7 @@ def stage_report(obj):
except Exception:
indexed, indexed_ids = "", []
history = history_entry(obj, name)
history_entry_count += len(history)
if not mapped and not indexed:
native_evidence_complete = False
if mapped:
@@ -133,8 +141,14 @@ def stage_report(obj):
"source": "FreeCAD 1.1.1 runtime API",
"mappedNameApiEntries": mapped_name_entries,
"indexedNameApiEntries": indexed_name_entries,
# FreeCAD exposes MappedName only for derived/builder results. Primitive
# and support stages legitimately expose IndexedName without a private
# token; record that boundary explicitly instead of treating it as a
# failed token capture.
"privateTokenEvidenceRequired": mapped_name_entries > 0,
"privateTokenEvidenceComplete": mapped_name_entries == len(native_mapped_names) and mapped_name_entries > 0,
"internalBuilderEvidence": False,
"indexedNameOnly": mapped_name_entries == 0 and indexed_name_entries == len(native_mapped_names) and indexed_name_entries > 0,
"internalBuilderEvidence": obj.TypeId in BUILDER_STAGE_TYPES and history_entry_count > 0 and native_evidence_complete,
"reason": None if native_evidence_complete else "One or more subshapes had no mapped or indexed name from the native API.",
}
return {