Skip to content

feat(core): add getIncrementalDiffFiles to the diff cache - #203

Merged
devarshishimpi merged 1 commit into
devarshishimpi:mainfrom
MaxonT:contrib/181-auto
Nov 29, 2026
Merged

devarshishimpi merged 1 commit into
devarshishimpi:mainfrom
MaxonT:contrib/181-auto

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Hello, this is a patch for the issue below; I tried to keep it narrow.

Description

Thanks for writing the issue with the exact function and call spelled out, it made this one quick to place. This adds getIncrementalDiffFiles to packages/core/src/review/diff-cache.ts. It calls github.getCompareDiff(owner, repo, previousCommitSha, newHeadSha) and then runs the same parseUnifiedDiff and filterReviewableFiles steps as getDiffFiles, including maxFiles and the skip_files config.

Caching follows getDiffFiles too: same TTL, and a failed cache write only logs a warning. The key is diff:<jobId>:<previousSha>..<newHeadSha>, so it cannot return the full PR diff cached under diff:<jobId>, or the diff of a different commit range. The function is exported next to getDiffFiles from @codraoss/core and from the worker's core/review re-exports. Nothing calls it yet, as the wiring is a separate sub-issue.

Fixes #181

Type of change

  • Bug fix
  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit Tests: new test/review/diff-cache.spec.ts, 6 cases with a mocked git provider and an in-memory KV: files come only from the compare diff, filtering and maxFiles match getDiffFiles, caching with the shared TTL and reuse on a second call, no key sharing with the full diff or another SHA range, and a failing cache write still returns the files. 6 passed here, along with test/diff.spec.ts, test/diff-from-files.spec.ts, test/review/pack.spec.ts and test/review/model-profiles.spec.ts (50 tests in total). With the key reverted to diff:<jobId>, 2 of the 6 fail. npm run lint is clean.

Not run

The Postgres-backed integration suite (no database here), and the Playwright suite. npm run typecheck reports 22 errors in files this change does not touch (worker and workflow types such as ExecutionContext), and none in the changed files; I did not compare against a clean base with generated worker types.

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-28T11:21:31.481242Z 0b9499f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codra-app-personal codra-app-personal Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codra Review

✅ Nothing to flag. Reviewed 5 files (282 changed lines) and found no issues worth raising.

Reviewed commit: 0b9499fc8b

ℹ️ About Codra in GitHub

Your team has set up Codra to review pull requests in this repo. Reviews are triggered when you:

  • Open a pull request for review
  • Mark a draft as ready

Every review posts a summary here. A clean pass also gets a 👍 on the pull request itself.

@devarshishimpi
devarshishimpi merged commit 5314fa2 into devarshishimpi:main Nov 29, 2026
6 checks passed
devarshishimpi added a commit that referenced this pull request Nov 29, 2026
- core(review): deduplicate diff cache helper, cache empty diffs via != null, validate commit SHAs, and add PR-context JSDoc note (#181 / PR #203)

- api/node/worker: bypass Hyperdrive SQL caching via SELECT clock_timestamp(), fail fast on disconnected Redis via PING_REDIS, coalesce in-flight probes, suppress late rejections, preserve logger requestId on health probe warnings, and add adapter wiring tests + K8s timeoutSeconds docs (#173 / PR #202)

- models/schema: guard non-finite/negative thinkingBudget, exclude o1-mini/o1-preview from reasoning_effort, simplify Zod schema, and consolidate OpenAI tests with real schema parsing (#177 / PR #201)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Incremental Diff File Fetching to the Diff Cache

2 participants