chore: snapshot workflow migration progress
This commit is contained in:
@@ -17,7 +17,7 @@ from app.domains.orders.models import OrderLine
|
||||
from app.domains.rendering.models import WorkflowRun
|
||||
from app.domains.rendering.schemas import WorkflowComparisonArtifactOut, WorkflowRunComparisonOut
|
||||
|
||||
ROLLOUT_PASS_MAX_MEAN_PIXEL_DELTA = 0.0
|
||||
ROLLOUT_PASS_MAX_MEAN_PIXEL_DELTA = 1e-6
|
||||
ROLLOUT_WARN_MAX_MEAN_PIXEL_DELTA = 0.02
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ def _find_shadow_file(order_line: OrderLine, workflow_run: WorkflowRun) -> str |
|
||||
|
||||
upload_root = Path(settings.upload_dir)
|
||||
candidate_roots.append(upload_root / "renders" / str(order_line.id))
|
||||
candidate_roots.append(upload_root / "step_files" / "renders" / str(order_line.id))
|
||||
candidate_roots.append(upload_root / "step_files" / "renders")
|
||||
|
||||
seen_roots: set[Path] = set()
|
||||
@@ -258,6 +259,13 @@ async def build_workflow_run_comparison(
|
||||
|
||||
authoritative_output = _build_artifact(authoritative_path)
|
||||
observer_output = _build_artifact(observer_path)
|
||||
rollout_gate = evaluate_rollout_gate(
|
||||
authoritative_output=authoritative_output,
|
||||
observer_output=observer_output,
|
||||
exact_match=None,
|
||||
dimensions_match=None,
|
||||
mean_pixel_delta=None,
|
||||
)
|
||||
|
||||
if not authoritative_output.exists:
|
||||
status = "missing_authoritative"
|
||||
@@ -283,9 +291,9 @@ async def build_workflow_run_comparison(
|
||||
if exact_match:
|
||||
status = "matched"
|
||||
summary = "Observer output matches the authoritative legacy output byte-for-byte."
|
||||
elif mean_pixel_delta == 0.0 and dimensions_match:
|
||||
elif mean_pixel_delta is not None and mean_pixel_delta <= ROLLOUT_PASS_MAX_MEAN_PIXEL_DELTA and dimensions_match:
|
||||
status = "matched"
|
||||
summary = "Observer output matches the authoritative legacy output visually, but file metadata differs."
|
||||
summary = "Observer output matches the authoritative legacy output within the visual pass threshold."
|
||||
else:
|
||||
status = "different"
|
||||
if dimensions_match is False:
|
||||
@@ -294,6 +302,13 @@ async def build_workflow_run_comparison(
|
||||
summary = "Observer output differs from the authoritative output."
|
||||
else:
|
||||
summary = "Observer output differs from the authoritative output and could not be pixel-compared."
|
||||
rollout_gate = evaluate_rollout_gate(
|
||||
authoritative_output=authoritative_output,
|
||||
observer_output=observer_output,
|
||||
exact_match=exact_match,
|
||||
dimensions_match=dimensions_match,
|
||||
mean_pixel_delta=mean_pixel_delta,
|
||||
)
|
||||
|
||||
return WorkflowRunComparisonOut(
|
||||
workflow_run_id=workflow_run.id,
|
||||
@@ -302,6 +317,14 @@ async def build_workflow_run_comparison(
|
||||
execution_mode=workflow_run.execution_mode,
|
||||
status=status,
|
||||
summary=summary,
|
||||
rollout_gate_verdict=str(rollout_gate["verdict"]),
|
||||
workflow_rollout_ready=bool(rollout_gate["workflow_rollout_ready"]),
|
||||
workflow_rollout_status=str(rollout_gate["workflow_rollout_status"]),
|
||||
rollout_reasons=[str(reason) for reason in rollout_gate["reasons"]],
|
||||
rollout_thresholds={
|
||||
str(key): float(value)
|
||||
for key, value in dict(rollout_gate["thresholds"]).items()
|
||||
},
|
||||
authoritative_output=authoritative_output.to_schema(),
|
||||
observer_output=observer_output.to_schema(),
|
||||
exact_match=exact_match,
|
||||
|
||||
Reference in New Issue
Block a user