Skip to content

Commit b28f825

Browse files
celticht32claude
andcommitted
fix(ci): re-anchor the verification-date mutation; check every anchor in 1s
The mutation was anchored on the literal LIVE_VERIFIED_ON = 2026-07-30, so it broke the moment 36 operations were verified against a live organization and the date moved - on exactly the event it exists to protect. CI reported ANCHOR-GONE and failed, which is the harness being right: an anchor that no longer matches means the mutation tested nothing. Re-anchored on the assignment and century so a future run does not break it again, and added a test that checks all 173 anchors across all three mutation scripts in under a second, rather than discovering drift nine minutes into CI. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tgs9tim9N1Lncch4fHv7Mg
1 parent ff62ea6 commit b28f825

2 files changed

Lines changed: 59 additions & 2 deletions

File tree

scripts/mutation_round_5.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,17 @@ class MutationTimeoutError(RuntimeError):
663663
(
664664
"capella: the verification date is dropped",
665665
"handlers/capella/spec.py",
666-
'LIVE_VERIFIED_ON = "2026-07-30"',
667-
'LIVE_VERIFIED_ON = "recently"',
666+
# The DATE MOVES. It moved on 2026-09-01 when 36 operations were verified
667+
# against a live organization, and the anchor did not -- so this mutation
668+
# stopped applying and CI reported ANCHOR-GONE. That is the harness telling
669+
# the truth: it could no longer prove the check it was written to prove.
670+
#
671+
# Now anchored on the assignment and the century rather than the whole date,
672+
# so the next verification run does not break it again. The mutation still
673+
# does what it must -- replace a real date with prose and watch
674+
# test_the_verification_date_is_recorded fail.
675+
'LIVE_VERIFIED_ON = "20',
676+
'LIVE_VERIFIED_ON = "recently',
668677
CAPELLA,
669678
),
670679
# ── The authorization decision itself ───────────────────────────────────

tests/test_capella.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,3 +1311,51 @@ def test_a_base64_path_id_survives_encoding():
13111311
"a decoded replication id contains slashes; leaving them unencoded would address "
13121312
"a different resource"
13131313
)
1314+
1315+
1316+
# ── Mutation anchors ─────────────────────────────────────────────────────────
1317+
1318+
1319+
def test_every_mutation_anchor_still_matches_its_target():
1320+
"""A mutation whose anchor no longer matches tests NOTHING, and the guard it was
1321+
written for silently becomes unverified.
1322+
1323+
The harness gets this right — it reports ANCHOR-GONE and fails the run rather than
1324+
counting it as a pass. What it cannot do is be quick about it: the anchors are checked
1325+
while applying 173 mutations across a matrix of Python versions, so a one-character
1326+
drift costs a nine-minute CI round trip to discover.
1327+
1328+
This is the same check, done in milliseconds, on the same data. It went in after
1329+
`LIVE_VERIFIED_ON = "2026-07-30"` was anchored by its literal value and the date moved
1330+
the moment 36 operations were verified against a live organization — which is to say,
1331+
the anchor broke on exactly the event the mutation exists to protect.
1332+
"""
1333+
import importlib.util
1334+
import pathlib
1335+
1336+
root = pathlib.Path(__file__).resolve().parent.parent
1337+
scripts = sorted(root.glob("scripts/mutation*.py"))
1338+
assert scripts, "no mutation scripts found; this test has gone stale"
1339+
1340+
stale: list[str] = []
1341+
checked = 0
1342+
for script in scripts:
1343+
spec = importlib.util.spec_from_file_location(script.stem, script)
1344+
module = importlib.util.module_from_spec(spec)
1345+
spec.loader.exec_module(module)
1346+
mutations = getattr(module, "MUTATIONS", None)
1347+
assert mutations, f"{script.name} defines no MUTATIONS"
1348+
1349+
for entry in mutations:
1350+
label, relpath, old = entry[0], entry[1], entry[2]
1351+
text = (root / relpath).read_text(encoding="utf-8")
1352+
for anchor in old if isinstance(old, list) else [old]:
1353+
checked += 1
1354+
if anchor not in text:
1355+
stale.append(f"{script.name}: {label}{relpath}")
1356+
1357+
assert not stale, (
1358+
f"{len(stale)} mutation anchor(s) no longer match their target file, so those "
1359+
"mutations test nothing:\n " + "\n ".join(stale)
1360+
)
1361+
assert checked > 100, f"only {checked} anchors checked; suspiciously few"

0 commit comments

Comments
 (0)