Extract item template metadata policy

This commit is contained in:
2026-06-27 02:05:53 +02:00
parent dc94b1c4c1
commit de1d23fb37
6 changed files with 128 additions and 34 deletions
+18
View File
@@ -25,6 +25,7 @@ if str(ROOT) not in sys.path:
import caption_naturalizer # noqa: E402
import caption_policy # noqa: E402
import category_template_metadata # noqa: E402
import character_config # noqa: E402
import character_profile # noqa: E402
import category_cast_config # noqa: E402
@@ -1212,6 +1213,23 @@ def smoke_hardcore_position_config_policy() -> None:
_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")
_expect(
pb._template_action_family(template_metadata) == category_template_metadata.template_action_family(template_metadata),
"Prompt builder template action policy should delegate",
)
_expect(
category_template_metadata.template_metadata_errors(template_metadata) == [],
"Valid template metadata should not report audit errors",
)
invalid_metadata = {
"action_family": "bad_action",
"position_family": "bad_family",
"position_keys": ["kneeling", "bad_position"],
}
invalid_errors = category_template_metadata.template_metadata_errors(invalid_metadata)
_expect(any("bad_action" in error for error in invalid_errors), "Template metadata validation missed bad action")
_expect(any("bad_family" in error for error in invalid_errors), "Template metadata validation missed bad family")
_expect(any("bad_position" in error for error in invalid_errors), "Template metadata validation missed bad position key")
def smoke_category_library_route() -> None: