Support item template route metadata

This commit is contained in:
2026-06-27 02:00:55 +02:00
parent 2d3d668359
commit dc94b1c4c1
6 changed files with 179 additions and 30 deletions
+49
View File
@@ -1183,6 +1183,35 @@ def smoke_hardcore_position_config_policy() -> None:
_expect(keys == ["doggy"], "Hardcore position key detection changed")
source_family = hardcore_position_config.hardcore_source_position_family({"slug": "manual_stimulation"}, filtered)
_expect(source_family == "manual", "Hardcore source family lookup changed")
item_text, item_name, axis_values, template_metadata = pb._compose_item(
random.Random(42),
{},
{
"name": "Template metadata route",
"item_templates": [
{
"template": "{act} in {position}",
"action_family": "oral",
"position_family": "oral",
"position_keys": ["kneeling", "open_thighs"],
}
],
"item_axes": {
"act": ["mouth contact"],
"position": ["kneeling oral position"],
},
},
"Template metadata route",
women_count=1,
men_count=1,
)
_expect(item_text == "mouth contact in kneeling oral position", "Template metadata route changed composed item text")
_expect(item_name == "Template metadata route", "Template metadata route changed item name")
_expect(axis_values == {"act": "mouth contact", "position": "kneeling oral position"}, "Template metadata route lost axis values")
_expect(template_metadata.get("action_family") == "oral", "Template metadata route lost action family")
_expect(pb._template_position_family(template_metadata) == "oral", "Template metadata route lost position family")
_expect(pb._template_position_keys(template_metadata) == ["kneeling", "open_thighs"], "Template metadata route lost position keys")
_expect(pb._template_action_family(template_metadata) == "oral", "Template metadata route lost normalized action family")
def smoke_category_library_route() -> None:
@@ -1266,6 +1295,26 @@ def smoke_hardcore_category_routes() -> None:
_expect(sdxl_tag in (sdxl.get("sdxl_prompt") or "").lower(), f"{name} SDXL prompt did not include family tag {sdxl_tag!r}")
caption, _method = caption_naturalizer.naturalize_caption("", metadata_json=_json(row), trigger=Trigger, include_trigger=True)
_expect(caption_label in caption.lower(), f"{name} caption did not include family label {caption_label!r}")
annotated_row = None
for seed in range(1801, 1841):
row = _prompt_row(
name="hardcore_annotated_template",
category="Hardcore sexual poses",
subcategory="Oral sex",
seed=seed,
character_cast=cast,
women_count=1,
men_count=1,
hardcore_position_config=_action_filter("oral_only"),
)
if row.get("item_template_metadata"):
annotated_row = row
break
_expect(annotated_row is not None, "No annotated item template reached generated row in deterministic seed window")
if annotated_row is not None:
_expect(annotated_row.get("action_family") == "oral", "Annotated item template action_family did not reach row")
_expect(annotated_row.get("position_family") == "oral", "Annotated item template position_family did not reach row")
_expect(annotated_row.get("item_template_metadata", {}).get("action_family") == "oral", "Annotated item metadata missing in row")
def smoke_krea_close_foreplay_route() -> None: