fffiloni commited on
Commit
2e8d12d
·
verified ·
1 Parent(s): e1a18fd

Upload 4 files

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +22 -8
README.md CHANGED
@@ -133,7 +133,7 @@ See `CHANGELOG_V194.md` for the Model Pre-scan Decision Card UI pass.
133
  See `CHANGELOG_V195.md` for the Runtime CSS Cleanup with Legacy Safety Net pass.
134
 
135
 
136
- Current release: Agentic Space Factory v198.26.94.
137
 
138
  ## v198.26.87 — Runs Explorer Badge Rail Alignment
139
 
 
133
  See `CHANGELOG_V195.md` for the Runtime CSS Cleanup with Legacy Safety Net pass.
134
 
135
 
136
+ Current release: Agentic Space Factory v198.26.98.
137
 
138
  ## v198.26.87 — Runs Explorer Badge Rail Alignment
139
 
app.py CHANGED
@@ -1043,9 +1043,12 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
1043
  space_test_policy = parent_view.get("space_test_policy") or parent_view.get("space_test", {}).get("policy") or {}
1044
  if not space_test_policy.get("enabled"):
1045
  raise ValueError(str(space_test_policy.get("message") or "This Build Run is not eligible for linked Space Test yet."))
1046
- api_name_for_validation = payload.get("api_name")
 
 
1047
  replay_source: dict[str, Any] = {}
1048
- if str(space_test_policy.get("mode") or payload.get("validation_mode") or "").strip().lower() == "replay":
 
1049
  replay_source = _linked_replay_source_from_parent_bundle(
1050
  parent_build_run_id,
1051
  parent_bundle,
@@ -1053,13 +1056,16 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
1053
  str(payload.get("expected_output_type") or "any"),
1054
  )
1055
  if replay_source:
1056
- api_name_for_validation = replay_source.get("api_name") or api_name_for_validation
 
1057
  test_args = replay_source.get("test_args") if isinstance(replay_source.get("test_args"), list) else test_args
1058
  test_kwargs = replay_source.get("test_kwargs") if isinstance(replay_source.get("test_kwargs"), dict) else test_kwargs
1059
  else:
1060
  raise ValueError("Replay validation requires a successful parent automatic smoke payload. Select a Build Run with a completed smoke test, or use Complete/Recover validation instead of Replay.")
1061
- if space_test_policy.get("requires_endpoint_discovery") and str(api_name_for_validation or "").strip() in {"", "/generate"} and not replay_source:
1062
  api_name_for_validation = ""
 
 
1063
  # Compatibility anchor: "ui_payload_source": payload.get("payload_source") or ""
1064
  validation_launch_payload = {
1065
  "schema_version": "1.0",
@@ -1070,12 +1076,15 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
1070
  "expected_output_type": payload.get("expected_output_type") or replay_source.get("expected_output_type") or "any",
1071
  "test_args": test_args,
1072
  "test_kwargs": test_kwargs,
1073
- "validation_mode": space_test_policy.get("mode") or payload.get("validation_mode") or "complete",
1074
- "payload_source": "parent_automatic_smoke" if replay_source else (payload.get("payload_source") or "ui_payload"),
 
 
1075
  "replay_source_present": bool(replay_source),
1076
- "ui_payload_source": "parent_automatic_smoke" if replay_source else (payload.get("payload_source") or ""),
1077
  "space_test_policy": {
1078
  "mode": space_test_policy.get("mode"),
 
1079
  "requires_endpoint_discovery": bool(space_test_policy.get("requires_endpoint_discovery")),
1080
  "effective_status_on_success": space_test_policy.get("effective_status_on_success"),
1081
  },
@@ -1092,7 +1101,7 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
1092
  live_timeout_seconds=payload.get("live_timeout_seconds") or 1800,
1093
  validation_mode=validation_launch_payload["validation_mode"], # effectively: validation_mode=space_test_policy.get("mode")
1094
  effective_status_on_success=space_test_policy.get("effective_status_on_success") or "validated_after_manual_space_test",
1095
- parent_replay_source_json=json.dumps(replay_source, ensure_ascii=False) if replay_source else None,
1096
  validation_launch_payload_json=json.dumps(validation_launch_payload, ensure_ascii=False),
1097
  run_id=payload.get("run_id"),
1098
  bucket_name=bucket_name,
@@ -1392,6 +1401,11 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
1392
  "final_status_reconciliation": bundle.get("final_status_reconciliation") or {},
1393
  "eval_record": bundle.get("eval_record") or {},
1394
  "api_schema": bundle.get("api_schema") or {},
 
 
 
 
 
1395
  "validation_payload": bundle.get("validation_payload") or {},
1396
  "validation_failure_diagnosis": bundle.get("validation_failure_diagnosis") or {},
1397
  "payload_source": bundle.get("payload_source") or {},
 
1043
  space_test_policy = parent_view.get("space_test_policy") or parent_view.get("space_test", {}).get("policy") or {}
1044
  if not space_test_policy.get("enabled"):
1045
  raise ValueError(str(space_test_policy.get("message") or "This Build Run is not eligible for linked Space Test yet."))
1046
+ payload_source_raw = str(payload.get("payload_source") or "").strip()
1047
+ manual_endpoint_override = bool(payload.get("endpoint_override")) or payload_source_raw == "endpoint_registry_manual_override"
1048
+ api_name_for_validation = str(payload.get("api_name") or "").strip()
1049
  replay_source: dict[str, Any] = {}
1050
+ replay_mode_requested = str(space_test_policy.get("mode") or payload.get("validation_mode") or "").strip().lower() == "replay"
1051
+ if replay_mode_requested:
1052
  replay_source = _linked_replay_source_from_parent_bundle(
1053
  parent_build_run_id,
1054
  parent_bundle,
 
1056
  str(payload.get("expected_output_type") or "any"),
1057
  )
1058
  if replay_source:
1059
+ if not manual_endpoint_override:
1060
+ api_name_for_validation = replay_source.get("api_name") or api_name_for_validation
1061
  test_args = replay_source.get("test_args") if isinstance(replay_source.get("test_args"), list) else test_args
1062
  test_kwargs = replay_source.get("test_kwargs") if isinstance(replay_source.get("test_kwargs"), dict) else test_kwargs
1063
  else:
1064
  raise ValueError("Replay validation requires a successful parent automatic smoke payload. Select a Build Run with a completed smoke test, or use Complete/Recover validation instead of Replay.")
1065
+ if space_test_policy.get("requires_endpoint_discovery") and str(api_name_for_validation or "").strip() in {"", "/generate"} and not replay_source and not manual_endpoint_override:
1066
  api_name_for_validation = ""
1067
+ requested_validation_mode = space_test_policy.get("mode") or payload.get("validation_mode") or "complete"
1068
+ validation_mode_for_launch = "complete" if manual_endpoint_override and str(requested_validation_mode or "").strip().lower() == "replay" else requested_validation_mode
1069
  # Compatibility anchor: "ui_payload_source": payload.get("payload_source") or ""
1070
  validation_launch_payload = {
1071
  "schema_version": "1.0",
 
1076
  "expected_output_type": payload.get("expected_output_type") or replay_source.get("expected_output_type") or "any",
1077
  "test_args": test_args,
1078
  "test_kwargs": test_kwargs,
1079
+ "validation_mode": validation_mode_for_launch,
1080
+ "payload_source": (payload.get("payload_source") if manual_endpoint_override else "parent_automatic_smoke") if replay_source else (payload.get("payload_source") or "ui_payload"),
1081
+ "endpoint_override": bool(manual_endpoint_override),
1082
+ "endpoint_registry_source_run_id": payload.get("endpoint_registry_source_run_id") or "",
1083
  "replay_source_present": bool(replay_source),
1084
+ "ui_payload_source": (payload.get("payload_source") if manual_endpoint_override else "parent_automatic_smoke") if replay_source else (payload.get("payload_source") or ""),
1085
  "space_test_policy": {
1086
  "mode": space_test_policy.get("mode"),
1087
+ "launch_mode": validation_mode_for_launch,
1088
  "requires_endpoint_discovery": bool(space_test_policy.get("requires_endpoint_discovery")),
1089
  "effective_status_on_success": space_test_policy.get("effective_status_on_success"),
1090
  },
 
1101
  live_timeout_seconds=payload.get("live_timeout_seconds") or 1800,
1102
  validation_mode=validation_launch_payload["validation_mode"], # effectively: validation_mode=space_test_policy.get("mode")
1103
  effective_status_on_success=space_test_policy.get("effective_status_on_success") or "validated_after_manual_space_test",
1104
+ parent_replay_source_json=json.dumps(replay_source, ensure_ascii=False) if replay_source and not manual_endpoint_override else None,
1105
  validation_launch_payload_json=json.dumps(validation_launch_payload, ensure_ascii=False),
1106
  run_id=payload.get("run_id"),
1107
  bucket_name=bucket_name,
 
1401
  "final_status_reconciliation": bundle.get("final_status_reconciliation") or {},
1402
  "eval_record": bundle.get("eval_record") or {},
1403
  "api_schema": bundle.get("api_schema") or {},
1404
+ "space_test_endpoint_registry": bundle.get("space_test_endpoint_registry") or {},
1405
+ "gradio_endpoint_discovery": bundle.get("gradio_endpoint_discovery") or {},
1406
+ "gradio_schema": bundle.get("gradio_schema") or {},
1407
+ "endpoint_candidates": bundle.get("endpoint_candidates") or {},
1408
+ "selected_endpoint": bundle.get("selected_endpoint") or {},
1409
  "validation_payload": bundle.get("validation_payload") or {},
1410
  "validation_failure_diagnosis": bundle.get("validation_failure_diagnosis") or {},
1411
  "payload_source": bundle.get("payload_source") or {},