Skip to content

feat: Disallow large diffs + CI gate mode #149

Closed

Description

@ajianaz

Problem

Pre-commit hook gagal review PR dengan diff besar (262K chars, max 51200), tapi tidak block — hanya warning. Commit tetap jalan tanpa Cora review.

Warning: Cora stderr: Error: Diff too large (262187 chars, max 51200).
Use --base to review a specific branch, or increase hook.max_diff_size.

Ini artinya PR bisa merge tanpa code review sama sekali.

Root Cause

Pre-commit hook on_violation default ke warn, bukan disallow. Jadi Cora skip tapi push tetap lolos.

Proposal

1. .cora.yaml — disallow option for on_violation

hooks:
  pre-commit:
    max_diff_size: 51200
    on_violation: disallow  # NEW: block commit, not just warn

When disallow: git commit fails with exit code 1.
Dev can override with git commit --no-verify (manual escape hatch).

2. CI mode: cora review --base <branch>

Add --base flag support for CI workflows:

# .github/workflows/ci.yml
- name: Cora Review
  run: cora review --base ${{ github.base_ref }}
  env:
    CORA_API_KEY: ${{ secrets.CORA_API_KEY }}

This compares full PR diff against target branch — no max_diff_size limit in CI mode. Becomes a required GitHub check.

3. Workflow support in config

ci:
  base: ${{ github.base_ref }}  # auto-detect in CI
  required: true                # fail workflow if cora finds issues

Trade-offs

Aspect Pro Con
disallow on large diff Forces small, reviewable PRs Annoying for legitimate large changes
--no-verify escape hatch Flexibility Can be abused
CI --base mode Always review, no size limit Uses API quota per PR
Required check Cannot merge without review CI must pass first

Trigger

Triggered by: ajianaz/uteke PR #160 (262K diff, cora skipped via pre-commit warning)

Co-Authored-By: codecoradev [email protected]

Activity

  1. added
    enhancement
    v0.5
    on Jun 3, 2026
  2. added 3 commits that reference this issue on Jun 5, 2026
    e9ce3ac
    2b983d2
    c7d9e11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementv0.5

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions