mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
fix(meta/complexity): decide coverage by what the coverer actually pulls
The greedy set-cover retires a role's variant-0 row when an earlier row of another role embeds it, on the premise that embedding pulls the provider at variant 0. The premise is a property of the pair, not of the coverer: a job's round index is the primary role's own variant index, and plan_dev_inventory_matrix hands each pulled-in dependency 'round_index if round_index < its variant count else 0'. A variant 3 coverer therefore pulls a 3-variant provider at 0 and a 14-variant provider at 3. Coverage now asks that question per pair instead of assuming the answer. Nothing changes on the current tree, where 53 rows are covered before and after: the discovery sort ends on 'asc variant', so a role's variant-0 row is always green before its higher ones and gets to cover first. That is a property of a sort key in default.env, not of this code, and 2633 embed pairs would fall the wrong way without it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f1635e6a59
commit
07d73aecef
2 files changed
+57
-11
No files matched your search
@@ -944,24 +944,47 @@ class TestCoveredBy(unittest.TestCase):
|
||||
)
|
||||
self.assertEqual([m.covered_by for m in marked], [0, 0, 2, 0])
|
||||
|
||||
def test_variant_gt0_can_still_cover_other_roles(self) -> None:
|
||||
def test_variant_gt0_covers_a_provider_it_pulls_at_zero(self) -> None:
|
||||
marked = _mark_covered(
|
||||
[
|
||||
_row("Z", []),
|
||||
_row("A", ["B"], variant=2),
|
||||
_row("B", [], variant=0),
|
||||
]
|
||||
],
|
||||
variant_counts={"B": 1},
|
||||
)
|
||||
self.assertEqual([m.covered_by for m in marked], [0, 0, 2])
|
||||
|
||||
def test_variant_gt0_does_not_cover_a_provider_with_that_variant(self) -> None:
|
||||
marked = _mark_covered(
|
||||
[
|
||||
_row("Z", []),
|
||||
_row("A", ["B"], variant=2),
|
||||
_row("B", [], variant=0),
|
||||
],
|
||||
variant_counts={"B": 5},
|
||||
)
|
||||
self.assertEqual([m.covered_by for m in marked], [0, 0, 0])
|
||||
|
||||
def test_variant_zero_covers_whatever_its_provider_count(self) -> None:
|
||||
marked = _mark_covered(
|
||||
[
|
||||
_row("Z", []),
|
||||
_row("A", ["B"], variant=0),
|
||||
_row("B", [], variant=0),
|
||||
],
|
||||
variant_counts={"B": 9},
|
||||
)
|
||||
self.assertEqual([m.covered_by for m in marked], [0, 0, 2])
|
||||
|
||||
def test_a_variant_that_overrides_a_provider_does_not_cover_it(self) -> None:
|
||||
rows = [_row("A", ["B", "C"], variant=1), _row("B", []), _row("C", [])]
|
||||
marked = _mark_covered(rows, {("A", 1): {"B"}})
|
||||
rows = [_row("A", ["B", "C"], variant=0), _row("B", []), _row("C", [])]
|
||||
marked = _mark_covered(rows, {("A", 0): {"B"}})
|
||||
self.assertEqual([m.covered_by for m in marked], [0, 0, 1])
|
||||
|
||||
def test_the_override_only_bars_the_provider_it_names(self) -> None:
|
||||
rows = [_row("A", ["B"], variant=1), _row("B", [])]
|
||||
marked = _mark_covered(rows, {("A", 1): {"C"}})
|
||||
rows = [_row("A", ["B"], variant=0), _row("B", [])]
|
||||
marked = _mark_covered(rows, {("A", 0): {"C"}})
|
||||
self.assertEqual([m.covered_by for m in marked], [0, 1])
|
||||
|
||||
def test_an_override_in_another_variant_leaves_coverage_alone(self) -> None:
|
||||
|
||||
Reference in new issue
Block a user