Skip to content

Merge dev to main#1365

Merged
zbigniewsobiecki merged 2 commits into
mainfrom
dev
May 12, 2026
Merged

Merge dev to main#1365
zbigniewsobiecki merged 2 commits into
mainfrom
dev

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Routine dev → main promotion.

Commits

Note: an earlier CI failure today (run 25751650524) was on a fork PR (maksymilian-majer/cascade:dev → ours) — not on the main-repo dev branch. dev itself is clean.

🤖 Generated with Claude Code

aaight and others added 2 commits May 12, 2026 17:16
Co-authored-by: Cascade Bot <bot@cascade.dev>
* fix(review): source compact PR diffs from local git

* fix(ci): update protobufjs override for audit

* fix(review): refresh base ref and use literal pathspec in local PR diffs

Two correctness fixes for the local-git compact diff source:

1. Fetch origin/<baseBranch> before diffing so stale snapshot refs don't
   include base-branch-only commits in the patch. Snapshot reuse only
   fetches refs/pull/N/head; origin/<base> can lag behind the real remote,
   causing git diff origin/<base>...HEAD to emit A→C patches instead of
   the correct B→C PR-only patch. Fetch failure is logged at WARN and
   does not abort per-file diff attempts.

2. Use :(literal)<filename> as the git diff pathspec so filenames
   containing bracket/glob metacharacters (e.g. src/[id].ts) are not
   expanded to match unrelated files (e.g. src/i.ts). Previously a bare
   filename was passed as a pathspec, which git treats as a glob pattern.

Adds regression tests for both scenarios (stale origin ref and
bracket-glob filename expansion).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(review): fail closed on base-ref fetch failure in local diff source

When git fetch origin <base> fails in sourceLocalPRDiffs, the helper now
returns immediately with all non-deleted files marked as local-diff-failed
instead of proceeding to diff against a potentially stale origin/<base> ref.
With a stale ref, git diff could succeed against an outdated snapshot and
include base-branch-only commits — violating the locally-verified-or-skipped
contract.

Extract the fail-closed path into buildFetchFailedFiles to keep the main
function below the complexity threshold.

Also update four prContext-consuming prompt templates (review.eta,
respond-to-ci.eta, respond-to-pr-comment.eta, resolve-conflicts.eta) to
reference GetPRDiffContext instead of GetPRDiff, matching what
fetchPRContextStep actually injects.

Update prDiffSource.test.ts to give test repos a real bare remote so
git fetch origin <base> succeeds; update the failure test to assert on
the new fetch-failure WARN message instead of the per-file diff WARN.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(review): supply both old and new literal paths for renamed-file diffs

For renamed files, `git diff --find-renames ... -- ':(literal)new.ts'`
emits 'new file mode' with every line added instead of the proper
'rename from old.ts' / 'rename to new.ts' metadata. This produces a
misleading local-git patch and can wrongly skip a large pure rename as
oversized. When `file.previousFilename` is set, prepend
`:(literal)<oldPath>` to the pathspec so git can detect and render the
rename correctly.

Adds a regression test that git-mv renames old.ts to new.ts, then
asserts the returned patch contains 'rename from' / 'rename to' metadata
and no 'new file mode'.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(gadgets): mark GetPRDiff path parameter as optional: true

The path parameter was declared with required: false, but createGadgetClass
only makes a Zod field optional when optional: true is set. This caused the
generated schema to reject no-path GetPRDiff calls with a validation error,
breaking existing full-PR diff usage. Added gadget-level schema coverage
to pin the no-path and with-path validation behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(review): detect binary diff metadata and exclude from local-git patch source

Binary files produce non-empty git output ("Binary files /dev/null and b/blob.bin differ")
with zero @@ hunks. The helper was classifying any non-empty stdout as 'local-git',
allowing binary files with no GitHub patch to bypass the SKIPPED FILES contract and
appear in GetPRDiffContext with misleading binary metadata.

Detect the 'Binary files' marker explicitly; when present, set patch=undefined and
fall back to no-patch (or local-diff-empty if GitHub had a patch). Pure renames have
no @@ hunks but carry 'rename from'/'rename to' metadata — they intentionally pass
this guard and remain local-git. Adds a regression test with a real null-byte binary
file to pin the detection behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(review): use PR base ref for local diff context, not project base branch

Use prDetails.baseRef instead of params.project?.baseBranch when calling
sourceLocalPRDiffs, so stacked PRs targeting a feature branch produce a
compact review diff against the actual PR target (not the project default
base), avoiding inclusion of parent-branch commits in GetPRDiffContext.

Also widen the review.eta inline-comment rule to permit inline comments
on files verified via the on-demand skipped-file fetch path
(cascade-tools scm get-pr-diff --path), not just files from
GetPRDiffContext output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Cascade Bot <bot@cascade.dev>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit d8260af into main May 12, 2026
9 of 10 checks passed
@codecov
Copy link
Copy Markdown

codecov Bot commented May 12, 2026

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.

2 participants