Skip to content

fix(scripts): the SPDX recipe also repairs the first form of the template rule - #662

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/spdx-recipe-second-target
Nov 10, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
claude/spdx-recipe-second-target

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Summary

scripts/fix-workflow-linter-spdx-rule.sh had 1 target: the head -1 rule. #659 recorded the gap as a limit: a linter with the first form of the template rule is not a target, and keeps that form.

The first form stops only at a line in column 1 (/^[^#[:space:]]/). A workflow with an indented body then passes the lint with a licence line after the body. The template repaired this in rsr-template-repo pull request 323. The linter of system-et still has the first form.

This pull request makes the first form a second target.

Changes

  • scripts/fix-workflow-linter-spdx-rule.sh: the second target is a line that is exactly if ! awk '<first form>' "$name"; then. Only the rule text changes on that line: the 2 comment lines and the echo line are already correct in such a file.
    • One awk function finds the target. --check and the repair both use it, so the count and the repair cannot disagree.
    • The rule text is compared as a literal string, not as a pattern.
    • A line with the rule text in a different shape is not a target.
  • tests/template-drift-recipes-test.sh: 2 cases.
    • The first form is repaired to the same file that the head -1 repair gives. Before the repair, the test shows the defect: the first form accepts a licence line after an indented body.
    • The rule text in a line of another shape is not changed.
  • campaigns/TEMPLATE-DRIFT-CAMPAIGN.adoc: the target in the recipe table, the evidence, and the limit (2 targets, not 1).

The recipes are still not dispatched. This change does not touch the automation quarantine.

Testing

  • bash tests/template-drift-recipes-test.sh: PASS: registry routes, predicates, exact repairs, idempotence, refusals and symlink rejection for 3 recipes.
  • Negative control: with the old script and the new test, the test fails with fix-workflow-linter-spdx-rule.sh --check spdx-form2: expected 1, got 0.
  • Real file: a copy of the linter of system-et at main (bbe1d13). --check gives 1 before and 0 after. 1 line changes. The Check SPDX Headers step is then identical to the step of the template at main (0208563), 19 lines.
  • bash -n on the script: no error. shellcheck is not installed in the session, so it was not run. The awk of the session is mawk 1.3.4.

Not verified: the number of repositories that have the first form. No estate scan was made.


Generated by Claude Code

…late rule

The recipe had 1 target: the `head -1` rule. A linter with the first form
of the template rule was not a target and kept that form. That form stops
only at a line in column 1 (`/^[^#[:space:]]/`), so a workflow with an
indented body passes with a licence line after the body. The template
repaired this in rsr-template-repo pull request 323. The linter of
system-et has the first form.

The recipe now has a second target: a line that is exactly
`if ! awk '<first form>' "$name"; then`. Only the rule text changes on
that line. The 2 comment lines and the echo line are already there.

- `scripts/fix-workflow-linter-spdx-rule.sh`: the second target. One awk
  function finds it, for the `--check` count and for the repair, so the 2
  cannot disagree. The rule text is compared as a literal, not as a
  pattern.
- `tests/template-drift-recipes-test.sh`: 2 cases. The first form is
  repaired to the same file that the `head -1` repair gives, and the test
  shows the defect of the first form before the repair. The rule text in a
  line of another shape is not a target.
- `campaigns/TEMPLATE-DRIFT-CAMPAIGN.adoc`: the target, the evidence and
  the limit.

Evidence: on the linter of system-et at `main` (bbe1d13), the count is 1
before and 0 after, 1 line changes, and the step is identical to the step
of the template at `main` (0208563). With the old script, the new test
fails ("expected 1, got 0").

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0136P7ZmiFSCoB3UR9Kk56rK
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@sonarqubecloud

Copy link
Copy Markdown

@hyperpolymath
hyperpolymath marked this pull request as ready for review November 10, 2026 19:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T19:47:04.904972Z 5b4cae6 Draft marked ready
🔒 Security Review ❌ Failed 2026-11-10T19:45:32.020180Z
We couldn’t complete this review. Comment @codex security review to try again.
5b4cae6 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins.

@hyperpolymath
hyperpolymath enabled auto-merge (squash) November 10, 2026 19:45
@hyperpolymath
hyperpolymath merged commit 117e3e8 into main Nov 10, 2026
69 of 71 checks passed
@hyperpolymath
hyperpolymath deleted the claude/spdx-recipe-second-target branch November 10, 2026 19:48
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.

3 participants