Preserve location route metadata
This commit is contained in:
+68
-4
@@ -611,9 +611,16 @@ def smoke_config_route_location_theme() -> None:
|
||||
composition = _expect_text("config_route_location_theme.composition", row.get("composition"), 10)
|
||||
camera = _expect_text("config_route_location_theme.camera_directive", row.get("camera_directive"), 20)
|
||||
scene_directive = _expect_text("config_route_location_theme.camera_scene_directive", row.get("camera_scene_directive"), 40)
|
||||
scene_profile = row.get("scene_camera_profile") if isinstance(row.get("scene_camera_profile"), dict) else {}
|
||||
_expect("library" in scene.lower() or "bookshelves" in scene.lower(), "location theme did not drive scene")
|
||||
_expect("books" in composition.lower() or "shelf" in composition.lower() or "library" in composition.lower(), "location theme did not drive composition")
|
||||
_expect(row.get("location_theme") == "classical_library", "location theme did not survive into row metadata")
|
||||
_expect(row.get("scene_theme") == "classical_library", "selected scene theme did not survive into row metadata")
|
||||
_expect(row.get("composition_theme") == "classical_library", "composition theme did not survive into row metadata")
|
||||
_expect(row.get("scene_entry", {}).get("theme") == "classical_library", "selected scene entry lost theme metadata")
|
||||
_expect("Library camera layout" in scene_directive, "location theme did not drive library camera-scene adapter")
|
||||
_expect(row.get("scene_camera_profile_key") == "classical_library", "row lost scene camera profile key")
|
||||
_expect(scene_profile.get("family") == "library", "row lost scene camera profile family")
|
||||
_expect("front-left quarter view" in scene_directive, "library camera-scene adapter missed orbit direction")
|
||||
_expect("bag" not in composition.lower() and "shoes" not in composition.lower(), "location theme composition leaked outfit-check props")
|
||||
_expect("315-degree front-left quarter view" in camera, "config route did not preserve orbit camera directive")
|
||||
@@ -964,8 +971,44 @@ def smoke_location_config_policy() -> None:
|
||||
theme="classical_library",
|
||||
)
|
||||
_expect("classical_library" in theme_summary, "Themed location summary lost theme name")
|
||||
_expect(json.loads(themed_location).get("scene_entries"), "Themed location did not output locations")
|
||||
_expect(json.loads(themed_composition).get("composition_entries"), "Themed location did not output compositions")
|
||||
themed_location_payload = json.loads(themed_location)
|
||||
themed_composition_payload = json.loads(themed_composition)
|
||||
_expect(themed_location_payload.get("scene_entries"), "Themed location did not output locations")
|
||||
_expect(themed_location_payload.get("theme") == "classical_library", "Themed location config lost theme metadata")
|
||||
_expect(
|
||||
all(
|
||||
not isinstance(entry, dict) or entry.get("theme") == "classical_library"
|
||||
for entry in themed_location_payload.get("scene_entries") or []
|
||||
),
|
||||
"Themed location entries lost theme metadata",
|
||||
)
|
||||
_expect(themed_composition_payload.get("composition_entries"), "Themed location did not output compositions")
|
||||
_expect(themed_composition_payload.get("theme") == "classical_library", "Themed composition config lost theme metadata")
|
||||
parsed_themed = pb._parse_location_config(themed_location_payload)
|
||||
_expect(parsed_themed.get("theme") == "classical_library", "Location parser lost theme metadata")
|
||||
replaced_after_theme = json.loads(
|
||||
location_config.build_location_pool_json(
|
||||
enabled=True,
|
||||
combine_mode="replace",
|
||||
preset="custom_only",
|
||||
custom_locations="plain_room: plain room after theme",
|
||||
location_config=themed_location_payload,
|
||||
)
|
||||
)
|
||||
_expect(replaced_after_theme.get("theme") == "", "Location replace mode should not inherit upstream theme metadata")
|
||||
replaced_composition_after_theme = json.loads(
|
||||
location_config.build_composition_pool_json(
|
||||
enabled=True,
|
||||
combine_mode="replace",
|
||||
preset="custom_only",
|
||||
custom_compositions="plain composition after theme",
|
||||
composition_config=themed_composition_payload,
|
||||
)
|
||||
)
|
||||
_expect(
|
||||
replaced_composition_after_theme.get("theme") == "",
|
||||
"Composition replace mode should not inherit upstream theme metadata",
|
||||
)
|
||||
|
||||
|
||||
def smoke_row_location_policy() -> None:
|
||||
@@ -997,11 +1040,16 @@ def smoke_row_location_policy() -> None:
|
||||
"Row location policy did not apply forced custom scene text",
|
||||
)
|
||||
_expect(updated.get("source_scene") == "unknown_old_scene", "Row location policy lost source scene slug")
|
||||
_expect(updated.get("scene_entry", {}).get("slug") == "archive_corner", "Row location policy lost selected scene entry")
|
||||
_expect(
|
||||
"Scene: hidden archive corner with repeated shelves and warm table lamps. Pose:" in updated.get("prompt", ""),
|
||||
"Row location policy did not rewrite prompt scene",
|
||||
)
|
||||
_expect(updated.get("composition") == "long archive aisle composition", "Row location policy did not apply forced composition")
|
||||
_expect(
|
||||
updated.get("composition_entry", {}).get("prompt") == "long archive aisle composition",
|
||||
"Row location policy lost selected composition entry",
|
||||
)
|
||||
_expect(
|
||||
updated.get("composition_prompt") == "vertical long archive aisle composition",
|
||||
"Row location policy did not compute composition prompt",
|
||||
@@ -1239,10 +1287,19 @@ def smoke_row_prompt_axes_policy() -> None:
|
||||
_expect(route_result.scene_slug == "studio", "Typed prompt axes route lost selected scene slug")
|
||||
_expect(route["scene_slug"] == "studio", "Prompt axes route lost selected scene slug")
|
||||
_expect(route["scene"] == "quiet studio with repeatable anchors", "Prompt axes route lost selected scene text")
|
||||
_expect(route["scene_entry"].get("slug") == "studio", "Prompt axes route lost selected scene entry slug")
|
||||
_expect(
|
||||
route["scene_entry"].get("prompt") == "quiet studio with repeatable anchors",
|
||||
"Prompt axes route lost selected scene entry prompt",
|
||||
)
|
||||
_expect(route["pose"] == "standing fallback pose", "Prompt axes route lost selected fallback pose")
|
||||
_expect(route["expression"] == "", "Prompt axes route should omit expression when disabled")
|
||||
_expect(route["shared_expression"] == "", "Prompt axes route should omit shared expression when disabled")
|
||||
_expect(route["source_composition"] == "all participants visible centered frame", "Prompt axes route lost source composition")
|
||||
_expect(
|
||||
route["composition_entry"].get("prompt") == "all participants visible centered frame",
|
||||
"Prompt axes route lost selected composition entry",
|
||||
)
|
||||
|
||||
pov_route = row_prompt_axes.resolve_prompt_axes(
|
||||
**{**base_kwargs, "expression_disabled": True},
|
||||
@@ -2348,6 +2405,7 @@ def smoke_row_assembly_policy() -> None:
|
||||
"negative_prompt": "bad anatomy",
|
||||
"scene_slug": "test_room",
|
||||
"scene": "warm test room",
|
||||
"scene_entry": {"slug": "test_room", "prompt": "warm test room", "theme": "fixture_theme"},
|
||||
"pose": "standing close",
|
||||
"expression": "focused look",
|
||||
"shared_expression": "focused look",
|
||||
@@ -2358,6 +2416,7 @@ def smoke_row_assembly_policy() -> None:
|
||||
"expression_intensity_source": "disabled",
|
||||
"composition": "centered frame",
|
||||
"source_composition": "centered frame",
|
||||
"composition_entry": {"prompt": "centered frame"},
|
||||
"role_graph": "the visible partner stays centered",
|
||||
"source_role_graph": "Man A stays centered",
|
||||
"action_family": "test_action",
|
||||
@@ -2369,8 +2428,8 @@ def smoke_row_assembly_policy() -> None:
|
||||
"cast_descriptor_text": "Woman A: adult woman; Man A: adult man",
|
||||
"seed_config": {"content_seed": 123},
|
||||
"hardcore_position_config": {"family": "standing"},
|
||||
"location_config": {"location": "test_room"},
|
||||
"composition_config": {"composition": "centered"},
|
||||
"location_config": {"location": "test_room", "theme": "fixture_theme", "apply_mode": "replace"},
|
||||
"composition_config": {"composition": "centered", "theme": "fixture_theme"},
|
||||
"content_seed_axis": "pose",
|
||||
"count_adjustment": count_adjustment,
|
||||
"applied_profile": {"name": "profile_a"},
|
||||
@@ -2390,6 +2449,11 @@ def smoke_row_assembly_policy() -> None:
|
||||
_expect(row["source"] == "json_category", "Row assembly lost source marker")
|
||||
_expect(row["figure"] == "balanced cast", "Row assembly lost figure metadata")
|
||||
_expect(row["formatter_hints"] == {"krea": ["test_hint"]}, "Row assembly lost formatter hints")
|
||||
_expect(row["scene_entry"].get("slug") == "test_room", "Row assembly lost selected scene entry")
|
||||
_expect(row["location_theme"] == "fixture_theme", "Row assembly lost location theme")
|
||||
_expect(row["scene_theme"] == "fixture_theme", "Row assembly lost selected scene theme")
|
||||
_expect(row["composition_entry"].get("prompt") == "centered frame", "Row assembly lost selected composition entry")
|
||||
_expect(row["composition_theme"] == "fixture_theme", "Row assembly lost composition theme")
|
||||
_expect(row["cast_count_adjustment"] == count_adjustment, "Row assembly lost configured-cast count adjustment")
|
||||
_expect(row["content_seed_axis"] == "pose", "Row assembly lost content seed axis")
|
||||
_expect("POV participant: Man A" in row["prompt"], "Row assembly lost POV prompt directive")
|
||||
|
||||
Reference in New Issue
Block a user