From 6639bae5719950eb8c768c7c108a99076f3f9a59 Mon Sep 17 00:00:00 2001 From: Martin Vogel Date: Thu, 27 Aug 2026 23:45:29 +0200 Subject: [PATCH] fix(contract): catch badge-form language counts, correct the README badge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The language-count contract shipped this morning in #1859 had a hole: it matched only the prose form " languages", so README's shields badge ("languages-158-orange") never matched and the gate reported success while the badge sat three behind the prose in the same file. The cause is worth recording. The surfaces were enumerated with the same regex the gate then used, so the verification could only ever confirm what the enumeration had already seen. A gate and its own completeness check must not share a pattern. Both claim forms are now matched, in the per-surface check and in the unregistered-file sweep, so a new file stating a count in either form still fails. README's badge is corrected to 161. Also corrects a stale range comment left by the PL/SQL merge: matrix B's header said "CBMLanguage 80..163" when PL/SQL had made it 164. That is the comment variant of the additive-counter trap — the numeric constants were audited across that rebase, the prose describing them was not. The two sibling range descriptors (GO..ARKTS = 68 rows, RACKET..PLSQL = 47 rows) were checked and are correct. Signed-off-by: Martin Vogel --- README.md | 2 +- tests/repro/repro_call_argument_matrix_b.c | 2 +- tests/test_language_count_contract.sh | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3ba2b0c896..a3ab6e3686 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE) [![CI](https://img.shields.io/github/actions/workflow/status/DeusData/codebase-memory-mcp/dry-run.yml?label=CI)](https://github.com/DeusData/codebase-memory-mcp/actions/workflows/dry-run.yml) [![Tests](https://img.shields.io/badge/tests-6768_passing-brightgreen)](https://github.com/DeusData/codebase-memory-mcp) -[![Languages](https://img.shields.io/badge/languages-158-orange)](https://github.com/DeusData/codebase-memory-mcp) +[![Languages](https://img.shields.io/badge/languages-161-orange)](https://github.com/DeusData/codebase-memory-mcp) [![Hybrid LSP](https://img.shields.io/badge/Hybrid_LSP-10_languages-blue)](#hybrid-lsp) [![Agents](https://img.shields.io/badge/agent_surfaces-43-purple)](https://github.com/DeusData/codebase-memory-mcp) [![Pure C](https://img.shields.io/badge/pure_C-no_language_runtime-blue)](https://github.com/DeusData/codebase-memory-mcp) diff --git a/tests/repro/repro_call_argument_matrix_b.c b/tests/repro/repro_call_argument_matrix_b.c index 2ddaeca0bd..7337813445 100644 --- a/tests/repro/repro_call_argument_matrix_b.c +++ b/tests/repro/repro_call_argument_matrix_b.c @@ -1,5 +1,5 @@ /* - * Exhaustive call-argument reproduction matrix, CBMLanguage 80..163. + * Exhaustive call-argument reproduction matrix, CBMLanguage 80..164. * * Every language in this numeric range whose live spec has call-node metadata * owns one TEST row below. Semantic applications are exercised twice: once as diff --git a/tests/test_language_count_contract.sh b/tests/test_language_count_contract.sh index 1b664c0d19..bf910c7711 100644 --- a/tests/test_language_count_contract.sh +++ b/tests/test_language_count_contract.sh @@ -81,7 +81,15 @@ for path in "${SURFACES[@]}"; do failures=$((failures + 1)) continue fi - hits=$(grep -oE '[0-9]{2,3} languages' "$path" | grep -oE '^[0-9]+' | sort -u || true) + # Two claim forms. Prose says " languages"; a shields.io badge says + # "languages--colour". The badge was MISSED by the first version of this + # contract: it gated only the prose form, so README's badge sat three behind + # the prose in the same file while this test reported success. The lesson is + # that the enumeration and the gate must not share a regex — if they do, the + # gate can only ever confirm what the enumeration already saw. + hits=$( { grep -oE '[0-9]{2,3} languages' "$path" | grep -oE '^[0-9]+' + grep -oiE 'languages-[0-9]{2,3}' "$path" | grep -oE '[0-9]+$' + } | sort -u || true) if [[ -z "$hits" ]]; then echo "FAIL: $path is registered as a language-count surface but states no" \ "count — either it lost the claim (drop it from SURFACES) or the" \ @@ -113,7 +121,7 @@ while IFS= read -r path; do "SURFACES so it stays in step with the registry, or to EXEMPT with a" \ "note saying what its number actually counts." >&2 failures=$((failures + 1)) -done < <(git grep -IlE '[0-9]{2,3} languages' || true) +done < <(git grep -IlE '[0-9]{2,3} languages|languages-[0-9]{2,3}' || true) if ((failures > 0)); then echo "FAIL: $failures language-count contract violation(s)" >&2