diff --git a/docs/guard-inventory.md b/docs/guard-inventory.md index 24496e4ac..9a360d26c 100644 --- a/docs/guard-inventory.md +++ b/docs/guard-inventory.md @@ -120,7 +120,7 @@ all. | `scripts/tests/test_post_review_verdict.py` | the `script-tests` job | PROOF | NONE | — | | `scripts/tests/test_pr_changed_files.py` | the `script-tests` job | PROOF | NONE | — | | `scripts/tests/test_prepush_rebase_check_tag_exemption.py` | the `script-tests` job | PROOF | NONE | — | -| `scripts/tests/test_review_verdict_vocabulary_parity.py` | the `script-tests` job, when the verdict vocabularies desync | GUARD | MUTATION | `test_review_verdict_vocabulary_parity.py::test_the_strict_extractor_consumed_EVERY_case_arm` | +| `scripts/tests/test_review_verdict_vocabulary_parity.py` | the `script-tests` job, when the verdict vocabularies desync | GUARD | MUTATION | `test_review_verdict_vocabulary_parity.py::test_the_strict_extractor_consumed_EVERY_case_arm_THE_LOOSE_ONE_FOUND` | ## What the numbers say diff --git a/scripts/tests/test_review_verdict_vocabulary_parity.py b/scripts/tests/test_review_verdict_vocabulary_parity.py index 9b1464faf..52cd6fd33 100644 --- a/scripts/tests/test_review_verdict_vocabulary_parity.py +++ b/scripts/tests/test_review_verdict_vocabulary_parity.py @@ -22,16 +22,19 @@ it prevents. So this takes detector A instead: leave both lists where they are a equality between them, EXTRACTED from each file rather than restated here. A test that spelled the words out would be a third copy of the thing whose duplication is the defect. -KNOWN LIMITS, ENUMERATED — this is a regex over shell source and CANNOT be made complete, so the -limits are listed rather than left for the next reader to discover. Three review rounds each found -another construction that escapes; a fourth would find a fifth. Currently invisible to the -extractors: +KNOWN LIMITS — NOT AN EXHAUSTIVE LIST, and the wording matters. This is a regex over shell source +and cannot be made complete; four review rounds have each found another escaping construction, so +the honest claim is "these are the ones we know of", never "these are the ones there are". An +earlier draft said ENUMERATED, which reads as exhaustive and was itself wrong within one round — +`SHIP-IT) state=success ;;` (unquoted value) escaped both extractors and was not on the list. Known +to be invisible: * a case arm whose first command is not the `state=` assignment — `SHIP*) # note` then `state="success"` on the next line; * an INDENTED later re-assignment of `POS_RE`/`NEG_RE` (inside an `if`), which the runtime uses and `test_each_verdict_pattern_is_assigned_exactly_once` does not see; - * an added alternative outside the first captured group of the read-side regex. + * an added alternative outside the first captured group of the read-side regex; + * whatever the next round finds. Assume this list is one short. What IS caught is the realistic edit: someone adding a word in the surrounding style, on either side, to one file and not the other. That is the drift this exists for, and the guard is strictly @@ -65,7 +68,14 @@ _CASE_ARM = re.compile(r'^\s*([A-Z|-]+)\)\s*state="(success|failure)"', re.M) # An emptiness check cannot see that, because the degradation is PARTIAL rather than total. So the # strict pattern is held to consuming EVERY arm the loose one finds — the same completeness idea as # the rest of this change, applied to the extractor rather than to the guard. -_ANY_CASE_ARM = re.compile(r'^\s*(\S+)\)\s*state="(?:success|failure)"', re.M) +# +# It matches `state=` with ANY value form — `"success"`, `'success'`, bare `success`. The first +# version required the double-quoted spelling in BOTH patterns, so `SHIP-IT) state=success ;;` was +# invisible to the loose one too and `unparsed` stayed empty: a completeness check that shared its +# subject's blind spot, which is no completeness check at all. The lesson is structural rather than +# about quoting — a loose counterpart must be permissive BY CONSTRUCTION, not merely a little wider +# than the strict one. Anything the strict pattern then fails to read shows up as a difference. +_ANY_CASE_ARM = re.compile(r"^\s*(\S+)\)\s*state=", re.M) # `POS_RE='^review-verdict:[[:space:]]*(mergeable|approved|lgtm)([[:space:]@]|$)'` _VERDICT_RE = re.compile(r"^(POS_RE|NEG_RE)='[^']*?\(([a-z|-]+)\)", re.M) @@ -99,7 +109,7 @@ def read_side_vocabulary() -> dict[str, set[str]]: # ------------------------------------------------------------------------------------------------ -def test_the_strict_extractor_consumed_EVERY_case_arm(): +def test_the_strict_extractor_consumed_EVERY_case_arm_THE_LOOSE_ONE_FOUND(): """PARTIAL extraction, which emptiness cannot catch. Cold review demonstrated this rather than hypothesising it: adding `SHIP*) state="success" ;;` beside the existing arm leaves `write_side_vocabulary()` returning the unchanged baseline set — non-empty, and equal to the