Skip to content

refactor(scripts): simplify five check scripts without changing behavior - #14384

Merged
melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14352-42570136912-1
Nov 9, 2026
Merged

melodic-automation-lanes[bot] merged 1 commit into
mainfrom
work-resolve-issue/issue-14352-42570136912-1

Conversation

@melodic-automation-lanes

@melodic-automation-lanes melodic-automation-lanes Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #14352

Summary

Opened by the work-resolve-issue lane. The run's own summary:

Simplified five of the seven listed check scripts. Each change removes repetition or skips work that cannot affect the result, and leaves outputs, exit codes, output order, flags and imported names unchanged. check-comment-hygiene.sh and check-conformance-registry.sh are already tight: every simplification found for them traded clarity or exact behavior for little gain, so they are unchanged.

Not verified

  • tidy: not run. The whole change is under scripts/, a listed shared path, so the tidy cutoffs exclude it.
  • The Python unit tests (scripts/test_check_code_metrics_config_reference.py, test_check_code_metrics_skill_prose.py, test_check_contract_clause_coverage.py) and the sibling *.test.sh suites did not run directly: this lane runs no interpreter. They are left to the PR's CI.
  • The changed gates' own whole-repo runs (code-metrics-config-reference, code-metrics-skill-prose, contract-clause-coverage, convention-yaml-schema) are CI-only per check-affected; they are left to the PR's CI.
  • ci-status green on the PR: a CI check, left to the PR's CI.
  • check-comment-hygiene.sh and check-conformance-registry.sh were reviewed and left unchanged: no simplification found that was both clearer and certain to keep the exact behavior.

Fix

  • scripts/check-code-metrics-config-reference.py: default_leaves is a dict comprehension; key_table finds the heading with next(); a cannot_run helper replaces five copies of the CANNOT RUN print-and-return-2 block; dropped a tracker back-reference from the docstring (argparse reads only its first…
  • scripts/check-code-metrics-skill-prose.py: expected_phrases names each target file once (new SKILLS prefix plus local path names) and builds the min_tokens/min_lines phrases once for both files. The 14 (path, phrase) pairs are byte-identical and in the same order.
  • scripts/check-contract-clause-coverage.py: a _missing_qualifiers generator replaces the two identical span-by-qualifier loops in check_clause; restatements is incremented by len(spans); _markers_on uses match.group() instead of groupdict().get().
  • scripts/check-convention-yaml.sh: the plugins/*/schemas fallback glob runs only when neither the plugin schema nor the convention schema exists, not for every file.
  • scripts/check-cross-plugin-source-drift.sh: an associative-array lookup replaces the is_skipped loop function (and its SC2310 disable); one registry loop both filters the cluster lines and records registered entries.

Verification

The runner ran each check from the base copy against 9972859:

  • scripts/check-changelog-fragments.sh --check: passed
  • scripts/check-changed-skills.sh --merge-base: passed

The run reports:

  • check-changelog-fragments: all 4 fragments under .changes/ valid (scripts/ is not a plugin, so no fragment is owed)
  • check-changed-skills: no changed skills, nothing to gate
  • check-affected: 12 passed, 4 skipped (markdown, typos not installed, validate-plugins, changed-skills) over 5 changed files
  • review: a fresh-context subagent read the full diff and current files against the tests that import gate.render_default, gate.Unrepresentable, gate.expected_phrases, gate.check, gate.DEFAULT_DEFAULTS and gate.REPO_ROOT. It found no behavior change in any hunk: same text, exit codes, order,…
  • The lane run: https://github.com/melodic-software/claude-code-plugins/actions/runs/42570136912

Left out: the items under Not verified.

Related

#14352

Merge-Risk: max=MEDIUM demote=false head=99728592db845497c6b18d49d10805576ae8d86d rubric=8.1.2 rater=claude-opus-5-5 checker=claude-opus-5-5

Lane-Activity: work-resolve-issue/resolve-issue
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-security-review reviewed 99728592db845497c6b18d49d10805576ae8d86d: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Security review: PR #14384 (head 9972859)

I found no security issues.

I read every hunk in all 5 changed files. None of them matches a trusted-path glob, and none is a trust control, merge hold, manifest or standing instruction. All five are repository check scripts under scripts/. They read local files and report findings or exit codes.

  • scripts/check-code-metrics-config-reference.py: the comprehension, the next() heading lookup and the cannot_run helper keep the same messages and the same fail-closed exit code 2.
  • scripts/check-code-metrics-skill-prose.py: the (path, phrase) pairs are the same values in the same order. Nothing new is read and no path comes from input.
  • scripts/check-contract-clause-coverage.py: match.group(...) replaces groupdict().get(...). MARKER_RE (line 118) builds both _html and _line named groups through _marker_body, so group() returns None for an unmatched group exactly as before. The _missing_qualifiers generator and restatements += len(spans) produce the same findings in the same order.
  • scripts/check-convention-yaml.sh: the plugins/*/schemas fallback now runs only after the plugin and convention schemas are both missing. The precedence and the literal name compare are unchanged, and a missing schema is still counted as a finding.
  • scripts/check-cross-plugin-source-drift.sh: an associative-array lookup replaces the skip loop. The subscript ${full##*/} is expanded once and is never evaluated as arithmetic or a command, so a crafted filename gets nothing extra. The merged registry loop records the same entries.

The PR context file contains no embedded instructions aimed at this review.

critical-findings: 0

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

claude-review reviewed 99728592db845497c6b18d49d10805576ae8d86d: read 5 of 5 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #14384, simplifying five check scripts with no behavior change

No findings. I read every hunk in all 5 changed files and checked each rewrite for any change in what the scripts do.

  • scripts/check-code-metrics-config-reference.py
    • The default_leaves comprehension filters and orders keys exactly as the old loop did.
    • The next(...) call in key_table returns the same start value, including None when the heading is missing.
    • cannot_run prints the same CANNOT RUN: <path>: <error> text to stderr and returns 2 at all five call sites. The top level is not a JSON object message is unchanged.
    • The docstring edit removes a line from the middle of the docstring. argparse uses only the first line (__doc__.splitlines()[0]), so the CLI help text is unchanged.
  • scripts/check-code-metrics-skill-prose.py: expected_phrases returns the same 14 (path, phrase) pairs in the same order. The new module-level SKILLS adds a name and removes none.
  • scripts/check-contract-clause-coverage.py
    • match.group(...) is safe here. MARKER_RE defines all four named groups (kind_html, kind_line, id_html, id_line) through _marker_body (L112-L121), so group() returns None for a group that didn't match and never raises IndexError.
    • _missing_qualifiers yields in the same order as the old span-by-qualifier loops.
    • restatements += len(spans) gives the same count, because building a Finding cannot raise partway through.
  • scripts/check-convention-yaml.sh: the plugins/*/schemas glob now runs only when neither the plugin schema nor the convention schema exists. The order the three schema sources are tried in, the error message, and the findings count are unchanged.
  • scripts/check-cross-plugin-source-drift.sh
    • The associative-array lookup with :- works under set -u, and find -type f never produces an empty basename.
    • The merged registry loop registers the same non-arrow lines, and registry_entries still ends up holding only the path entries.
    • Nothing else used the removed base variable or the is_skipped function.

Closing issue #14352, acceptance criteria:

  • Behavior unchanged; no listed file renamed, moved or deleted: met, by my reading of the code. I did not run anything; this lane has no shell.
  • The diff edits only the listed files: met. It touches 5 of the 7 listed files and nothing outside the list.
  • Within 400 changed lines and 15 files: met.
  • ci-status is green: left to CI.

The author's statement that the Python unit tests, the *.test.sh suites and the gates' whole-repo runs passed is their own claim; I did not verify it, and those runs are left to the PR's CI.

The PR context contains no embedded instructions to the lane. No paved-path or manifest items apply.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The unattended merge path armed native auto-merge at head 99728592db845497c6b18d49d10805576ae8d86d, the head its arming checks judged.

@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

Verification evidence for 9972859

The verifier passed this head. The capture artifact holds the capture summary, which says whether the capture ran, and any screenshot or video that passed the mask check; this comment uploads no file.

Capture artifact: pr-capture-14384-99728592db845497c6b18d49d10805576ae8d86d, expires on 2026-12-09.

One comment per pull request, updated in place for each new head.

@melodic-automation-lanes
melodic-automation-lanes Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit 6261132 Nov 9, 2026
63 checks passed
@melodic-automation-lanes
melodic-automation-lanes Bot deleted the work-resolve-issue/issue-14352-42570136912-1 branch November 9, 2026 07:16
@melodic-automation-lanes

Copy link
Copy Markdown
Contributor Author

The post-merge check verified merge commit 62611323e38624bfa1e9a89b4e6de386e128e919; later checks count it verified from this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify the check-code-metrics-config-reference.py, check-code-metrics-skill-prose.py, check-comment-hygiene.sh and 4 more repository scripts

0 participants