dd9cd113c3d74e892b0586b264a0f53f32933681
1
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
dd9cd113c3 |
fix(788): one declarative H10 verdict vocabulary, derived by both sides
The verdict words lived in two hand-written shell copies — the `case` arms of `post-review-verdict.sh` (write: word -> commit-status state) and the `POS_RE`/`NEG_RE` regexes of `check-review-verdict.sh` (read: comment -> classification for the merge-consent hook). Nothing held them together but a comment, and that comment had already gone stale once. A word the writer treats as positive but the classifier does not sends `review-verdict/h10` green while the hook still denies. #774 tried to hold them together with a parity test that scraped both vocabularies out of shell source with regexes. Six cold-review rounds each found another construction that escaped the extractor (`SHIP*)`; an unquoted `SHIP-IT) state=success`) or reddened it on a correct tree (a `<word>) state=` in a heredoc; a column-zero `esac` in a string truncating the scoped match). It was withdrawn rather than patched a seventh time. So this removes the duplication instead of detecting it. `scripts/lib/review-verdict-vocabulary.sh` declares the two word arrays once and exposes three derived views: a membership test for the writer, an alternation body for the reader, and the operator-facing list for the "unknown verdict" message and the usage banner (both of which were themselves third copies). Neither script enumerates a word any more. Only the WORD SET moved. The grammar stays in `check-review-verdict.sh` — the column-0 anchor, the whole-word boundary, the anchored `@ <sha>` field. Every #629 false-open was in the grammar, and none of it belongs in a word list. Validation is the security property, not hygiene. The words are interpolated into an ERE, so a `.*` in the positive list would make `POS_RE` match every verdict-shaped line and classify an explicit BLOCKED as `positive`. Words are restricted to `[a-z][a-z-]*`, and a vocabulary that is missing, unreadable, duplicated across polarities or empty is fatal — exit 2 for the reader (callers fail closed on it), exit 1 for the writer, having posted nothing. The arrays are arrays rather than whitespace-separated strings because splitting a string needs an unquoted expansion, and an unquoted expansion also globs: the first draft, handed `.*`, reported on `.claude`. That makes validation depend on the cwd and fails open — a `*` expands to the filenames beside it, and `scripts`/`docs` both match `[a-z][a-z-]*` and would have entered the vocabulary as real verdict words. Caught by the negative control, not by review. The proof is behavioural, never textual: add a word to a sandbox copy of the one declaration and require it to reach both sides. Graded MUTATION, with the clause declared in `mutation_manifest.py` — the harness restores the pre-#788 hardcoded `POS_RE` on every run and requires the proof to go red, so a refactor that quietly reintroduces a second copy cannot leave the suite green. Known residual, deliberately not fixed: `pretooluse-merge-consent.sh` names the words in one operator-facing message string. It classifies nothing (it delegates to `check-review-verdict.sh`), so it is a prose copy, not a second implementation. Verification: 980 passed / 2 skipped (`pytest scripts/tests`), ruff clean, shellcheck clean, catalog regenerated. Refs: #788 Decisions-Edit: yes Co-authored-by: Timothy <timothy@noreply.gitea.tblindustries.be> |