Handle empty saved-state module smoke

This commit is contained in:
2026-07-26 16:52:44 +03:00
parent a9f95f6328
commit 92a331f149
+19 -1
View File
@@ -68,6 +68,8 @@ def discover_module_target(base_url: str, base_id: str, table: str, timeout_seco
"discovery": {"status": saved_state.get("status"), "counts": saved_state.get("counts")},
}
raise AssertionError("no saved-state BSL module stream candidates found")
def main() -> int:
parser = argparse.ArgumentParser(description="Smoke saved-state BSL module stream write with apply_and_rollback.")
@@ -87,7 +89,23 @@ def main() -> int:
auto_target: dict[str, Any] = {}
if should_auto_select(args.file_name):
auto_target = discover_module_target(args.base_url, args.base_id, args.table, args.timeout_seconds)
try:
auto_target = discover_module_target(args.base_url, args.base_id, args.table, args.timeout_seconds)
except AssertionError as exc:
if not args.allow_empty_saved_state:
raise
result = {
"schema": "onec_module_stream_write_smoke.v1",
"status": "skipped_no_saved_state_candidate",
"skipped": True,
"base_id": args.base_id,
"saved_state_table": args.table,
"diagnostics": {"message": str(exc)},
}
args.report.parent.mkdir(parents=True, exist_ok=True)
args.report.write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
print(json.dumps({"schema": result["schema"], "status": result["status"], "path": str(args.report)}, ensure_ascii=False, indent=2))
return 0
args.file_name = auto_target["file_name"]
args.stream_index = int(auto_target["stream_index"])
args.old = auto_target["old"]