Files
yiyezhqiu-refactored/tools/acceptance/native_features.py
T

444 lines
28 KiB
Python

"""Plan and verify real DxDesigner acceptance operations; never attaches to COM.
Only run rendered scripts through run_dx_script.py --pid 81576. The VBS
checks the acceptance project before selecting or changing native objects.
"""
from __future__ import annotations
import argparse
from dataclasses import asdict, replace
from datetime import datetime, timezone
import hashlib
import json
from pathlib import Path
import re
import sys
import traceback
REPO = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(REPO / "src"))
from dx_productivity.bridge.protocol import atomic_write_text, load_apply_status, load_request, schedule_sha256, write_apply_request, write_schedule
from dx_productivity.bridge.run_store import RunStore
from dx_productivity.domain.models import AnnotationPlan, AnnotationSettings, ApplyRequest, HistoryEntry, OpType, PlanRow, ProcessingMode, Scope
from dx_productivity.domain.planner import build_annotation_plan
from dx_productivity.domain.restore import build_restore_plan
from dx_productivity.domain.schedule import build_apply_schedule
from dx_productivity.features.property_change import PropertyChangeSettings, build_property_change_plan
from dx_productivity.features.property_visibility import PropertyVisibilitySettings, build_property_visibility_plan
from dx_productivity.features.inspection import missing_attribute_values, net_list, solitary_nets, net_cross_page
BASE = Path(r"C:\Users\ABS_Windows\AppData\Local\DxProductivity\acceptance\native-20261010\native-feature-tests")
MAILBOX = BASE / "mailbox"
CAP = "$5I2744"
INDUCTOR = "$5I2942"
GRAPHIC = "$5I2738"
OTHER_CAP = "$5I2745"
def dump(path, data):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(json.dumps(data, ensure_ascii=False, indent=2, default=str), encoding="utf-8")
def vbs(value):
chunks, current = [], ""
for char in str(value):
if ord(char) < 128:
current += char
else:
if current:
chunks.append('"' + current.replace('"', '""') + '"')
current = ""
code = ord(char) if ord(char) < 32768 else ord(char) - 65536
chunks.append(f"ChrW({code})")
if current or not chunks:
chunks.append('"' + current.replace('"', '""') + '"')
return " & ".join(chunks)
def render(case):
case_dir = BASE / case
case_dir.mkdir(parents=True, exist_ok=True)
MAILBOX.mkdir(parents=True, exist_ok=True)
for name in ("host-trace.txt", "apply-status.json", "claimed-schedule.tsv", "verified.json", "verify-error.txt", "stage-error.txt", "after.json"):
(case_dir / name).unlink(missing_ok=True)
core = REPO / "integration" / "dxdesigner795"
source = '\n'.join((core / path).read_text(encoding="utf-8") for path in (
"BridgeCommon.vbs", "core/Snapshot.vbs", "core/Transaction.vbs", "core/Mailbox.vbs",
))
if case == "locate":
source = source.replace('If InStr(bridgeId, "net|") = 1 Then',
'nTrace = nTrace & "LOCATE_REQUEST=" & bridgeId & " map=" & CStr(objectMap.Exists(bridgeId)) & vbLf\n If InStr(bridgeId, "net|") = 1 Then')
source = source.replace('Sub DxBridgeLocateComponent(component)\n',
'Sub DxBridgeLocateComponent(component)\n nTrace = nTrace & "LOCATOR_ARG_TYPE=" & TypeName(component) & vbLf\n')
source = source.replace('targetUid = CStr(component.UID)',
'targetUid = CStr(component.UID)\n nTrace = nTrace & "LOCATOR_UID=" & targetUid & " err=" & CStr(Err.Number) & " " & Err.Description & vbLf')
source = source.replace('visibleComponent.Selected = True',
'visibleComponent.Selected = True\n nTrace = nTrace & "SET_VISIBLE_COMPONENT=" & CStr(visibleComponent.UID) & " err=" & CStr(Err.Number) & " " & Err.Description & vbLf')
command = f'"{sys.executable}" "{Path(__file__).resolve()}" stage {case}'
check = f'"{sys.executable}" "{Path(__file__).resolve()}" verify {case}'
if case == "cycle" or case == "restore-cycle":
selected = (CAP, OTHER_CAP)
elif case.startswith("refdes") or case.startswith("restore-refdes"):
selected = (CAP, INDUCTOR)
else:
selected = (CAP, INDUCTOR, GRAPHIC)
matches = " Or ".join(f"CStr(nComp.UID) = {vbs(uid)}" for uid in selected)
terminal = f'''
Dim nTrace, nError, nDescription
nTrace = ""
On Error Resume Next
Call NativeAcceptanceMain()
nError = Err.Number
nDescription = Err.Description
Err.Clear
On Error GoTo 0
Call DxToolsWriteUtf8Atomic({vbs(case_dir / 'host-trace.txt')}, nTrace & "ERROR=" & CStr(nError) & " " & nDescription & vbLf)
Sub NativeAcceptanceMain()
Dim nProject, nFso, nShell, nObjects, nOriginals, nAfterObjects, nAfterOriginals
Dim nRoot, nRunId, nSnapshotId, nComp, nResult, nState, nClaim, nNumber, nMessage, nNet
Dim nLocated, nFixtureValue, nFixtureComponent
nProject = Application.GetProjectData().GetProjectFilePath()
If InStr(1, nProject, "\\acceptance\\native-20261010\\", vbTextCompare) = 0 Then Err.Raise 999, "Acceptance", "Wrong host"
nTrace = "PROJECT=" & nProject & vbLf
Application.PushPath "1GPHY_RTL8211F", "", "GE_PHY_8211"
ActiveView.Block.DeSelectAll
For Each nComp In ActiveView.Query(VDM_COMP, VD_ALL)
If {matches} Then nComp.Selected = True
Next
Set nFso = CreateObject("Scripting.FileSystemObject")
Set nShell = CreateObject("WScript.Shell")
Set nObjects = CreateObject("Scripting.Dictionary")
Set nOriginals = CreateObject("Scripting.Dictionary")
nRoot = {vbs(MAILBOX)}
nRunId = "native-81576"
If Not DxRefreshSnapshot(nRoot, nRunId, nObjects, nOriginals, nSnapshotId) Then Err.Raise 998, "Acceptance", "Snapshot failed"
nFso.CopyFile nRoot & "\\request.json", {vbs(case_dir / 'before.json')}, True
nTrace = nTrace & "BEFORE=" & nSnapshotId & " objects=" & CStr(nObjects.Count) & vbLf
nResult = nShell.Run({vbs(command)}, 0, True)
nTrace = nTrace & "PYTHON_STAGE=" & CStr(nResult) & vbLf
If nResult <> 0 Then Exit Sub
If {vbs(case)} = "value-stale" Then
For Each nComp In nObjects.Items
If CStr(nComp.UID) = "$5I2744" Then
Set nFixtureComponent = nComp
nFixtureValue = CStr(nComp.FindAttribute("Value").Value)
nComp.FindAttribute("Value").Value = "native-external-edit"
End If
Next
nTrace = nTrace & "INJECTED_REAL_EXTERNAL_EDIT=native-external-edit" & vbLf
End If
If {vbs(case)} = "locate" Then
For Each nComp In ActiveView.Query(VDM_COMP, VD_ALL)
nComp.Selected = False
If CStr(nComp.UID) = "$5I2942" Then nComp.Selected = True
Next
For Each nNet In ActiveView.Query(VDM_NET, VD_ALL)
nNet.Selected = False
Next
nNumber = 0
For Each nComp In ActiveView.Query(VDM_COMP, VD_SELECTED)
nTrace = nTrace & "BEFORE_LOCATE_COMPONENT=" & CStr(nComp.UID) & vbLf
nNumber = nNumber + 1
Next
If nNumber <> 1 Then Err.Raise 994, "Acceptance", "Locator fixture selection failed"
Call DxBridgeConsumeLocate(nRoot, nObjects)
nLocated = False
nNumber = 0
For Each nComp In ActiveView.Query(VDM_COMP, VD_SELECTED)
nTrace = nTrace & "LOCATED_COMPONENT=" & CStr(nComp.UID) & " " & CStr(nComp.Refdes) & vbLf
If CStr(nComp.UID) = "$5I2744" Then nLocated = True
nNumber = nNumber + 1
Next
If Not nLocated Or nNumber <> 1 Then Err.Raise 995, "Acceptance", "Component locator did not exclusively select the expected component"
Call DxToolsWriteUtf8Atomic(nRoot & "\\locate.tsv", "net|GND|1" & vbLf)
Call DxBridgeConsumeLocate(nRoot, nObjects)
For Each nNet In ActiveView.Query(VDM_NET, VD_SELECTED)
nTrace = nTrace & "LOCATED_NET=" & CStr(nNet.LogicalNetName) & vbLf
Next
End If
nState = "no-apply"
If nFso.FileExists(nRoot & "\\result.tsv") Then
nClaim = DxBridgeClaimFile(nFso, nRoot & "\\result.tsv", nRoot & "\\result.processing")
nTrace = nTrace & "CLAIM=" & CStr(nClaim) & vbLf
If Not nClaim Then Err.Raise 997, "Acceptance", "Claim failed"
On Error Resume Next
nState = DxProcessApply(nRoot, nRunId, nSnapshotId, nObjects, nOriginals)
nNumber = Err.Number
nMessage = Err.Description
Err.Clear
On Error GoTo 0
nTrace = nTrace & "TRANSACTION_ERROR=" & CStr(nNumber) & " " & nMessage & vbLf
End If
nTrace = nTrace & "STATE=" & nState & vbLf
If nFso.FileExists(nRoot & "\\apply-status.json") Then nFso.CopyFile nRoot & "\\apply-status.json", {vbs(case_dir / 'apply-status.json')}, True
If nFso.FileExists(nRoot & "\\result.processing") Then nFso.CopyFile nRoot & "\\result.processing", {vbs(case_dir / 'claimed-schedule.tsv')}, True
Set nAfterObjects = CreateObject("Scripting.Dictionary")
Set nAfterOriginals = CreateObject("Scripting.Dictionary")
If Not DxRefreshSnapshot(nRoot, nRunId, nAfterObjects, nAfterOriginals, nSnapshotId) Then Err.Raise 996, "Acceptance", "Readback snapshot failed"
nFso.CopyFile nRoot & "\\request.json", {vbs(case_dir / 'after.json')}, True
nResult = nShell.Run({vbs(check)}, 0, True)
nTrace = nTrace & "PYTHON_VERIFY=" & CStr(nResult) & vbLf
If {vbs(case)} = "value-stale" Then
nFixtureComponent.FindAttribute("Value").Value = nFixtureValue
nTrace = nTrace & "EXTERNAL_EDIT_FIXTURE_RESTORED=" & CStr(nFixtureComponent.FindAttribute("Value").Value) & vbLf
End If
End Sub
'''
script = case_dir / "run-native.vbs"
script.write_text(source + terminal, encoding="ascii")
print(script)
def operation_value(component, op, name):
if op == OpType.REFDES:
return component.refdes
attr = next((a for a in component.attributes if a.name.casefold() == name.casefold()), None)
if attr is None:
return None
return ("1" if attr.visible else "0") if op == OpType.PROPERTY_VISIBILITY else attr.value
def restore_from(snapshot, name, store):
prior = json.loads((BASE / name / "plan.json").read_text(encoding="utf-8"))
backup = Path(prior["backup_path"])
entry = HistoryEntry(datetime.now(timezone.utc), snapshot.run_id, snapshot.design_id, backup, "applied", 1)
return build_restore_plan(snapshot, store.build_restore_settings(entry))
def stage(case):
case_dir = BASE / case
snapshot = load_request(case_dir / "before.json")
for name in ("apply-status.json", "apply-request.json", "result.tsv", "result.processing"):
(MAILBOX / name).unlink(missing_ok=True)
selected = tuple(c for c in snapshot.components if c.selected)
by_uid = {c.stable_uid: c for c in snapshot.components}
store = RunStore(BASE / "store")
plan = None
expected_state = "applied"
if case in {"refdes", "refdes-repeat", "refdes-default-red"}:
plan = build_annotation_plan(snapshot, AnnotationSettings(
scope=Scope.SELECTED, processing_mode=ProcessingMode.REANNOTATE,
start_number=7000 if case != "refdes-repeat" else 8000,
))
elif case.startswith("restore-"):
plan = restore_from(snapshot, case.removeprefix("restore-"), store)
elif case in {"value", "value1", "part-number", "missing-skip", "value-empty", "value1-empty"}:
prop = {"value": "Value", "value1": "Value1", "part-number": "Part Number", "missing-skip": "Definitely Missing", "value-empty": "Value", "value1-empty": "Value1"}[case]
plan = build_property_change_plan(snapshot, PropertyChangeSettings(prop,
tuple((c.bridge_id, "" if case.endswith("empty") else f"native-{case}-changed") for c in selected)))
elif case in {"part-name-show", "part-name-hide", "part-label-show", "part-label-hide"}:
prop = "Part Name" if case.startswith("part-name") else "Part Label"
plan = build_property_visibility_plan(snapshot, PropertyVisibilitySettings(prop, case.endswith("show")))
elif case in {"stale", "digest", "rollback", "cycle", "project-stale", "value-stale"}:
cap = by_uid[CAP]
rows = []
if case == "cycle":
other = by_uid[OTHER_CAP]
for comp, target in ((cap, other.refdes), (other, cap.refdes)):
prefix = re.match(r"[A-Za-z]+", comp.refdes).group(0)
rows.append(PlanRow(comp.stable_uid, (comp.bridge_id,), comp.full_path, prefix,
comp.refdes, target, "pending", True))
else:
rows.append(PlanRow("native-value", (cap.bridge_id,), cap.full_path, None,
operation_value(cap, OpType.PROPERTY_VALUE, "Value"), "native-failure-probe", "pending", True,
op=OpType.PROPERTY_VALUE, property_name="Value"))
if case == "rollback":
rows.append(PlanRow("native-visibility", (cap.bridge_id,), cap.full_path, None,
operation_value(cap, OpType.PROPERTY_VISIBILITY, "Part Name"), "not-a-boolean", "pending", True,
op=OpType.PROPERTY_VISIBILITY, property_name="Part Name"))
plan = AnnotationPlan(snapshot.snapshot_id, tuple(rows), (), build_apply_schedule(tuple(rows)))
expected_state = "rolled-back" if case == "rollback" else ("applied" if case == "cycle" else "rejected")
elif case.startswith("inspection") or case == "locate":
audit = {
"nets": [asdict(row) for row in net_list(snapshot)],
"solitary": [asdict(row) for row in solitary_nets(snapshot)],
"value_missing_empty": [asdict(row) for row in missing_attribute_values(snapshot, "Value")],
"value_missing_all": [asdict(row) for row in missing_attribute_values(snapshot, "Value", include_missing=True)],
"value1_missing_empty": [asdict(row) for row in missing_attribute_values(snapshot, "Value1")],
"value1_missing_all": [asdict(row) for row in missing_attribute_values(snapshot, "Value1", include_missing=True)],
"gnd_pages": [asdict(row) for row in net_cross_page(snapshot, "GND")],
}
dump(case_dir / "inspection.json", audit)
if case == "locate":
atomic_write_text(MAILBOX / "locate.tsv", by_uid[CAP].bridge_id + "\n")
else:
raise ValueError(case)
report = {"case": case, "expected_state": expected_state, "snapshot_id": snapshot.snapshot_id,
"design_path": snapshot.design_path, "component_count": len(snapshot.components), "net_count": len(snapshot.nets),
"selected": [{"bridge_id": c.bridge_id, "uid": c.stable_uid, "refdes": c.refdes, "symbol_default": c.symbol_refdes_default} for c in selected],
"rows": [], "schedule": [], "issues": [], "backup_path": None}
if plan is not None:
report.update(rows=[asdict(row) for row in plan.rows], schedule=[asdict(step) for step in plan.schedule], issues=[asdict(issue) for issue in plan.issues])
if plan.can_apply:
backup = store.write_backup(snapshot, plan)
request = ApplyRequest(2, snapshot.run_id, "stale-id" if case == "stale" else snapshot.snapshot_id,
backup.resolve(), schedule_sha256(plan.schedule))
write_apply_request(MAILBOX / "apply-request.json", request)
write_schedule(MAILBOX / "result.tsv", plan.schedule)
if case == "project-stale":
request_data = json.loads((MAILBOX / "request.json").read_text(encoding="utf-8-sig"))
request_data["design_path"] = str(BASE / "different-copy.prj")
dump(MAILBOX / "request.json", request_data)
if case == "digest":
with (MAILBOX / "result.tsv").open("a", encoding="utf-8") as handle:
handle.write("\n")
report["backup_path"] = str(backup)
report["schedule_sha256"] = request.schedule_sha256
(case_dir / "apply-request.json").write_bytes((MAILBOX / "apply-request.json").read_bytes())
else:
report["expected_state"] = "no-apply"
else:
report["expected_state"] = "no-apply"
dump(case_dir / "plan.json", report)
def verify(case):
case_dir = BASE / case
before = load_request(case_dir / "before.json")
after = load_request(case_dir / "after.json")
report = json.loads((case_dir / "plan.json").read_text(encoding="utf-8"))
old_by_uid = {c.stable_uid: c for c in before.components}
new_by_uid = {c.stable_uid: c for c in after.components}
assert set(old_by_uid) == set(new_by_uid), "Native component identities changed"
assert len(after.components) == 114
assert len(after.nets) == 56
assert after.current_sheet_name == "GE_PHY_8211"
assert after.current_sheet_number == 1
if case == "inspection-final":
baseline = load_request(BASE / "refdes" / "before.json")
for original in baseline.components:
current = new_by_uid[original.stable_uid]
assert current.refdes == original.refdes, (original.stable_uid, "final reference mismatch")
assert (current.x, current.y) == (original.x, original.y)
attribute_state = lambda comp: sorted((a.name.casefold(), a.value, a.visible) for a in comp.attributes)
assert attribute_state(current) == attribute_state(original), (original.stable_uid, "final attribute mismatch")
if case == "locate":
assert "GND" in after.selected_nets
assert report["expected_state"] == "no-apply" or (case_dir / "apply-status.json").is_file(), "Native apply did not publish a status"
status = load_apply_status(case_dir / "apply-status.json") if (case_dir / "apply-status.json").is_file() else None
if status is not None:
assert status.state == report["expected_state"], asdict(status)
actual_digest = hashlib.sha256((case_dir / "claimed-schedule.tsv").read_bytes()).hexdigest()
assert (actual_digest == report["schedule_sha256"]) != (case == "digest")
assert Path(report["backup_path"]).is_file()
backup_changes = json.loads(Path(report["backup_path"]).read_text(encoding="utf-8"))["changes"]
for change in backup_changes:
original = old_by_uid[change["stable_uid"]]
assert operation_value(original, OpType(change["op"]), change["property"]) == change["old_value"]
if case == "rollback":
assert status.rollback_state == "verified"
assert status.failing_sequence == 2
RunStore(BASE / "store").record_status(status, before.design_id)
touched = {}
records = []
for row in report["rows"]:
if not row["changed"]:
continue
for bridge_id in row["bridge_ids"]:
original = next(c for c in before.components if c.bridge_id == bridge_id)
current = new_by_uid[original.stable_uid]
op = OpType(row["op"])
target = row["new_refdes"] if report["expected_state"] == "applied" else row["old_refdes"]
if case == "value-stale":
target = "native-external-edit"
actual = operation_value(current, op, row["property_name"])
assert actual == target, (original.stable_uid, op, actual, target)
touched.setdefault(original.stable_uid, set()).add((op, row["property_name"].casefold()))
records.append({"uid": original.stable_uid, "before_refdes": original.refdes, "after_refdes": current.refdes,
"op": op.value, "property": row["property_name"], "old": row["old_refdes"], "expected": target, "actual": actual})
for uid, original in old_by_uid.items():
current = new_by_uid[uid]
changes = touched.get(uid, set())
assert (current.x, current.y) == (original.x, original.y)
if (OpType.REFDES, "") not in changes:
assert current.refdes == original.refdes, (uid, "unexpected reference change")
for attribute in original.attributes:
if attribute.name.casefold() == "ref designator" and (OpType.REFDES, "") in changes:
continue
assert operation_value(current, OpType.PROPERTY_VALUE, attribute.name) == attribute.value or (OpType.PROPERTY_VALUE, attribute.name.casefold()) in changes
assert operation_value(current, OpType.PROPERTY_VISIBILITY, attribute.name) == ("1" if attribute.visible else "0") or (OpType.PROPERTY_VISIBILITY, attribute.name.casefold()) in changes
dump(case_dir / "verified.json", {"case": case, "state": status.state if status else "no-apply", "status": asdict(status) if status else None,
"records": records, "integrity": "All 114 identities/positions and untouched references/attributes match before snapshot",
"native_pid": 81576, "current_sheet": after.current_sheet_name, "net_count": len(after.nets)})
def summary(_case):
cases = []
for folder in sorted(BASE.iterdir()):
verified = folder / "verified.json"
if not verified.is_file():
continue
trace = (folder / "host-trace.txt").read_text(encoding="utf-8")
assert "PYTHON_VERIFY=0" in trace and "ERROR=0" in trace, folder
data = json.loads(verified.read_text(encoding="utf-8"))
data["evidence_path"] = str(folder)
cases.append(data)
assert len(cases) == 35
counts = {state: sum(item["state"] == state for item in cases) for state in ("applied", "rejected", "rolled-back", "no-apply")}
inspection = json.loads((BASE / "inspection" / "inspection.json").read_text(encoding="utf-8"))
data = {"native_pid": 81576, "project_path": str(BASE.parent / "1GPHY_RTL8211F" / "1GPHY_RTL8211F.prj"),
"passed_cases": len(cases), "states": counts, "component_count": 114, "net_count": 56,
"final_integrity": "inspection-final compares all references, component positions and attribute values/visibility to refdes/before baseline",
"fixture_note": "Value1=native-baseline was created only on the acceptance copy using real AddAttribute(String, X, Y, Visibility)",
"inspection_counts": {key: len(value) for key, value in inspection.items()}, "cases": cases}
dump(BASE / "native-feature-summary.json", data)
lines = [
"# DxDesigner native acceptance — 2026-10-10/11", "",
"**35 real native cases verified:** 26 applied transactions, four rejected requests, one verified rollback, and four inspection/location/no-change cases.", "",
f"Sole target was PID 81576 at `{data['project_path']}`. Each script checked the acceptance project path before mutation. No command was routed to original PID 68000 or the root's separate PID 45864.", "",
"The native VBS exported actual snapshot/maps, invoked the source Python planner and RunStore, claimed result.tsv as result.processing, executed actual DxProcessApply, and exported actual readback. Every applied/rejected/rollback case checked the real schedule digest and persisted backup. No fake objects substituted for the native transaction or native readback.", "",
"| Case | Actual state | Verified target records | Evidence |", "| --- | --- | ---: | --- |",
]
for item in cases:
path = Path(item["evidence_path"]) / "verified.json"
lines.append(f"| {item['case']} | {item['state']} | {len(item['records'])} | [records]({path.as_posix()}) |")
lines += [
"", "## Concrete results", "",
"- Real symbol defaults were C? and L?. Automatic RefDes changed CE17→C7000 and LE03→L7000; a second apply in the same mailbox changed them to C8000/L8000. History restored both steps to CE17/LE03.",
"- A CE17/CE18 swap used the source cycle scheduler and actual temporary CE? write. Native apply and cyclic history restoration passed after fixes.",
"- Value changed on CE17 and LE03; Value1 changed on CE17 using the copied fixture's real added attribute; Part Number changed on both. Missing properties were skipped with issues. Clearing, historical restoration, and return to original values all passed.",
"- Part Name and Part Label each passed show, hide and both historical restores. Final visible states match the baseline.",
"- Actual inspection found 56 named nets, 56 single-page nets, two intentionally empty Values, six Value omissions including absent attributes, one intentionally empty Value1, and 64 Value1 omissions including absent attributes. GND lookup returned page 1. This project has one page; a native positive case spanning two pages was not available, while offline tests cover that case.",
"- Strict component location began with CAP deselected and only LE03 selected. The final actual query selected only UID $5I2744/CE17. GND began deselected and was selected through the actual net mailbox route. See locate/host-trace.txt.",
"- Stale snapshot ID, changed project descriptor, tampered SHA-256, and a real property edit between planning and preflight were all rejected. The latter preserved the external edit; the fixture edit was then restored through the real setter.",
"- A real Value write followed by invalid visibility conversion failed on sequence 2. Actual status was rolled-back, rollback_state=verified, changed_count=0; both original attribute values were read back.",
"- Final inspection compared all 114 reference values, all component positions, and every baseline attribute's value/visibility to the first baseline snapshot. All match. The extra Value1 fixture remains native-baseline only in the acceptance copy.",
"", "## Native defects reproduced and fixed", "",
"1. SymbolRefdesDefault was unavailable in 7.9.5; source export now falls back to SymbolBlock.FindAttribute('Ref Designator').Value.",
"2. A repeated operation key in a cyclic schedule raised native Dictionary error 457 after partial writes. Transaction finals now updates the existing key; see cycle-red/host-trace.txt and cycle/verified.json.",
"3. Cyclic history restore rows had no temporary prefix because refdes_prefix accepts letters only. Restore derives prefixes from formal values with split_refdes; the new automated formal-swap regression failed before the fix and passed after it.",
"4. Project-path mismatch was allowed before the new preflight guard; it is now rejected before writes. The acceptance test altered only the snapshot descriptor, not the active hardware project; see project-stale-red and project-stale.",
"5. VBS Trim left the LF from the published component locate request, making objectMap.Exists false and bypassing location. CR/LF is now normalized at the mailbox boundary. The additional speculative selection helper was reverted; the original native SelectByName path passed strict isolation after parser correction.",
"", "## Evidence and handoff", "",
f"Evidence root: `{BASE}`. Each case has before.json, plan.json, host-trace.txt and after.json; transaction cases also have the actual claimed schedule, apply-request, apply-status and verified readback. Backups and recorded history are under store/.",
f"Final actual snapshot: `{BASE / 'inspection-final' / 'after.json'}`.",
f"Summary JSON: `{BASE / 'native-feature-summary.json'}`.",
"Native production edits owned here: Snapshot.vbs/DxBridgeSymbolDefault, Transaction.vbs/cycle verification and project guard, Mailbox.vbs/locate CR-LF normalization, domain/restore.py/formal cycle prefix; regression tests and tools/acceptance/native_features.py accompany them.",
"PID 81576 was released to root after final integrity verification. No further host commands were issued by this agent. The current selected fixture objects are CAP, INDUCTOR and GRAPHIC; root should choose a single eligible component before the frozen GUI Apply smoke test. Persistent Start/save events, PDF, Excel output and Expedition remain with root/other native agents.",
"Updated core/domain regression command: pytest tests/integration/test_vbs_bridge.py tests/domain/test_operation_restore.py tests/domain/test_restore.py -q. Latest result: 23 passed. git diff --check returned exit 0.",
]
report = REPO / "build" / "test-evidence" / "native-feature-report.md"
report.parent.mkdir(parents=True, exist_ok=True)
report.write_text("\n".join(lines) + "\n", encoding="utf-8")
print(report)
print(json.dumps({"cases": len(cases), "states": counts}))
def main():
parser = argparse.ArgumentParser()
parser.add_argument("action", choices=("render", "stage", "verify", "summary"))
parser.add_argument("case")
args = parser.parse_args()
try:
{"render": render, "stage": stage, "verify": verify, "summary": summary}[args.action](args.case)
except Exception:
(BASE / args.case).mkdir(parents=True, exist_ok=True)
(BASE / args.case / f"{args.action}-error.txt").write_text(traceback.format_exc(), encoding="utf-8")
raise
if __name__ == "__main__":
main()