mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-30 06:46:31 +00:00
fix(variants): apply a variant pin only while its carrier is in the round
Pins of every role applied at every round index, so a role the round did not deploy could pull a partner into a heavier variant (web-app-discourse#1 measured 35.46 GB against the 32 GB reservation cap). resolve_round now starts every role on its clamped index and recomputes the include and the pins in force until the assignment settles, raising VariantPinError on a cycle. The planner resolves each round once (39.1 s to 16.0 s for all rounds), affected judges every (role, index) with the round the planner deploys for it, and the resource budget lint measures the pin-aware rounds. The stale web-app-matomo pin above the primary-only docs entry is dropped, and test_variant_pin_fixed_point.py guards every planned round against unsettled pins and pins above a disabled entry. docs/contributing/artefact/files/role/variants.md explains the settle loop with diagrams. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8127d61018
commit
76fc6992c4
10 files changed
+935
-173
No files matched your search
@@ -163,6 +163,61 @@ class TestAffected(unittest.TestCase):
|
||||
got = affected_main.affected_selection(["web-app-keycloak"])
|
||||
self.assertIn("web-app-consumer#0", got)
|
||||
|
||||
def test_each_variant_is_judged_with_the_pins_its_own_round_runs(self) -> None:
|
||||
"""Variant 1 reaches the seed only through its own pin moving the
|
||||
partner, and an unrelated role's pin would move the subject itself;
|
||||
only the round the planner deploys for each variant keeps both."""
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
root = Path(td)
|
||||
for role in (
|
||||
"web-app-keycloak",
|
||||
"web-app-matomo",
|
||||
"web-app-consumer",
|
||||
"web-app-other",
|
||||
):
|
||||
_mk_app_role(root, role, role)
|
||||
off = {"enabled": False, "shared": False}
|
||||
on = {"enabled": True, "shared": True}
|
||||
dump_yaml(
|
||||
root / "roles" / "web-app-matomo" / ROLE_FILE_META_SERVICES,
|
||||
{"matomo": {}, "sso": off},
|
||||
)
|
||||
dump_yaml(
|
||||
root / "roles" / "web-app-matomo" / ROLE_FILE_META_VARIANTS,
|
||||
[{}, {}, {"services": {"sso": on}}],
|
||||
)
|
||||
dump_yaml(
|
||||
root / "roles" / "web-app-consumer" / ROLE_FILE_META_SERVICES,
|
||||
{"consumer": {}, "sso": on, "matomo": on},
|
||||
)
|
||||
(root / "roles" / "web-app-consumer" / ROLE_FILE_META_VARIANTS).write_text(
|
||||
"- services:\n"
|
||||
" matomo: {enabled: false, shared: false}\n"
|
||||
"- services:\n"
|
||||
" sso: {enabled: false, shared: false}\n"
|
||||
" # variant-pin: web-app-matomo#2\n"
|
||||
" matomo: {enabled: true, shared: true}\n"
|
||||
"- services:\n"
|
||||
" sso: {enabled: false, shared: false}\n"
|
||||
" matomo: {enabled: false, shared: false}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
dump_yaml(
|
||||
root / "roles" / "web-app-other" / ROLE_FILE_META_SERVICES,
|
||||
{"other": {}, "matomo": off},
|
||||
)
|
||||
(root / "roles" / "web-app-other" / ROLE_FILE_META_VARIANTS).write_text(
|
||||
"- services:\n"
|
||||
" # variant-pin: web-app-consumer#2\n"
|
||||
" matomo: {enabled: false, shared: false}\n"
|
||||
"- {}\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with patch.object(repo_paths, "PROJECT_ROOT", root):
|
||||
got = affected_main.affected_selection(["web-app-keycloak"])
|
||||
self.assertIn("web-app-consumer#0,1", got)
|
||||
|
||||
def test_a_seed_keeps_every_variant_of_its_own_role(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
root = Path(td)
|
||||
|
||||
Reference in new issue
Block a user