chore: snapshot workflow migration progress
This commit is contained in:
@@ -40,8 +40,9 @@ def test_build_preset_workflow_config_creates_graph_still_variant():
|
||||
assert config["ui"]["execution_mode"] == "graph"
|
||||
assert [node["step"] for node in config["nodes"]] == [
|
||||
"order_line_setup",
|
||||
"auto_populate_materials",
|
||||
"resolve_template",
|
||||
"auto_populate_materials",
|
||||
"glb_bbox",
|
||||
"material_map_resolve",
|
||||
"blender_still",
|
||||
"output_save",
|
||||
@@ -51,6 +52,7 @@ def test_build_preset_workflow_config_creates_graph_still_variant():
|
||||
assert render_node["params"]["width"] == 1600
|
||||
assert render_node["params"]["height"] == 900
|
||||
assert render_node["params"]["samples"] == 128
|
||||
assert render_node["params"]["use_custom_render_settings"] is False
|
||||
|
||||
|
||||
def test_canonicalize_workflow_config_migrates_legacy_preset():
|
||||
@@ -215,6 +217,111 @@ def test_canonicalize_workflow_config_defaults_execution_mode_for_canonical_conf
|
||||
assert canonical["ui"]["execution_mode"] == "legacy"
|
||||
|
||||
|
||||
def test_canonicalize_workflow_config_rebuilds_canonical_still_graph_preset():
|
||||
canonical = canonicalize_workflow_config(
|
||||
{
|
||||
"version": 1,
|
||||
"ui": {"preset": "still_graph", "execution_mode": "graph"},
|
||||
"nodes": [
|
||||
{"id": "setup", "step": "order_line_setup", "params": {}},
|
||||
{"id": "resolve_materials", "step": "material_map_resolve", "params": {}},
|
||||
{"id": "template", "step": "resolve_template", "params": {}},
|
||||
{"id": "render", "step": "blender_still", "params": {"width": 1280, "height": 720, "samples": 32}},
|
||||
{"id": "output", "step": "output_save", "params": {}},
|
||||
{"id": "notify", "step": "notify", "params": {}},
|
||||
],
|
||||
"edges": [
|
||||
{"from": "setup", "to": "resolve_materials"},
|
||||
{"from": "resolve_materials", "to": "template"},
|
||||
{"from": "template", "to": "render"},
|
||||
{"from": "render", "to": "output"},
|
||||
{"from": "render", "to": "notify"},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
assert canonical["ui"]["preset"] == "still_graph"
|
||||
assert canonical["ui"]["execution_mode"] == "graph"
|
||||
assert [node["step"] for node in canonical["nodes"]] == [
|
||||
"order_line_setup",
|
||||
"resolve_template",
|
||||
"auto_populate_materials",
|
||||
"glb_bbox",
|
||||
"material_map_resolve",
|
||||
"blender_still",
|
||||
"output_save",
|
||||
"notify",
|
||||
]
|
||||
render_node = next(node for node in canonical["nodes"] if node["step"] == "blender_still")
|
||||
assert render_node["params"]["width"] == 1280
|
||||
assert render_node["params"]["height"] == 720
|
||||
assert render_node["params"]["samples"] == 32
|
||||
assert render_node["params"]["use_custom_render_settings"] is False
|
||||
|
||||
|
||||
def test_build_workflow_blueprint_config_cad_intake_supplies_bbox_to_threejs_thumbnail():
|
||||
config = build_workflow_blueprint_config("cad_intake")
|
||||
|
||||
assert config["ui"]["family"] == "cad_file"
|
||||
assert [node["step"] for node in config["nodes"]] == [
|
||||
"resolve_step_path",
|
||||
"occ_object_extract",
|
||||
"occ_glb_export",
|
||||
"glb_bbox",
|
||||
"stl_cache_generate",
|
||||
"blender_render",
|
||||
"threejs_render",
|
||||
"thumbnail_save",
|
||||
"thumbnail_save",
|
||||
]
|
||||
assert {"from": "export_glb", "to": "bbox"} in config["edges"]
|
||||
assert {"from": "bbox", "to": "threejs_thumb"} in config["edges"]
|
||||
|
||||
|
||||
def test_canonicalize_workflow_config_rebuilds_reference_blueprints():
|
||||
canonical = canonicalize_workflow_config(
|
||||
{
|
||||
"version": 1,
|
||||
"ui": {"preset": "custom", "execution_mode": "legacy", "blueprint": "order_rendering"},
|
||||
"nodes": [
|
||||
{"id": "setup", "step": "order_line_setup", "params": {}},
|
||||
],
|
||||
"edges": [],
|
||||
}
|
||||
)
|
||||
|
||||
assert canonical["ui"]["blueprint"] == "order_rendering"
|
||||
assert canonical["ui"]["family"] == "order_line"
|
||||
assert any(node["step"] == "blender_turntable" for node in canonical["nodes"])
|
||||
assert any(node["step"] == "export_blend" for node in canonical["nodes"])
|
||||
|
||||
|
||||
def test_canonicalize_workflow_config_rebuilds_starter_blueprints():
|
||||
canonical = canonicalize_workflow_config(
|
||||
{
|
||||
"version": 1,
|
||||
"ui": {"preset": "custom", "execution_mode": "legacy", "blueprint": "starter_cad_intake"},
|
||||
"nodes": [],
|
||||
"edges": [],
|
||||
}
|
||||
)
|
||||
|
||||
assert canonical["ui"]["blueprint"] == "starter_cad_intake"
|
||||
assert canonical["ui"]["family"] == "cad_file"
|
||||
assert canonical["nodes"] == [
|
||||
{
|
||||
"id": "resolve_step",
|
||||
"step": "resolve_step_path",
|
||||
"params": {},
|
||||
"ui": {
|
||||
"type": "inputNode",
|
||||
"position": {"x": 120, "y": 140},
|
||||
"label": "Resolve STEP Path",
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_workflow_config_requires_canonicalization_for_legacy_payloads():
|
||||
assert workflow_config_requires_canonicalization(
|
||||
{
|
||||
@@ -235,11 +342,13 @@ def test_build_workflow_blueprint_config_creates_cad_intake_family_graph():
|
||||
|
||||
assert config["version"] == 1
|
||||
assert config["ui"]["preset"] == "custom"
|
||||
assert config["ui"]["family"] == "cad_file"
|
||||
assert config["ui"]["blueprint"] == "cad_intake"
|
||||
assert [node["step"] for node in config["nodes"]] == [
|
||||
"resolve_step_path",
|
||||
"occ_object_extract",
|
||||
"occ_glb_export",
|
||||
"glb_bbox",
|
||||
"stl_cache_generate",
|
||||
"blender_render",
|
||||
"threejs_render",
|
||||
@@ -253,6 +362,7 @@ def test_build_workflow_blueprint_config_creates_order_rendering_family_graph():
|
||||
|
||||
assert config["version"] == 1
|
||||
assert config["ui"]["preset"] == "custom"
|
||||
assert config["ui"]["family"] == "order_line"
|
||||
assert config["ui"]["blueprint"] == "order_rendering"
|
||||
assert any(node["step"] == "blender_still" for node in config["nodes"])
|
||||
assert any(node["step"] == "blender_turntable" for node in config["nodes"])
|
||||
@@ -260,11 +370,34 @@ def test_build_workflow_blueprint_config_creates_order_rendering_family_graph():
|
||||
assert sum(1 for node in config["nodes"] if node["step"] == "notify") == 3
|
||||
|
||||
|
||||
def test_build_workflow_blueprint_config_creates_still_graph_reference():
|
||||
config = build_workflow_blueprint_config("still_graph_reference")
|
||||
|
||||
assert config["version"] == 1
|
||||
assert config["ui"]["preset"] == "custom"
|
||||
assert config["ui"]["family"] == "order_line"
|
||||
assert config["ui"]["blueprint"] == "still_graph_reference"
|
||||
assert config["ui"]["execution_mode"] == "graph"
|
||||
assert [node["step"] for node in config["nodes"]] == [
|
||||
"order_line_setup",
|
||||
"resolve_template",
|
||||
"auto_populate_materials",
|
||||
"glb_bbox",
|
||||
"material_map_resolve",
|
||||
"blender_still",
|
||||
"output_save",
|
||||
"notify",
|
||||
]
|
||||
render_node = next(node for node in config["nodes"] if node["step"] == "blender_still")
|
||||
assert render_node["params"]["use_custom_render_settings"] is False
|
||||
|
||||
|
||||
def test_build_starter_workflow_config_creates_minimal_valid_custom_graph():
|
||||
config = build_starter_workflow_config()
|
||||
|
||||
assert config["version"] == 1
|
||||
assert config["ui"]["preset"] == "custom"
|
||||
assert config["ui"]["family"] == "order_line"
|
||||
assert config["ui"]["blueprint"] == "starter_order_rendering"
|
||||
assert config["nodes"] == [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user