Commit 9235a23
committed
fix(mcp): close the two seed-scoping recall gaps from review
Three items from the #1372 review.
The Windows shard failed in the fixture, not the fix: `system("cd '<dir>' &&
git init …")` used POSIX single quotes, which cmd.exe cannot parse. Switched
to the portable `git -C "<dir>"` shape already used by wt_git in
tests/test_watcher.c, with identity, default branch and signing passed via -c
so the fixture no longer depends on the machine's global git config.
A changed file with hunks but no overlapping definition now keeps whole-file
seeding instead of dropping out. Import-only edits, module-level constants and
anything above the first definition land outside every definition's line range,
so scoping alone would have removed the file from the seed set entirely —
strictly worse recall than the behavior being replaced.
The overlap probe has to apply the same label filter as the seeding loop: a
Module node spans lines 1..EOF, so probing raw nodes reports an overlap for
every hunk and defeats the fallback. Extracting detect_is_seedable_label lets
both sites share one definition. The new regression test caught exactly this —
it failed with seed_symbols 0 until the probe was filtered.
A filled hunk buffer is now treated as a truncated diff: hunks past HUNK_CAP
are gone, so files captured only partially would still look scoped and silently
under-seed. Scoping is dropped for the whole request and the decision logged,
rather than under-reporting a large refactor.
Documented the mixed coordinate systems in the fetch block: base...HEAD hunks
are HEAD-side lines, worktree hunks are worktree-side, node lines come from the
indexed snapshot. They agree while the index is fresh; a stale index plus
earlier-in-file insertions can mis-scope, bounded by the zero-overlap fallback.
Signed-off-by: lishixiang <lishixiang@gmail.com>1 parent 2d94282 commit 9235a23
2 files changed
Lines changed: 143 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9762 | 9762 | | |
9763 | 9763 | | |
9764 | 9764 | | |
| 9765 | + | |
| 9766 | + | |
| 9767 | + | |
| 9768 | + | |
| 9769 | + | |
| 9770 | + | |
| 9771 | + | |
| 9772 | + | |
9765 | 9773 | | |
9766 | 9774 | | |
9767 | 9775 | | |
9768 | 9776 | | |
9769 | 9777 | | |
9770 | 9778 | | |
9771 | | - | |
| 9779 | + | |
9772 | 9780 | | |
9773 | 9781 | | |
9774 | | - | |
| 9782 | + | |
9775 | 9783 | | |
9776 | 9784 | | |
9777 | 9785 | | |
| 9786 | + | |
| 9787 | + | |
| 9788 | + | |
| 9789 | + | |
| 9790 | + | |
| 9791 | + | |
| 9792 | + | |
| 9793 | + | |
| 9794 | + | |
| 9795 | + | |
| 9796 | + | |
| 9797 | + | |
| 9798 | + | |
| 9799 | + | |
| 9800 | + | |
| 9801 | + | |
| 9802 | + | |
| 9803 | + | |
| 9804 | + | |
9778 | 9805 | | |
9779 | | - | |
9780 | | - | |
9781 | | - | |
9782 | | - | |
9783 | | - | |
9784 | | - | |
| 9806 | + | |
| 9807 | + | |
9785 | 9808 | | |
9786 | 9809 | | |
9787 | 9810 | | |
| |||
10075 | 10098 | | |
10076 | 10099 | | |
10077 | 10100 | | |
10078 | | - | |
| 10101 | + | |
| 10102 | + | |
| 10103 | + | |
| 10104 | + | |
| 10105 | + | |
| 10106 | + | |
| 10107 | + | |
| 10108 | + | |
| 10109 | + | |
| 10110 | + | |
10079 | 10111 | | |
10080 | 10112 | | |
10081 | 10113 | | |
| |||
10109 | 10141 | | |
10110 | 10142 | | |
10111 | 10143 | | |
| 10144 | + | |
| 10145 | + | |
| 10146 | + | |
| 10147 | + | |
| 10148 | + | |
| 10149 | + | |
| 10150 | + | |
| 10151 | + | |
| 10152 | + | |
| 10153 | + | |
| 10154 | + | |
| 10155 | + | |
10112 | 10156 | | |
10113 | 10157 | | |
10114 | 10158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6192 | 6192 | | |
6193 | 6193 | | |
6194 | 6194 | | |
| 6195 | + | |
| 6196 | + | |
| 6197 | + | |
| 6198 | + | |
| 6199 | + | |
| 6200 | + | |
6195 | 6201 | | |
6196 | | - | |
6197 | | - | |
6198 | | - | |
6199 | | - | |
6200 | | - | |
6201 | | - | |
6202 | | - | |
| 6202 | + | |
| 6203 | + | |
| 6204 | + | |
| 6205 | + | |
| 6206 | + | |
| 6207 | + | |
| 6208 | + | |
6203 | 6209 | | |
| 6210 | + | |
6204 | 6211 | | |
6205 | 6212 | | |
6206 | 6213 | | |
| |||
6239 | 6246 | | |
6240 | 6247 | | |
6241 | 6248 | | |
| 6249 | + | |
| 6250 | + | |
| 6251 | + | |
| 6252 | + | |
| 6253 | + | |
| 6254 | + | |
| 6255 | + | |
| 6256 | + | |
| 6257 | + | |
| 6258 | + | |
| 6259 | + | |
| 6260 | + | |
| 6261 | + | |
| 6262 | + | |
| 6263 | + | |
| 6264 | + | |
| 6265 | + | |
| 6266 | + | |
| 6267 | + | |
| 6268 | + | |
| 6269 | + | |
| 6270 | + | |
| 6271 | + | |
| 6272 | + | |
| 6273 | + | |
| 6274 | + | |
| 6275 | + | |
| 6276 | + | |
| 6277 | + | |
| 6278 | + | |
| 6279 | + | |
| 6280 | + | |
| 6281 | + | |
| 6282 | + | |
| 6283 | + | |
| 6284 | + | |
| 6285 | + | |
| 6286 | + | |
| 6287 | + | |
| 6288 | + | |
| 6289 | + | |
| 6290 | + | |
| 6291 | + | |
| 6292 | + | |
| 6293 | + | |
| 6294 | + | |
| 6295 | + | |
| 6296 | + | |
| 6297 | + | |
| 6298 | + | |
| 6299 | + | |
| 6300 | + | |
| 6301 | + | |
| 6302 | + | |
| 6303 | + | |
| 6304 | + | |
| 6305 | + | |
| 6306 | + | |
| 6307 | + | |
| 6308 | + | |
| 6309 | + | |
| 6310 | + | |
| 6311 | + | |
| 6312 | + | |
| 6313 | + | |
| 6314 | + | |
| 6315 | + | |
| 6316 | + | |
| 6317 | + | |
| 6318 | + | |
| 6319 | + | |
| 6320 | + | |
| 6321 | + | |
| 6322 | + | |
| 6323 | + | |
6242 | 6324 | | |
6243 | 6325 | | |
6244 | 6326 | | |
| |||
9959 | 10041 | | |
9960 | 10042 | | |
9961 | 10043 | | |
| 10044 | + | |
9962 | 10045 | | |
9963 | 10046 | | |
9964 | 10047 | | |
| |||
0 commit comments