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 <noreply@anthropic.com>
This commit is contained in:
parent
444db7b971
commit
cda0204c69
1 changed files with 48 additions and 15 deletions
|
|
@ -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 /// <reference stay code, like #[ and #!), with # in
|
||||
.toml, .yml and .sh (a #! shebang stays code), none in .json, .md or any
|
||||
other file. They and blank lines are skipped wherever the script reads
|
||||
the changed lines, while REVIEW.md says "hors commentaires" for lib.rs
|
||||
and the manifests only.
|
||||
.toml, .yml and .sh (a #! shebang stays code, and so does a .yml line that
|
||||
holds a ${{ }} expression, which the runner substitutes in a run: before
|
||||
the shell reads it), none in .json, .md or any other file. They and blank
|
||||
lines are skipped wherever the script reads the changed lines, while
|
||||
REVIEW.md says "hors commentaires" for lib.rs and the manifests only.
|
||||
- lib.rs: only generate_handler![] entries are exempt, not the tests module.
|
||||
- Tauri configuration and manifests: only a line that sets a version.
|
||||
- Lock files: a package added or removed; an added source or resolved
|
||||
|
|
@ -35,7 +37,9 @@ conditions of the Haut table are only approximated from the diff.
|
|||
key); a checksum or integrity added in a hunk that adds no version.
|
||||
- Check workflows: a change that can turn a failing check green, read
|
||||
against the PR's merge base; an env: block added at the workflow or job
|
||||
level, or a run: step that deletes or edits a file (rm, sed -i), comes
|
||||
level, a run: step that deletes or edits a file (rm, sed -i), or a ${{ }}
|
||||
expression added to a step that is not a verdict step, in a comment or
|
||||
not (the PR body, say, which the shell then runs before npm test), comes
|
||||
out normal.
|
||||
- Network calls: reqwest in Rust, fetch to an absolute URL in TS; an opened
|
||||
URL is not seen.
|
||||
|
|
@ -164,7 +168,9 @@ def meaningful(text, path):
|
|||
# compiler directives are code, and so are #[...] and #! (no //)
|
||||
return not t.startswith("//") or re.match(r"//+\s*@ts-|///\s*<reference", t) is not None
|
||||
if path.endswith(HASH_COMMENT):
|
||||
return not t.startswith("#") or t.startswith("#!")
|
||||
# a shebang is code; so is a workflow line that holds an expression:
|
||||
# the runner substitutes ${{ }} in a run:, comments included (#419)
|
||||
return not t.startswith("#") or t.startswith("#!") or (path.endswith(".yml") and "${{" in t)
|
||||
return True
|
||||
|
||||
|
||||
|
|
@ -440,27 +446,44 @@ CARGO_OFF_INDEX = '''@@ -1,5 +1,5 @@
|
|||
# Offline probes run by --check: a path, the hunks of its diff (None: an empty
|
||||
# diff) and the expected level. A typo shared by the Haut table and the script
|
||||
# passes the pattern comparison, and the replay sees it only when a PR of the
|
||||
# range has that pattern for its only high trigger (review of #498, mutation
|
||||
# M4). Hence one probe per "toujours" pattern that no PR of #344-#452
|
||||
# exercises, the two of the Release row, and one per rule of this script that
|
||||
# the range does not exercise either (#476).
|
||||
# range has that pattern for its only high trigger, which no pattern of
|
||||
# #344-#498 has but the license_commands variant (#386): reviews of #498,
|
||||
# mutation M4, and of #499, mutations R1, R15, R16. Hence one probe per variant
|
||||
# of every pattern without a condition, which check() requires, the normal
|
||||
# side of the Release row, and one per rule of this script that the range
|
||||
# does not exercise (#476).
|
||||
PROBES = [
|
||||
(".claude/skills/release/scripts/verify-release.sh", None, "haut"),
|
||||
(".claude/skills/release/SKILL.md", None, "normal"),
|
||||
("src-tauri/src/database/schema.sql", None, "haut"),
|
||||
("src-tauri/src/commands/profile_commands.rs", None, "haut"),
|
||||
("src-tauri/src/commands/license_commands.rs", None, "haut"),
|
||||
("src-tauri/src/commands/entitlements.rs", None, "haut"),
|
||||
("src-tauri/src/commands/auth_commands.rs", None, "haut"),
|
||||
("src-tauri/src/commands/token_store.rs", None, "haut"),
|
||||
("src-tauri/src/commands/account_cache.rs", None, "haut"),
|
||||
("src/services/licenseService.ts", None, "haut"),
|
||||
("src/services/authService.ts", None, "haut"),
|
||||
(".claude/skills/issue-license/SKILL.md", None, "haut"),
|
||||
("src-tauri/src/commands/export_import_commands.rs", None, "haut"),
|
||||
("src-tauri/src/commands/feedback_commands.rs", None, "haut"),
|
||||
("src/services/feedbackService.ts", None, "haut"),
|
||||
("src-tauri/capabilities/default.json", None, "haut"),
|
||||
(".forgejo/workflows/release.yml", None, "haut"),
|
||||
("scripts/build-latest-json.sh", None, "haut"),
|
||||
("scripts/check-latest-json.jq", None, "haut"),
|
||||
(".claude/skills/release/scripts/verify-release.sh", None, "haut"),
|
||||
("src-tauri/build.rs", None, "haut"),
|
||||
("vite.config.ts", None, "haut"),
|
||||
("vitest.config.ts", None, "haut"),
|
||||
("postcss.config.mjs", None, "haut"),
|
||||
(".postcssrc.json", None, "haut"),
|
||||
(".npmrc", None, "haut"),
|
||||
("src-tauri/rust-toolchain.toml", None, "haut"),
|
||||
("Cargo.toml", None, "haut"),
|
||||
("Cargo.lock", None, "haut"),
|
||||
(".cargo/audit.toml", None, "haut"),
|
||||
(".claude/settings.json", None, "haut"),
|
||||
(".mcp.json", None, "haut"),
|
||||
(".claude/skills/release/SKILL.md", None, "normal"),
|
||||
# an attribute is code, a // line a comment
|
||||
("src-tauri/src/lib.rs", '@@ -1 +1,2 @@\n+#[cfg(feature = "dev-override")]\n pub fn run() {', "haut"),
|
||||
("src-tauri/src/lib.rs", "@@ -1 +1,2 @@\n+// Builds the app.\n pub fn run() {", "normal"),
|
||||
|
|
@ -496,6 +519,8 @@ COMMENT_PROBES = [
|
|||
("x.ts", '/// <reference types="vite/client" />', 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
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue