test: preserve scalar receipts when optional shear probes fail

This commit is contained in:
TRON committed 2026-10-18 20:22:23 -07:00
1 parent caa573f978
commit 1f64f7eb11
4 files changed
+69 -11

No files matched your search

+12 -5
View File
@@ -25,7 +25,7 @@ NESTED_SHEAR = "nested_shear_n128" # fixed three-level/two-region shear preset
SHEAR_NESTED_SHA256 = "fa6cfe87fb4df8c6d732c637c885276833c81973b950c7724d734f8fc350bcb0"
TWIN_SHEAR = "twin_shear_n128" # depth-2 twin: nested L0->L1 boxes without L2
SHEAR_TWIN_SHA256 = "1cbf37f18e89aea577581631c4565f51e68d22a3739b698816ef64acbf2b2bb4"
SHEAR_PROBES_SHA256 = "53ba8af8ac9c8078c40f84488c7ade4c11ccc91dd1fc275ff806042e9af30166" # signed interface-probe mechanism diagnostic
SHEAR_PROBES_SHA256 = "e2e6490d281cc275f448dc6d6ea7b9b4407cc74a51e9256b86c08c8626b89b76" # signed interface-probe mechanism diagnostic
def flow_functions(flow="taylor_green"):
@@ -382,9 +382,16 @@ def main():
run.step(step - run.step_count)
if step in probe_steps:
trace = report["probe_trace"]
trace["steps"].append(probe_root[step]) # root-physical step
trace["values"].append(shear_probes.sample(
(run.download(),) if args.depth == 1 else run.download(), probes))
if "error" not in trace:
arrays = (run.download(),) if args.depth == 1 else run.download()
try:
values = shear_probes.sample(arrays, probes)
shear_probes.validate_row(values, len(probes))
except (ValueError, ZeroDivisionError) as error:
report["probe_trace"] = dict(error=str(error))
else:
trace["steps"].append(probe_root[step]) # root-physical step
trace["values"].append(values)
if step not in main_steps and step not in early_steps:
continue # probe-only step: no qualification metrics
row = sample(run, masks, step, args.n, cfg.viscosity, initial_mass,
@@ -439,7 +446,7 @@ def main():
),
flush=True,
)
if args.probe_trace:
if args.probe_trace and "error" not in report["probe_trace"]:
try:
report["probe_trace"]["bytes"] = shear_probes.validate(report["probe_trace"])
except ValueError as error: # keep the scalar receipt; drop an invalid trace