Skip to content

ci(claude): give the PR reviewer project context and a change-aware lens - #52

Merged
gonzafg2 merged 2 commits into
mainfrom
ci/claude-review-project-context
Jun 11, 2026
Merged

gonzafg2 merged 2 commits into
mainfrom
ci/claude-review-project-context

Conversation

@gonzafg2

Copy link
Copy Markdown
Owner

Summary

Upgrades the claude-code-review.yml reviewer from the generic /code-review plugin to a project-specific, change-aware review.

What changes

  1. Project-context prompt. The reviewer reads CLAUDE.md and classifies each PR, then applies the right lens:
    • ADR/RFC (docs/adr/, docs/rfcs/) → design-coherence review (does it weaken a MANIFIESTO commitment? sound decision? template followed? TBD references?). Does not hunt for bugs that don't exist.
    • Rust code (crates/) → the hard security rules (no unsafe, no unbounded pre-auth allocation, no legacy crypto, type-state intact, mandated log fields, key zeroization).
    • Other → light consistency review.
  2. Fused output. A single GitHub PR review: summary body + inline comments anchored to file:line — both at once, natively.
  3. Model pinned to claude-sonnet-4-6 for deterministic reviews.
  4. Permission pull-requests: read → write — the minimum needed to post a review.
  5. Drops the generic plugin + marketplace and the installer's placeholder comments.

Why

The generic reviewer evaluated every PR as if hunting for code bugs, which is noise on the ADR PRs that are the entire current backlog (#46–#51). This makes the review evaluate against the MANIFIESTO and threat model — and it's already in place for when crates/ lands.

Type of change

  • Refactor / chore / CI / build

Security considerations

  • pull-requests: write is an increase in surface, but the minimum needed to post a review; no contents: write. On fork PRs, GitHub issues a read-only token under the pull_request trigger, so an external fork's review cannot post — safe by default. Suits the single-maintainer flow (branches in-repo).
  • The prompt interpolates only github.repository and pull_request.number (an integer) — no free-text user input reaches a shell, so no injection surface. No run: blocks.

Checklist

  • Commits signed off under the DCO.
  • Conventional Commits.
  • Signed commit.
  • YAML validated.

Notes for reviewers

This PR will be reviewed by the old generic reviewer (the new one only takes effect once merged). The first PR to get the new project-aware review will be the next one opened after merge.

gonzafg2 added 2 commits June 10, 2026 22:36
Replaces the generic /code-review plugin invocation with a project-
specific prompt that reads CLAUDE.md and classifies each PR (ADR/RFC vs
Rust code vs other), applying the right lens — design-coherence for
ADRs, the hard security rules for crates/. The review is posted as a
single GitHub PR review: a summary body plus inline comments anchored to
file:line.

- prompt: project-aware, threat-model/MANIFIESTO anchored, high-signal
  only (>= 80% confidence), no nitpicks.
- claude_args: pin --model claude-sonnet-4-6 for deterministic reviews.
- permissions: pull-requests read -> write, the minimum needed to post
  the review (still no contents write; fork PRs get a read-only token so
  cannot post — safe by default).
- drops the generic code-review plugin and its marketplace; removes the
  installer's placeholder comments.

Signed-off-by: Gonzalo Fleming <[email protected]>
@gonzafg2
gonzafg2 merged commit 98a182d into main Jun 11, 2026
6 of 7 checks passed
gonzafg2 added a commit that referenced this pull request Jun 11, 2026
…ontext (#54)

Root cause of the no-post / permission-denials problem: PR #52 removed
the code-review plugin in favour of a pure prompt. But the plugin IS
the posting mechanism — the canonical code-review workflow in the
claude-code-action docs uses `plugins: code-review@claude-code-plugins`
+ `/code-review:code-review`. Without it, Claude has no tool to create
inline review comments, so it tried gh (denied) and posted nothing.

Restore the plugin, and keep the project-aware behaviour two ways the
plugin already honours:
- CLAUDE.md (read automatically by the plugin) for the review criteria;
- --append-system-prompt for the ADR-vs-Rust change-aware lens.

Net result is better than the original generic plugin: same robust
posting, now with project context and a change-aware lens. Model stays
pinned to claude-sonnet-4-6; pull-requests: write retained.

Signed-off-by: Gonzalo Fleming <[email protected]>
@gonzafg2
gonzafg2 deleted the ci/claude-review-project-context branch July 18, 2026 04:16
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.

1 participant