fix(retrieval-gate): the mutant roster is pinned apart from the list it names
PM's J3. `MUTANT_ROSTER` carries the thirteen labels and `MUTANT_COUNT` their number, both written apart from `MUTANTS`, and `row_seven` refuses to run unless the labels it was handed ARE that roster, in order, with no duplicate. The bar is taken from the roster's length, not from `len(mutants)`. Why a pin and not a share: the bar is a percentage, so a longer list is a lower bar per survivor. Seven copies of `M03 k = 1` took the row to 18 of 20 GREEN with the same two survivors -- nothing new felled, the bar lowered. Lengthening the list honestly now costs three edits in three places, each readable as what it is; a duplicate label is refused outright, because two copies of one mutation are one mutation whatever the roster says. Row 7 is unchanged on the shipped list: 11 of 13, bar 12 of 13, RED, the same two survivors with the same measured notes. 56 passed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
68ea05c17d
commit
2f94bbcbd4
2 changed files with 67 additions and 4 deletions
|
|
@ -466,14 +466,15 @@ def test_row_seven_is_green_when_every_mutant_is_felled(tmp_path: Path) -> None:
|
|||
cases, _ = gate.synthetic_cases(tmp_path / "bundles", FIXTURES)
|
||||
baseline = gate.deterministic_rows(cases)
|
||||
lethal = (gate.MUTANTS[3],) # M04, the reversed ranking
|
||||
row = gate.row_seven(cases, baseline, mutants=lethal)
|
||||
row = gate.row_seven(cases, baseline, mutants=lethal, roster=[m.label for m in lethal])
|
||||
assert (row.k, row.m, row.status) == (1, 1, gate.GREEN)
|
||||
|
||||
|
||||
def test_row_seven_is_red_when_a_mutant_survives(tmp_path: Path) -> None:
|
||||
cases, _ = gate.synthetic_cases(tmp_path / "bundles", FIXTURES)
|
||||
baseline = gate.deterministic_rows(cases)
|
||||
row = gate.row_seven(cases, baseline, mutants=(_noop_mutant(),))
|
||||
noop = (_noop_mutant(),)
|
||||
row = gate.row_seven(cases, baseline, mutants=noop, roster=[m.label for m in noop])
|
||||
assert (row.k, row.m, row.status) == (0, 1, gate.RED)
|
||||
assert any(
|
||||
"SURVIVED" in detail and "row 1 should have taken it" in detail for detail in row.details
|
||||
|
|
@ -976,3 +977,9 @@ def test_j3_row_seven_refuses_a_mutant_list_that_is_not_the_pinned_roster(
|
|||
assert row.status != gate.GREEN, row
|
||||
assert row.fails
|
||||
assert "roster" in row.reason or "duplicate" in row.reason
|
||||
|
||||
|
||||
def test_the_mutant_roster_is_pinned_apart_from_the_list_it_names() -> None:
|
||||
assert tuple(mutant.label for mutant in gate.MUTANTS) == gate.MUTANT_ROSTER
|
||||
assert len(gate.MUTANT_ROSTER) == gate.MUTANT_COUNT
|
||||
assert len(set(gate.MUTANT_ROSTER)) == len(gate.MUTANT_ROSTER)
|
||||
|
|
|
|||
|
|
@ -1503,6 +1503,34 @@ MUTANTS: tuple[Mutant, ...] = (
|
|||
)
|
||||
|
||||
|
||||
#: THE ROSTER, PINNED APART FROM THE LIST IT NAMES. `MUTANTS` lives in the
|
||||
#: file a capability session edits, and the bar used to be 90 % of
|
||||
#: `len(MUTANTS)`: seven duplicate `M03` entries appended took row 7 from
|
||||
#: 11 of 13 RED to 18 of 20 GREEN with the same two survivors (PM's J3,
|
||||
#: 2026-09-19). Lengthening the list now has to lengthen this tuple and move
|
||||
#: the count below it -- three edits in three places, each of them readable as
|
||||
#: what it is -- and a duplicate label is refused outright, because two copies
|
||||
#: of one mutation are one mutation whatever the roster says.
|
||||
MUTANT_ROSTER: tuple[str, ...] = (
|
||||
"M01 the lookup partition is off",
|
||||
"M02 the title-covered partition is off",
|
||||
"M03 k = 1",
|
||||
"M04 the ranking is reversed",
|
||||
"M05 the source quota is removed",
|
||||
"M06 the body signal is dead",
|
||||
"M07 the document prior is dead",
|
||||
"M08 every token matches every token",
|
||||
"M09 no stem, no prefix: equality only",
|
||||
"M10 the fusion is flattened (RRF_K = 10 000)",
|
||||
"M11 the cut takes the LAST k",
|
||||
"M12 the delivered text is truncated to 40 characters",
|
||||
"M13 the excerpt carries no text",
|
||||
)
|
||||
|
||||
#: The roster's length, written as a number so appending is not one edit.
|
||||
MUTANT_COUNT = 13
|
||||
|
||||
|
||||
def _score(rows: Sequence[Row]) -> dict[int, int]:
|
||||
"""`k - m` per row: 0 when green, and it falls whether the hits drop or the
|
||||
denominator grows.
|
||||
|
|
@ -1537,14 +1565,42 @@ def row_seven(
|
|||
baseline: Sequence[Row],
|
||||
*,
|
||||
mutants: Sequence[Mutant] = MUTANTS,
|
||||
roster: Sequence[str] = MUTANT_ROSTER,
|
||||
) -> Row:
|
||||
"""Mutate the ranking and the cut; a gate nothing can fell is not a gate.
|
||||
|
||||
THE LIST IS THE ROSTER OR THE ROW DID NOT RUN. The bar is a share, so a
|
||||
longer list is a lower bar per survivor; padding `MUTANTS` with seven
|
||||
copies of one easy mutation made the row green without felling anything
|
||||
new. The labels must be the pinned roster exactly, in order, with no
|
||||
duplicate, and the bar is taken from the ROSTER's length.
|
||||
|
||||
Every mutant is applied IN PROCESS to the module the payload is built
|
||||
from, and the judge's reading of the bundle is taken BEFORE the first
|
||||
mutation (`bundle_index` is warmed by the baseline), so a mutant cannot
|
||||
move the fasit it is being measured against.
|
||||
"""
|
||||
labels = [mutant.label for mutant in mutants]
|
||||
duplicates = sorted({label for label in labels if labels.count(label) > 1})
|
||||
name = f"mechanical mutants of the ranking and the cut, felled (bar {MUTANT_BAR:.0%})"
|
||||
if duplicates or tuple(labels) != tuple(roster):
|
||||
return Row(
|
||||
7,
|
||||
name,
|
||||
0,
|
||||
len(roster),
|
||||
NOT_RUN,
|
||||
"not run: the mutant list is not the pinned roster "
|
||||
+ (
|
||||
f"({len(duplicates)} duplicate label(s): {', '.join(duplicates)})"
|
||||
if duplicates
|
||||
else f"({len(labels)} given, {len(roster)} pinned)"
|
||||
),
|
||||
[
|
||||
" a bar that is a share of the list makes a longer list an "
|
||||
"easier bar; the roster is pinned apart from the list it names"
|
||||
],
|
||||
)
|
||||
before = _score(baseline)
|
||||
baseline_units = _unit_vector(cases)
|
||||
killed: list[str] = []
|
||||
|
|
@ -1581,12 +1637,12 @@ def row_seven(
|
|||
"delivery/deliveries on these fixtures"
|
||||
+ (f"; {mutant.note}" if mutant.note else "")
|
||||
)
|
||||
total = len(mutants)
|
||||
total = len(roster)
|
||||
bar = int(-(-total * MUTANT_BAR // 1))
|
||||
status = GREEN if total and len(killed) >= bar else RED
|
||||
return Row(
|
||||
7,
|
||||
f"mechanical mutants of the ranking and the cut, felled (bar {MUTANT_BAR:.0%})",
|
||||
name,
|
||||
len(killed),
|
||||
total,
|
||||
status,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue