Fix/detect changes hunk mapping#141
Conversation
|
@PurpleNewNew is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
|
@claude ultra-think during reviewing this PR and try to find performance issues and verify them. |
|
Claude finished @magyargergo's task in 3m 31s —— View job Performance Review:
|
| Scenario | Old code | New code |
|---|---|---|
| DB queries per invocation | N + M |
Up to 3N + M (where N = changed files, M = changed symbols) |
| Git output size | ~50 bytes/file | Full patch (~5–50KB/file) |
| Memory for diff | Negligible | O(total diff lines) in single array |
| Event loop block | O(git diff --name-only time) |
O(git diff full patch time) — larger |
For a typical small diff (5 files, 10 symbols) the new code remains fast in absolute terms. The regressions surface on large diffs (50+ files, compare scope against a distant base), where the N+1 DB queries are the dominant cost and the missing maxBuffer becomes a hard failure.
|
|
Please submit a new PR if this is still relevant |
Summary
This PR upgrades MCP
detect_changesfrom file-level detection to hunk-level symbol mapping, and fixes line-side alignment issues that previously caused missed matches.What changed
git diff --name-onlyto full patch parsing (--unified=0 --no-color --find-renames --relative).@@ -a,b +c,d @@)diff --gitpaths (including octal escapes)Modified,Added,Deleted,Renamed.UNINDEXED:<file>nodes when no indexed symbol matches, so file changes are not silently dropped.summary.changed_hunkschanged_file_hunkschanged_ranges,changed_new_ranges,hunk_countfilePathin affected process steps.Critical fix included
oldRanges) and keepsnewRangesfor diagnostics.Scope
gitnexus/src/mcp/local/local-backend.ts2094935map detect_changes diff hunks to symbolsdb91b94parse quoted diff header paths in detect_changese0e9dfdalign detect_changes symbol mapping to old-side hunksValidation
npm run buildpassed.Dear Reviewer
This PR is a substantial behavior change and may include changes you do not want. (︶^︶)
Please review carefully before merging, especially output-schema expectations and old/new range semantics for downstream consumers.