Use nested template metadata in route readers

This commit is contained in:
2026-06-27 14:22:52 +02:00
parent ec79257613
commit 81d69c753e
2 changed files with 72 additions and 3 deletions
+40
View File
@@ -3864,6 +3864,46 @@ def smoke_hardcore_position_config_policy() -> None:
route_metadata.row_formatter_hints(route_row, "caption") == ["shared formatter cue", "caption formatter cue"],
"Route metadata formatter hint routing changed",
)
nested_route_row = {
"item_template_metadata": {
"action_family": "oral",
"position_family": "oral",
"position_keys": ["kneeling", "open_thighs"],
"formatter_hint": {"krea2": "nested krea cue", "sdxl": "nested sdxl cue", "training_caption": "nested caption cue"},
}
}
_expect(
route_metadata.row_action_family(nested_route_row) == "oral",
"Route metadata should fall back to nested template action family",
)
_expect(
route_metadata.row_position_family(nested_route_row) == "oral",
"Route metadata should fall back to nested template position family",
)
_expect(
route_metadata.row_position_keys(nested_route_row) == ["kneeling", "open_thighs"],
"Route metadata should fall back to nested template position keys",
)
_expect(
route_metadata.row_formatter_hints(nested_route_row, "krea") == ["nested krea cue"],
"Route metadata should fall back to nested Krea formatter hints",
)
merged_route_row = {
"position_key": "standing",
"formatter_hints": {"all": ["shared cue"]},
"item_template_metadata": {
"position_keys": ["kneeling"],
"formatter_hint": {"caption": "nested caption cue"},
},
}
_expect(
route_metadata.row_position_keys(merged_route_row) == ["standing", "kneeling"],
"Route metadata should merge top-level and nested position keys",
)
_expect(
route_metadata.row_formatter_hints(merged_route_row, "caption") == ["shared cue", "nested caption cue"],
"Route metadata should merge top-level and nested formatter hints",
)
route_hints = category_template_metadata.formatter_hints_for_route(
{"formatter_hints": {"all": ["shared formatter cue"], "krea2": ["krea formatter cue"]}},
"krea2",