Add Incremental Reviews on Synchronize Events

Abierto
#172 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, typescript
Área
backend, devtools

Línea de trabajo

Start with packages/core/src/review/diff-cache.ts and trace how review jobs obtain diffs and how ReviewGitProvider.getCompareDiff is used. Then inspect the synchronize job flow, review settings, dashboard job details, and related tests named by the work breakdown. Done means incremental reviews use the commit delta with a full diff fallback, preserve existing full-review behavior, show the reviewed commit range, and cover the listed paths across supported backends.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement good first issue

Summary

When a developer pushes a new commit to an open PR (synchronize event), Codra re-fetches the entire base-to-head PR diff and re-reviews every changed file from scratch. On a large PR with many files, this burns the full token budget and several minutes of wall-clock time, even if only a single file changed in the new commit.

This parent issue tracks adding optional incremental reviews. See sub-issues for each implementation step.

Work Breakdown

  • Sub-issue: Add review.incremental schema setting and document it
  • Sub-issue: Store and resolve previousCommitSha for synchronize jobs
  • Sub-issue: Add getIncrementalDiffFiles to diff-cache.ts
  • Sub-issue: Wire incremental path in the review phase and add fallback logic
  • Sub-issue: Show reviewed commit range in dashboard job details

Current Behavior

In packages/core/src/review/diff-cache.ts:

rawDiff = await github.getPullRequestDiff(job.owner, job.repo, job.prNumber);

This always fetches the full PR diff (base to head), regardless of how many files changed in the latest push. The existing getCompareDiff method on ReviewGitProvider already supports commit-to-commit comparison but is only used for the dashboard diff viewer, never for review execution.

Proposed Behavior

When review.incremental: true is set:

  1. On synchronize, resolve previousCommitSha from the most recently completed job on the same PR
  2. Fetch github.getCompareDiff(owner, repo, previousCommitSha, newHeadSha) to get only the commit-delta diff
  3. Run the LLM review only on files in the incremental diff
  4. Retain PR-level context (title, description, existing finding fingerprints) for the summary
  5. Use the existing loadSuppressedFingerprints mechanism to avoid re-posting identical findings
  6. Fall back to full PR diff if previousCommitSha is not available

Done When

  • review.incremental: true triggers commit-delta diff fetching on synchronize events
  • Only files changed between the previous and new commit are sent to LLM review
  • Falls back to full PR diff gracefully when no previous commit SHA is available
  • Existing auto-triggered and mention-triggered full reviews continue to work unchanged
  • Job details in the dashboard show the reviewed commit range for incremental jobs
  • Tests cover incremental path, full-diff fallback, and superseded-job resumption
  • Any backend changes work in both Cloudflare Workers and Node/Docker
  • npm run typecheck, npm test, and npm run lint all pass
Lenguaje dominante
TypeScript
Estrellas
125
Forks
23
Merge medio
2 d 13 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de devarshishimpi/codra

Todos los issues de devarshishimpi/codra

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.