diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-13 09:20:33 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-13 09:20:33 +0200 |
| commit | 9e6f099f7f1dd918cf5f9f418ed5e2408289dd40 (patch) | |
| tree | cbebb0fbb8b483a3351e20541b381c7eb7aadbbd | |
| parent | b9b26ef4badc2ef4dfff2e57decf7f9c57066888 (diff) | |
| download | colitur-9e6f099f7f1dd918cf5f9f418ed5e2408289dd40.tar.gz colitur-9e6f099f7f1dd918cf5f9f418ed5e2408289dd40.zip | |
test(temporal_ef): fix round 1 (F5) -- the anchor erosion test proved nothing
test_holy_family_anchor_present_and_erosion_is_caught built its
"eroded" list by filtering the exact pair it then asserted was
absent -- removing an element and checking it is gone proves
List.filter works, not that any detector caught anything. Borrowed
the name of test_anchors_erosion_is_caught, which uses a genuine
one: missing_from_anchors, called with an "expected" set sourced
independently of T.anchors (named_slugs_for_year, via T.named).
Reworked to match that shape: the expected slug is now sourced from
T.sunday_slug (season/weekday logic, a different function entirely
from T.anchors's own hand-typed string), and both the presence and
erosion checks reuse the real missing_from_anchors detector instead
of a bespoke, self-referential one.
| -rw-r--r-- | test/test_temporal_ef.ml | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/test/test_temporal_ef.ml b/test/test_temporal_ef.ml index 8a0f38e..23a817d 100644 --- a/test/test_temporal_ef.ml +++ b/test/test_temporal_ef.ml @@ -542,21 +542,44 @@ let test_anchors_erosion_is_caught () = anchor check (validate.ml, register/spec ยง5.7) calls [temporal], not [named], so it is unaffected by this distinction and already covers this entry regardless; this is this file's own unit-level guard against the - same erosion. *) + same erosion. + + CORRECTED, fix round 1 (coordinator finding 5): the original version of + this test built [eroded] by [List.filter]-ing the exact pair it then + asserted [List.mem ... eroded = false] against -- tautological (removing + an element from a list and then checking it is not there proves nothing + about a DETECTOR; it proves [List.filter] works). The genuine detector + the OTHER erosion test above actually exercises is [missing_from_anchors] + itself, called with an "expected" set sourced INDEPENDENTLY of + [T.anchors] ([named_slugs_for_year], via [T.named] -- a different + function entirely) -- the interesting claim is that the SAME slug is + confirmed by two independent computations, not merely that a filtered + list lacks what was filtered out of it. Reworked to match: the + "expected" side here is [T.sunday_slug expected_date] -- computed via + season/weekday logic, not read out of [T.anchors]'s own hand-typed + string -- so the presence check below is a genuine cross-check between + two independent sources, and the erosion check reuses the real + [missing_from_anchors] detector rather than re-deriving a bespoke, + self-referential one. *) let test_holy_family_anchor_present_and_erosion_is_caught () = let y = 2026 in - let expected_slug = "ef-time-after-epiphany-sunday-1" in let expected_date = T.holy_family_sunday y in - Alcotest.(check bool) "the anchor entry exists, at the right date" true - (List.mem (expected_slug, expected_date) (T.anchors y)); - (* Erosion: with the entry struck out, [T.temporal] itself still puts - [expected_slug] at [expected_date] (unaffected -- deleting an [anchors] - row never touches [temporal]'s own computation, only what is CHECKED - against it), so a reader who only trusted [anchors] would no longer be - told to look there at all. *) - let eroded = List.filter (fun (s, dt) -> not (String.equal s expected_slug && dt = expected_date)) (T.anchors y) in - Alcotest.(check bool) "the erosion is caught: the entry no longer appears" false - (List.mem (expected_slug, expected_date) eroded); + let expected_slug = + match T.sunday_slug expected_date with + | Some s -> s + | None -> Alcotest.fail "sanity: holy_family_sunday must itself be a Sunday" + in + Alcotest.(check (list string)) + "the anchor entry exists: T.sunday_slug's own independent computation is not missing from T.anchors" [] + (missing_from_anchors ~named_slugs:[ expected_slug ] ~anchors:(anchor_slugs y)); + (* Erosion: with the entry struck out of [anchors], [missing_from_anchors] + -- the SAME real detector, not a bespoke re-check -- must now report it + missing, using [expected_slug]'s own independent source ([sunday_slug]) + as the thing being checked FOR, not derived from the erosion itself. *) + let eroded_anchors = List.filter (fun s -> s <> expected_slug) (anchor_slugs y) in + Alcotest.(check (list string)) "the erosion is caught: missing_from_anchors reports it, and only it" + [ expected_slug ] + (missing_from_anchors ~named_slugs:[ expected_slug ] ~anchors:eroded_anchors); Alcotest.(check string) "sanity: temporal itself is unaffected by the anchors-list erosion" expected_slug (slug_of expected_date) |
