From cda0204c69b2338115de0c19ea40a5a6bbb693e5 Mon Sep 17 00:00:00 2001 From: le king fu Date: Sun, 25 Oct 2026 15:40:10 -0400 Subject: [PATCH] test(scripts): probe every variant of the always-high patterns, read ${{ }} as code Follow-up of the independent review of PR #499 (comment 28379), applied in a link above #505 by Max's decision of 2026-10-25 (comment 28437): - PROBES holds one probe per variant of every pattern without a condition (30 variants, 15 of them new: database/**, profile_commands, the five licence commands, licenseService, authService, release.yml, build-latest-json*, check-latest-json.jq, vitest and postcss configs, Cargo.lock at the root). The replay sees a typo shared by the table and the script only through a PR whose only high trigger is that pattern, which no PR of #344-#498 has but #386. - check() fails on a variant that no probe expected high covers, so a pattern added without its probe turns --check red. - meaningful(): a .yml line that holds ${{ }} is code, not a comment; the runner substitutes the expression in a run: before the shell reads it (#419). The docstring says the script still does not flag such a line added to a step that is not a verdict step. Co-Authored-By: Claude Opus 5.5 --- scripts/review-levels.py | 63 ++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 15 deletions(-) diff --git a/scripts/review-levels.py b/scripts/review-levels.py index 21ad818..77313b3 100755 --- a/scripts/review-levels.py +++ b/scripts/review-levels.py @@ -13,8 +13,9 @@ then the distributions for the 39 reference PRs and for the whole range --check compares the patterns of this script with the first column of the Haut table of REVIEW.md, runs the offline PROBES (a path, the hunks of a synthetic diff, the expected level) and COMMENT_PROBES (a line read as a -comment or as code), and exits 1 on any difference: a PR that changes the -Niveaux section updates this script in the same diff. +comment or as code), checks that every variant of every pattern without a +condition has a probe expected high, and exits 1 on any difference: a PR +that changes the Niveaux section updates this script in the same diff. --check does not prove the conditions of the table: they stay with the high-level review. @@ -23,10 +24,11 @@ A PR's level is read in REVIEW.md, never in this script's output (neither conditions of the Haut table are only approximated from the diff. - Comments, by file extension: a line that starts with // in .rs, .ts, .tsx and .js (// @ts- and /// ', False), ("x.toml", "# a note", True), ("x.yml", "# a note", True), ("x.sh", "# a note", True), ("x.sh", "#!/usr/bin/env bash", False), + # substituted by the runner before the shell runs the step + ("x.yml", "# ${{ github.event.pull_request.body }}", False), ("x.yml", "// a note", False), ("x.json", "// a note", False), ("x.md", "# A title", False), ] @@ -527,6 +552,13 @@ def check(): if got != want: print(f"probe: {path} is {got}, expected {want}") failed = True + # a pattern without a condition, or one of its variants, added without a probe + high = [path for path, _, want in PROBES if want == "haut"] + variants = [v for pattern in HIGH_ALWAYS for v in expand_braces(pattern)] + for variant in variants: + if not any(glob_re(variant).match(path) for path in high): + print(f"unprobed: {variant} has no probe expected haut") + failed = True for path, line, comment in COMMENT_PROBES: if meaningful(line, path) == comment: print(f"comment probe: {line!r} in {path} is {'code' if comment else 'a comment'}, expected the other") @@ -534,7 +566,8 @@ def check(): if failed: return 1 print(f"ok: {len(coded)} patterns, identical to the Haut table of REVIEW.md; " - f"{len(PROBES)} probes, {len(COMMENT_PROBES)} comment probes") + f"{len(PROBES)} probes, all {len(variants)} variants without a condition probed; " + f"{len(COMMENT_PROBES)} comment probes") return 0