Skip to content

Commit ecac0c1

Browse files
SimplyLizclaude
andauthored
feat: NoAutoFetch parity for summarizePr/summarizeDiff + gitignore cleanup (#211)
* feat(query): NoAutoFetch parity for summarizePr and summarizeDiff The 9.1.0 --no-auto-fetch opt-out was only wired through ReviewPROptions. summarizePr (pr.go) and summarizeDiff (navigation.go) still auto-fetched unconditionally, giving air-gapped callers inconsistent behavior across the three review-adjacent MCP tools. Add NoAutoFetch to both options structs; route through VerifyRef (local-only) instead of EnsureRef when set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: gitignore ckb_fresh and *.test binaries in repo root ckb_fresh is a dev-build binary that kept showing up as untracked; *.test catches Go test binaries like scip.test. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 645d3ac commit ecac0c1

4 files changed

Lines changed: 28 additions & 9 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ bin/
88
/ckb
99
/ckb-test
1010
/ckb-bench
11+
/ckb_fresh
1112
coverage.out
1213
*_test
14+
*.test
1315
*.scip
1416

1517
# Registry / credential tokens

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ All notable changes to CKB will be documented in this file.
1717

1818
### Added
1919

20+
- `NoAutoFetch` option on `SummarizePROptions` and `SummarizeDiffOptions`
21+
for parity with `ReviewPROptions`. Previously the air-gapped opt-out
22+
applied only to `ckb review`; MCP/HTTP callers of `summarizePr` and
23+
`summarizeDiff` had no way to disable auto-fetch.
2024
- Troubleshooting section in `docs/plans/review-cicd.md` covering shallow
2125
CI clones, auth-failure remediation (`persistCredentials`), air-gapped
2226
pipelines, and depth-0 checkout alternatives.

internal/query/navigation.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,7 @@ type SummarizeDiffOptions struct {
18791879
CommitRange *CommitRangeSelector `json:"commitRange,omitempty"`
18801880
Commit string `json:"commit,omitempty"`
18811881
TimeWindow *TimeWindowSelector `json:"timeWindow,omitempty"`
1882+
NoAutoFetch bool `json:"noAutoFetch,omitempty"` // Disable auto-fetch of missing refs (see ReviewPROptions)
18821883
}
18831884

18841885
// CommitRangeSelector specifies a base..head range.
@@ -2026,11 +2027,13 @@ func (e *Engine) SummarizeDiff(ctx context.Context, opts SummarizeDiffOptions) (
20262027
selector = DiffSelector{Type: "commitRange", Value: opts.CommitRange.Base + ".." + opts.CommitRange.Head}
20272028
base = opts.CommitRange.Base
20282029
head = opts.CommitRange.Head
2029-
if resolved, rerr := e.gitAdapter.EnsureRef(base); rerr == nil {
2030-
base = resolved
2031-
}
2032-
if resolved, rerr := e.gitAdapter.EnsureRef(head); rerr == nil {
2033-
head = resolved
2030+
if !opts.NoAutoFetch {
2031+
if resolved, rerr := e.gitAdapter.EnsureRef(base); rerr == nil {
2032+
base = resolved
2033+
}
2034+
if resolved, rerr := e.gitAdapter.EnsureRef(head); rerr == nil {
2035+
head = resolved
2036+
}
20342037
}
20352038
diffStats, err = e.gitAdapter.GetCommitRangeDiff(base, head)
20362039
if err != nil {

internal/query/pr.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type SummarizePROptions struct {
1616
BaseBranch string `json:"baseBranch"` // Base branch to compare against (default: "main")
1717
HeadBranch string `json:"headBranch"` // Head branch (default: current branch)
1818
IncludeOwnership bool `json:"includeOwnership"` // Include ownership analysis (default: true)
19+
NoAutoFetch bool `json:"noAutoFetch"` // Disable auto-fetch of missing base ref (see ReviewPROptions)
1920
}
2021

2122
// SummarizePRResponse is the response for summarize-pr.
@@ -102,11 +103,20 @@ func (e *Engine) SummarizePR(ctx context.Context, opts SummarizePROptions) (*Sum
102103
if headRef == "" {
103104
headRef = "HEAD"
104105
}
105-
baseRef, err := e.gitAdapter.EnsureRef(opts.BaseBranch)
106-
if err != nil {
107-
return nil, fmt.Errorf("failed to resolve base ref %q: %w", opts.BaseBranch, err)
106+
var baseRef string
107+
if opts.NoAutoFetch {
108+
if verr := e.gitAdapter.VerifyRef(opts.BaseBranch); verr != nil {
109+
return nil, fmt.Errorf("failed to resolve base ref %q: %w", opts.BaseBranch, verr)
110+
}
111+
baseRef = opts.BaseBranch
112+
} else {
113+
resolved, rerr := e.gitAdapter.EnsureRef(opts.BaseBranch)
114+
if rerr != nil {
115+
return nil, fmt.Errorf("failed to resolve base ref %q: %w", opts.BaseBranch, rerr)
116+
}
117+
baseRef = resolved
118+
opts.BaseBranch = resolved
108119
}
109-
opts.BaseBranch = baseRef
110120
diffStats, err := e.gitAdapter.GetCommitRangeDiff(baseRef, headRef)
111121
if err != nil {
112122
return nil, fmt.Errorf("failed to get diff: %w", err)

0 commit comments

Comments
 (0)