Extract row category route policy

This commit is contained in:
2026-06-27 09:42:16 +02:00
parent c076b22b75
commit d31d513ec3
5 changed files with 258 additions and 65 deletions
+53
View File
@@ -52,6 +52,7 @@ import pov_policy # noqa: E402
import row_normalization # noqa: E402
import route_metadata # noqa: E402
import row_camera # noqa: E402
import row_category_route # noqa: E402
import row_expression # noqa: E402
import row_generation # noqa: E402
import row_item # noqa: E402
@@ -833,6 +834,57 @@ def smoke_row_item_policy() -> None:
_expect(metadata.get("action_family") == "oral", "Row item compose lost template metadata")
def smoke_row_category_route_policy() -> None:
hard_config = hardcore_position_config.parse_hardcore_position_config(_position_filter("oral_only", "oral", ["kneeling"]))
seed_cfg = seed_config.parse_seed_config({})
route = row_category_route.select_category_item_route(
category_choice="custom_random",
subcategory_choice="Hardcore sexual poses / Oral sex",
seed_config=seed_cfg,
seed=2301,
row_number=1,
women_count=1,
men_count=1,
hardcore_position_config=hard_config,
)
delegated = pb._select_category_item_route(
category_choice="custom_random",
subcategory_choice="Hardcore sexual poses / Oral sex",
seed_config=seed_cfg,
seed=2301,
row_number=1,
women_count=1,
men_count=1,
hardcore_position_config=hard_config,
)
_expect(delegated == route, "Prompt builder category/item route should delegate to row_category_route")
_expect(route["category"]["slug"] == "hardcore_sexual_poses", "Row category route selected wrong hardcore category")
_expect(route["subcategory"]["slug"] == "oral_sex", "Row category route selected wrong hardcore subcategory")
_expect(route["content_axis"] == "pose", "Hardcore pose category should use pose seed axis")
_expect(route["is_pose_category"] is True, "Hardcore pose category should be marked as pose content")
_expect(isinstance(route["item_axis_values"], dict), "Row category route lost item axis metadata")
_expect(isinstance(route["formatter_hints"], dict), "Row category route lost formatter hint metadata")
_expect(
pb._is_pose_content_category(route["category"], route["subcategory"])
== row_category_route.is_pose_content_category(route["category"], route["subcategory"]),
"Prompt builder pose-content wrapper should delegate",
)
casual_route = row_category_route.select_category_item_route(
category_choice="custom_random",
subcategory_choice="Casual clothes / Streetwear",
seed_config=seed_cfg,
seed=2301,
row_number=1,
women_count=1,
men_count=0,
hardcore_position_config={},
)
_expect(casual_route["category"]["slug"] == "casual_clothes", "Row category route selected wrong casual category")
_expect(casual_route["content_axis"] == "content", "Non-pose category should use content seed axis")
_expect(casual_route["is_pose_category"] is False, "Non-pose category should not be marked as pose content")
def smoke_row_generation_policy() -> None:
_expect(pb._ratio_or_none(-1) is None, "Prompt builder ratio helper should treat negative as unset")
_expect(pb._ratio_or_none(1.5) == row_generation.ratio_or_none(1.5) == 1.0, "Row generation ratio clamp changed")
@@ -4257,6 +4309,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
("row_location_policy", smoke_row_location_policy),
("row_expression_policy", smoke_row_expression_policy),
("row_item_policy", smoke_row_item_policy),
("row_category_route_policy", smoke_row_category_route_policy),
("row_generation_policy", smoke_row_generation_policy),
("category_extensions_policy", smoke_category_extensions_policy),
("category_cast_config_policy", smoke_category_cast_config_policy),