Skip to content

General code review - #2

Merged
matej merged 5 commits into
mainfrom
matej/general-code-review
Feb 4, 2026
Merged

General code review#2
matej merged 5 commits into
mainfrom
matej/general-code-review

Conversation

@matej

@matej matej commented Feb 3, 2026

Copy link
Copy Markdown
Member

Overview

This PR generalizes the action into a dual‑pass reviewer: a broad code‑quality review plus a dedicated security pass. It also refreshes the slash commands, filtering logic, and docs to match the new workflow.

What Changed

  • Run two review passes in the GitHub Action: general review + security‑focused review
  • Added inputs to toggle each pass (run-general-review, run-security-review)
  • Introduced a security‑specific prompt alongside the general prompt
  • Updated .claude/commands/code-review.md and .claude/commands/security-review.md to align with the new multi‑agent workflow
  • Strengthened filtering logic and metadata to handle security vs general findings cleanly
  • Updated documentation and examples to reference the PSPDFKit‑labs fork
  • Added/updated tests for the dual‑pass flow

Why

A single pass blends concerns and can dilute security‑specific signal. Running a dedicated security pass improves focus without losing broader quality review coverage.

Testing

  • python -m pytest claudecode -v

matej and others added 5 commits February 3, 2026 16:41
- Remove trailing commas in JSON examples in prompts.py (invalid JSON syntax)
- Update example URLs in slash commands to reference PSPDFKit-labs/claude-code-review

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Test only general review runs when security is disabled
- Test only security review runs when general is disabled
- Test error when both passes are disabled
- Test findings have correct review_type ('general' vs 'security')
- Test review_type is preserved if already set (setdefault behavior)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove security from general code review to avoid overlap:
- General pass: correctness, reliability, performance, maintainability, testing
- Security pass: security only (unchanged)

This gives each pass focused attention without duplicate findings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@matej
matej merged commit b17833f into main Feb 4, 2026
@matej
matej deleted the matej/general-code-review branch February 4, 2026 14:26
matej added a commit that referenced this pull request Jul 29, 2026
Both reviews independently confirmed several weaknesses in the previous
commit; all valid findings are addressed here.

Security (GitHub #1/#2, Codex F8):
- Replace the bypassable Bash denylist with an allowlist: the review
  subprocess may only run read-only git commands (diff/log/show/status/
  blame); everything else (python, node, openssl, arbitrary binaries)
  is denied in headless mode. Network tools stay denylisted as defense
  in depth.
- Remove credentials persisted by actions/checkout from .git/config
  before the scan step, so the review subprocess cannot read the
  workflow token (env stripping alone did not cover this).
- Reword README to describe defense-in-depth honestly instead of
  claiming egress is blocked.

Correctness (GitHub #3/#4/#5/#6, Codex F1/F2/F3/F5/F9):
- Diff packing now keeps fetching later pages until the character
  budget is genuinely exhausted; an oversized file on page 1 no longer
  hides every file on pages 2+.
- The filter-prompt window now grows outward from the finding line, so
  the char cap can never truncate away the very line being validated;
  focus lines beyond EOF clamp to the end of the file.
- API validation now pings the configured model instead of a hardcoded
  one - a misconfigured/retired CLAUDE_MODEL is caught up front instead
  of silently failing open on every finding (plus a loud warning when
  all validation calls fail).
- Reactions short-circuit is stricter: only an exact two-seed summary
  skips the fetch; single thumbs (possible human reaction after seed
  failure) and null counters are fetched safely.

Review quality (GitHub #7/#8, Codex F6/F7/F10):
- Dedup no longer suppresses findings whose previous thread is outdated
  (position: null) and only matches bot-authored comments; suppressed
  duplicates are listed in the review summary so they stay
  discoverable.
- Comment pagination degrades gracefully on mid-pagination API errors
  (e.g. GitHub's 3,000-file cap) instead of aborting the run; a page-1
  failure still surfaces as an error.
- The prompt's borderline-finding guidance now reflects whether the
  downstream Claude filter is actually enabled at runtime, instead of
  assuming it.
- The injection guardrail no longer demands a HIGH finding for inert
  prompt-injection strings in test fixtures/docs; it asks for judgment
  and intent-matched severity.

Tests: 243 Python + 28 JS passing (6 new Python tests, 1 new JS test,
dedup mocks updated for live-position/bot-author semantics).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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