Extract role graph route policy

This commit is contained in:
2026-06-27 10:23:10 +02:00
parent 09eaafc8f6
commit 2b221463ee
5 changed files with 137 additions and 9 deletions
+56
View File
@@ -61,6 +61,7 @@ import row_location # noqa: E402
import row_pools # noqa: E402
import row_prompt_axes # noqa: E402
import row_rendering # noqa: E402
import row_role_graph # noqa: E402
import row_route_metadata # noqa: E402
import row_subject_route # noqa: E402
import server_routes # noqa: E402
@@ -1793,6 +1794,60 @@ def smoke_row_rendering_policy() -> None:
)
def smoke_row_role_graph_policy() -> None:
empty_route = row_role_graph.resolve_role_graph_route(
rng=random.Random(51),
subcategory={"slug": "penetration"},
context={"subject_type": "woman"},
item_axis_values={"position": "missionary"},
pov_character_labels=[],
is_pose_category=True,
)
_expect(empty_route == row_role_graph.RoleGraphRoute("", ""), "Role graph route should stay empty outside configured cast")
context = {
"subject_type": "configured_cast",
"women_count": "1",
"men_count": "1",
}
subcategory = {"slug": "cumshot_climax", "name": "Cumshot and climax"}
axis_values = {"position": "lying at the bed edge with thighs open"}
route = row_role_graph.resolve_role_graph_route(
rng=random.Random(52),
subcategory=subcategory,
context=context,
item_axis_values=axis_values,
pov_character_labels=[],
is_pose_category=True,
)
delegated = pb._role_graph_route(
rng=random.Random(52),
subcategory=subcategory,
context=context,
item_axis_values=axis_values,
pov_character_labels=[],
is_pose_category=True,
)
_expect(route == delegated, "Prompt builder role graph route wrapper should delegate to row_role_graph")
_expect("raised edge" in route.source_role_graph, "Role graph route did not sanitize bed-edge environment anchor")
_expect("bed edge" not in route.source_role_graph.lower(), "Role graph route leaked bed-edge environment anchor")
_expect(route.role_graph == route.source_role_graph, "Role graph route changed non-POV role graph text")
pov_route = row_role_graph.resolve_role_graph_route(
rng=random.Random(53),
subcategory={"slug": "oral", "name": "Oral"},
context=context,
item_axis_values={"position": "standing oral", "act": "blowjob"},
pov_character_labels=["Man A"],
is_pose_category=False,
)
_expect(pov_route.source_role_graph, "Role graph route lost POV source role graph")
_expect(
pov_route.role_graph.startswith("First-person POV from Man A;"),
"Role graph route did not prepend POV role graph directive",
)
def smoke_row_assembly_policy() -> None:
context = {
"subject": "configured cast",
@@ -4687,6 +4742,7 @@ SMOKE_CASES: list[tuple[str, Callable[[], None]]] = [
("character_profile_policy", smoke_character_profile_policy),
("row_normalization_policy", smoke_row_normalization_policy),
("row_rendering_policy", smoke_row_rendering_policy),
("row_role_graph_policy", smoke_row_role_graph_policy),
("row_assembly_policy", smoke_row_assembly_policy),
("formatter_input_policy", smoke_formatter_input_policy),
("formatter_cast_policy", smoke_formatter_cast_policy),