@@ -81,7 +81,15 @@ for path in "${SURFACES[@]}"; do
8181 failures=$(( failures + 1 ))
8282 continue
8383 fi
84- hits=$( grep -oE ' [0-9]{2,3} languages' " $path " | grep -oE ' ^[0-9]+' | sort -u || true)
84+ # Two claim forms. Prose says "<N> languages"; a shields.io badge says
85+ # "languages-<N>-colour". The badge was MISSED by the first version of this
86+ # contract: it gated only the prose form, so README's badge sat three behind
87+ # the prose in the same file while this test reported success. The lesson is
88+ # that the enumeration and the gate must not share a regex — if they do, the
89+ # gate can only ever confirm what the enumeration already saw.
90+ hits=$( { grep -oE ' [0-9]{2,3} languages' " $path " | grep -oE ' ^[0-9]+'
91+ grep -oiE ' languages-[0-9]{2,3}' " $path " | grep -oE ' [0-9]+$'
92+ } | sort -u || true)
8593 if [[ -z " $hits " ]]; then
8694 echo " FAIL: $path is registered as a language-count surface but states no" \
8795 " count — either it lost the claim (drop it from SURFACES) or the" \
@@ -113,7 +121,7 @@ while IFS= read -r path; do
113121 " SURFACES so it stays in step with the registry, or to EXEMPT with a" \
114122 " note saying what its number actually counts." >&2
115123 failures=$(( failures + 1 ))
116- done < <( git grep -IlE ' [0-9]{2,3} languages' || true)
124+ done < <( git grep -IlE ' [0-9]{2,3} languages|languages-[0-9]{2,3} ' || true)
117125
118126if (( failures > 0 )) ; then
119127 echo " FAIL: $failures language-count contract violation(s)" >&2
0 commit comments