Skip to content

feat(review): check a branch locally, before its pull request, as CI will check it - #15

Merged
soydiloreto merged 2 commits into
mainfrom
feat/local-review
Sep 29, 2026
Merged

soydiloreto merged 2 commits into
mainfrom
feat/local-review

Conversation

@soydiloreto

Copy link
Copy Markdown
Member

📝 What changes

New scripts/local-review.sh runs on a contributor's machine what a pull request is checked on, before it exists:

  • the conventions, in the new scripts/conventions.sh (the checks conventions.yml makes: branch, title, every commit header, no session trailer, description sections, no "Generated with" footer), with --test self-tests now run by this repository's scripts job;
  • the risk floor, through scripts/policy.py, which now reads the policy files with PyYAML where yq is not installed;
  • the Claude review on the brief claude-review.yml builds, in the new scripts/review-brief.sh (verified byte for byte against the workflow's inline code on two real pull requests), through the local Claude Code CLI on the contributor's own account (subscription or API key). With --no-claude, or without the CLI, it stops at the brief for another agent to read.

It ends with "Ready for a pull request" or with what to fix, and exits 1 on a broken convention or a blocker/major finding. CONTRIBUTING.md has a new "Review before the pull request" section (and says the docs job, links and retired names, is not part of it), AGENTS.md makes it the step before any pull request and says not to push or re-run workflows unasked, and the README lists the three scripts.

The workflows keep their inline code in this pull request: this repository's own pull requests read the scripts from main, so switching them comes in a follow-up once these are there.

💡 Why

Every review on GitHub costs money and a round of waiting, and today the first real review of a change happens only after the push. With the same checks available locally, a branch arrives clean and is reviewed on GitHub once. DiluxOne/.github is public, so anyone who clones a DiluxOne repository can run it.

🧪 How I tested it

  • bash scripts/conventions.sh --test: 10 cases (right, wrong branch, trailing period, over 100 characters, bad commit header, Claude-Session trailer, empty Why, Generated-with footer, title type unlike its label).
  • release-markers.sh --test, next-version.py --test, actionlint: green.
  • review-brief.sh against the workflow's inline code on DiluxOne/diluxone-offload-wordpress feat(kinds)!: project kinds as packs, a generic review-rules engine and strict Plugin Check, as v3 #22 and #27: identical output.
  • local-review.sh on a docs change in Offload (low floor, Sonnet: "Ready") and on this branch (high floor, Opus: 6 minor findings, fixed here: a README comma, bash 3.2 and BSD sed portability, the docs-job note, the YAML 1.1 note).

🤖 AI-generated · Claude Opus 5.5 (Anthropic)

…will check it

scripts/local-review.sh runs on a contributor's machine what a pull request is checked on: the conventions (scripts/conventions.sh, the checks conventions.yml makes, with self-tests), the risk floor (scripts/policy.py, which now reads the policies with PyYAML where yq is not installed), and the Claude review on the brief claude-review.yml builds (scripts/review-brief.sh), through the local Claude Code CLI on the contributor's account.

Every review on GitHub costs money and a round of waiting; a branch that comes out clean locally should pass there in one round. CONTRIBUTING.md explains how to run it and AGENTS.md makes it the step before any pull request. The workflows switch to these scripts in a follow-up, once they are on main, since this repository's own pull requests read the scripts from main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread scripts/local-review.sh Outdated
@dilux-bot dilux-bot Bot added risk:high Set by the Claude review complexity:medium Set by the Claude review type:feat The kind of change, read from the diff by the Claude review labels Sep 29, 2026
@dilux-bot

dilux-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Claude review · risk high · complexity medium · type feat

Incremental review (a0af279..0bf78dd). The new commits fix two earlier findings. The profile lookup in local-review.sh no longer stops the script when no workflow names a profile: the { grep …|| true; } group keeps pipefail/set -e from firing, and it also covers a SIGPIPE from head. The README row for conventions.sh now lists AUTHOR_TYPE. What is still open is minor. The conventions rules and the brief builder each exist twice, in the scripts and in the workflows' inline code, until the promised follow-up. The profile lookup also has two small edge cases. The pull request as a whole adds a local pre-PR review flow (feat, not breaking). It is contributor tooling, not a new product capability, so I don't suggest version:major. The description matches the diff. The risk is high because the policy floor says so and because AGENTS.md and CONTRIBUTING.md change for every repository.

  • minor scripts/conventions.sh:18: The conventions rules live twice (this script and conventions.yml's inline step) until the follow-up switches the workflow. They can drift apart meanwhile.
  • minor scripts/review-brief.sh:1: The brief builder duplicates claude-review.yml's inline code until the promised follow-up, and nothing checks that the two stay the same.
  • minor scripts/local-review.sh:50: Profile lookup: \s in grep -E is GNU-only. A quoted profile: 'x' or an unspaced profile:x gives an empty value and silently falls back to general.

Policy floor: high (touches high-risk paths: .github/workflows/pull-request.yml, AGENTS.md, CONTRIBUTING.md, README.md, scripts/conventions.sh …). Reviewed 0bf78dd (since a0af279; review 2 of 5 automatic). Author trusted for auto-merge: true.

🤖 AI review · claude-opus-5-5 (Anthropic) · $0.20, 4 turns

The profile lookup ran grep under set -e and pipefail, so a repository with no profile: line in its workflows (the usual case outside a plugin) ended the script silently before any check. The README lists AUTHOR_TYPE among conventions.sh's variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dilux-bot dilux-bot Bot added risk:high Set by the Claude review complexity:medium Set by the Claude review type:feat The kind of change, read from the diff by the Claude review and removed risk:high Set by the Claude review complexity:medium Set by the Claude review type:feat The kind of change, read from the diff by the Claude review labels Sep 29, 2026
@soydiloreto
soydiloreto merged commit 2e814f8 into main Sep 29, 2026
6 checks passed
@soydiloreto
soydiloreto deleted the feat/local-review branch September 29, 2026 00:51
soydiloreto added a commit that referenced this pull request Sep 29, 2026
…rry their tests (#16)

## 📝 What changes

The workflows now run the scripts the local review uses, instead of their own inline copies:

- `conventions.yml` runs `scripts/conventions.sh`, read from DiluxOne/.github at the new `central-ref` input (default `v2`, like the other workflows); this repository's own pull requests run their own copy.
- `claude-review.yml` builds its brief with `scripts/review-brief.sh`. The code moved as it was: the brief comes out byte for byte the same, checked on two real pull requests.

So what runs on GitHub and what runs on a contributor's machine are the same files and can no longer drift apart.

The three scripts that had no tests now have them, run by the scripts job:

- `local-review.sh --test` (11 cases, never runs the review itself): no profile anywhere, a profile the workflow passes (quoted or not, or overridden with `--profile`), no commit, two commits without a title, a bad commit header, an empty or a filled description, with and without an origin remote, an unknown option. Writing them found one more bug, fixed here: a repository without an `origin` remote stopped the script. The profile is now read quoted or unquoted, with portable patterns.
- `review-brief.sh --test` (15 cases): what the reviewer is shown, including rewritten files, binaries and lock files, the floor-dependent rules, the incremental scope and a diff over the limit.
- `policy.py --test` (23 cases): floor, trust, auto-merge, model, budget and the changes mode, against the organisation's default policy.

AGENTS.md gains a rule: a problem a review finds that a test could have caught comes with that test, in the same pull request.

## 💡 Why

The previous pull request (#15) left the conventions and the brief in two places, the scripts and the workflows, until this switch. Its review also found a bug in `local-review.sh` that no test covered; the local review had not seen it. A review is a reading and may miss a thing; a test catches it every time. `policy.py` decides the model and whether a change may merge without a person, and had no test at all.

## 🧪 How I tested it

- Every script's `--test` locally: conventions, review-brief, local-review, policy, release-markers, release-ready, stamp-version, next-version, all green.
- The `local-review.sh` test fails with the #15 bug put back.
- actionlint on every workflow.
- `local-review.sh` on this branch before pushing: it found five minor points (three header comments, a duplicated test case, a test that did not check what its name said), fixed here.

🤖 AI-generated · Claude Opus 5.5 (Anthropic)

---------

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity:medium Set by the Claude review risk:high Set by the Claude review type:feat The kind of change, read from the diff by the Claude review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant