Extract row item policy

This commit is contained in:
2026-06-27 09:04:46 +02:00
parent 3d9dbdc95d
commit 58ddda82d7
5 changed files with 454 additions and 287 deletions
+79
View File
@@ -52,6 +52,7 @@ import row_normalization # noqa: E402
import route_metadata # noqa: E402
import row_camera # noqa: E402
import row_expression # noqa: E402
import row_item # noqa: E402
import row_location # noqa: E402
import row_pools # noqa: E402
import server_routes # noqa: E402
@@ -732,6 +733,83 @@ def smoke_row_expression_policy() -> None:
)
def smoke_row_item_policy() -> None:
weighted_entries = [
{"text": "first", "weight": 0.0},
{"text": "second", "weight": 4.0},
{"text": "third", "weight": 1.0},
]
_expect(
pb._weighted_choice(random.Random(44), weighted_entries) == row_item.weighted_choice(random.Random(44), weighted_entries),
"Prompt builder weighted item choice should delegate to row_item",
)
_expect(
pb._pair_from({"name": "Library Corner", "description": "carved shelves and warm lamps"})
== row_item.pair_from({"name": "Library Corner", "description": "carved shelves and warm lamps"}),
"Prompt builder pair parser should delegate to row_item",
)
oral_values = [
"fellatio with penis in mouth",
"cunnilingus with tongue on pussy",
"sixty-nine mutual oral",
]
_expect(
pb._oral_acts_for_position(oral_values, "kneeling oral position")
== row_item.oral_acts_for_position(oral_values, "kneeling oral position")
== ["fellatio with penis in mouth"],
"Row item oral act filtering changed for kneeling oral",
)
outer_values = [
"titjob with compressed breasts",
"handjob with palm around shaft",
"footjob with soles and toes",
]
_expect(
pb._outercourse_acts_for_position(outer_values, "footjob position")
== row_item.outercourse_acts_for_position(outer_values, "footjob position")
== ["footjob with soles and toes"],
"Row item outercourse act filtering changed for footjob",
)
texture_values = [
"fingers pressing around shaft",
"soles pressing around shaft",
"tongue wet against shaft",
]
_expect(
row_item.outercourse_axis_values_for_position(texture_values, "footjob position", "texture_detail")
== ["soles pressing around shaft"],
"Row item outercourse texture axis should prefer footjob-compatible details",
)
category = {}
subcategory = {
"name": "Oral sex",
"slug": "oral_sex",
"item_templates": [
{
"template": "{oral_act}; {hand_detail}",
"action_family": "oral",
"position_family": "oral",
}
],
"item_axes": {
"position": ["kneeling oral position"],
"oral_act": oral_values,
"hand_detail": ["hands on hips", "spreading thighs"],
},
}
item = "Oral sex"
builder_result = pb._compose_item(random.Random(7), category, subcategory, item, women_count=1, men_count=1)
policy_result = row_item.compose_item(random.Random(7), category, subcategory, item, women_count=1, men_count=1)
_expect(builder_result == policy_result, "Prompt builder compose item should delegate to row_item")
item_text, item_name, axis_values, metadata = policy_result
_expect(item_name == "Oral sex", "Row item compose lost item name")
_expect("fellatio" in item_text, "Row item compose did not apply oral act compatibility filter")
_expect(axis_values.get("hand_detail") == "hands on hips", "Row item compose did not apply oral detail filter")
_expect(metadata.get("action_family") == "oral", "Row item compose lost template metadata")
def smoke_category_cast_config_policy() -> None:
_expect(pb.CATEGORY_PRESETS is category_cast_config.CATEGORY_PRESETS, "Prompt builder category presets are not delegated")
_expect(pb.CAST_PRESETS is category_cast_config.CAST_PRESETS, "Prompt builder cast presets are not delegated")
@@ -3931,6 +4009,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
("location_config_policy", smoke_location_config_policy),
("row_location_policy", smoke_row_location_policy),
("row_expression_policy", smoke_row_expression_policy),
("row_item_policy", smoke_row_item_policy),
("category_cast_config_policy", smoke_category_cast_config_policy),
("generation_profile_config_policy", smoke_generation_profile_config_policy),
("filter_config_policy", smoke_filter_config_policy),