Centralize helper seed selection

This commit is contained in:
2026-06-27 14:16:03 +02:00
parent c7e4bdc373
commit 7bc08ada47
4 changed files with 57 additions and 39 deletions
+21
View File
@@ -5762,6 +5762,14 @@ def smoke_node_utility_registration() -> None:
bucket_b = bucket_node.build("portrait", 77, 3, 0)
_expect(bucket_a == bucket_b, "SDXL bucket should be deterministic for fixed seed and row")
_expect(bucket_a[3] == "portrait", "SDXL bucket ignored orientation filter")
bucket_seed_config = json.dumps({"camera_seed": 9001})
bucket_seeded_a = bucket_node.build("landscape", -1, 4, 0, bucket_seed_config)
bucket_seeded_b = bucket_node.build("landscape", -1, 4, 0, bucket_seed_config)
_expect(bucket_seeded_a == bucket_seeded_b, "SDXL bucket should honor seed_config aliases deterministically")
_expect(
bucket_node._configured_bucket_seed({"camera_seed": "42"}) == 42,
"SDXL bucket seed should delegate through composition/camera seed aliases",
)
krea_node = sxcp_nodes.NODE_CLASS_MAPPINGS["SxCPKrea2ResolutionSelector"]()
krea_width, krea_height, _resolution, aspect_ratio, api_aspect, _api_resolution, *_rest = krea_node.select("1.0MP", "9:16")
@@ -5888,6 +5896,14 @@ def smoke_seed_config_policy() -> None:
_expect(parsed == {"item_seed": 44, "pose_seed": 55}, "seed parser should keep integer-like values only")
_expect(pb._configured_axis_seed(parsed, "content") == 44, "content axis should honor item_seed alias")
_expect(pb._configured_axis_seed(parsed, "role") == 55, "role axis should honor pose seed alias")
_expect(
seed_config.configured_seed_from_axes({"camera_seed": "88", "content_seed": "99"}, ("composition", "content")) == 88,
"seed helper should honor axis aliases in precedence order",
)
_expect(
seed_config.configured_seed_from_axes('{"bad": "json"', ("content",)) is None,
"seed helper should return no seed for invalid config JSON",
)
locked = json.loads(pb.build_seed_lock_config_json(base_seed=100, reroll_axis="content pose", reroll_seed=999))
_expect(locked["content_seed"] == 999, "content_pose reroll should alter content seed")
@@ -6089,6 +6105,11 @@ def smoke_node_route_config_registration() -> None:
_expect(bias_a == bias_b, "Cast Bias should be deterministic for fixed seed and row")
_expect(bias_a[1] + bias_a[2] >= 1, "Cast Bias empty behavior allowed empty cast")
_expect("weighted cast:" in bias_a[3], "Cast Bias summary lost weighted cast label")
bias_seed_config = json.dumps({"category": 702})
seeded_bias_a = cast_bias.build(-1, 2, "0.7,0.3", 1, "0.4,0.6", 0, "force_one_woman", bias_seed_config)
seeded_bias_b = cast_bias.build(-1, 2, "0.7,0.3", 1, "0.4,0.6", 0, "force_one_woman", bias_seed_config)
_expect(seeded_bias_a == seeded_bias_b, "Cast Bias should honor seed_config aliases deterministically")
_expect(cast_bias._configured_cast_seed({"category": "702"}) == 702, "Cast Bias seed should delegate through category aliases")
def smoke_node_character_registration() -> None: