Commit ac01b6d
Fix incremental update: stale callee shards + false HEAD-change on startup (#99)
* Fix two incremental-update correctness bugs
1. watcher.go: trim SHA at startup to avoid false HEAD-change on first poll
w.lastCommitSHA was set from raw git output (includes trailing newline).
On the first poll, currentSHA (trimmed) != lastCommitSHA (untrimmed),
so headChanged was always true. The downstream git-diff call would fail
silently (invalid ref), but the spurious headChanged = true was wasteful
and misleading.
2. daemon.go: track old callees so removed calls re-render callee shards
computeAffectedFiles walked current callers but never tracked pre-merge
callees. When funcA (in file A) stopped calling funcB (in file B), file B
was not marked affected, so its shard kept a stale "funcB ← funcA" entry
until the next full rebuild.
Fix: snapshot d.cache.Callees for functions in changed files before the
merge (parallel to the existing oldImports snapshot), pass them as
oldCalleeFiles to computeAffectedFiles, and mark those files affected.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Fix lint: combine map params in computeAffectedFiles signature
gocritic paramTypeCombine: two consecutive map[string][]string parameters
can be declared together as "oldImports, oldCalleeFiles map[string][]string".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent cbb5680 commit ac01b6d
3 files changed
Lines changed: 109 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
261 | | - | |
| 260 | + | |
| 261 | + | |
262 | 262 | | |
| 263 | + | |
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
266 | 271 | | |
267 | 272 | | |
268 | 273 | | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
272 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
273 | 288 | | |
274 | 289 | | |
275 | 290 | | |
| |||
280 | 295 | | |
281 | 296 | | |
282 | 297 | | |
283 | | - | |
| 298 | + | |
284 | 299 | | |
285 | 300 | | |
286 | 301 | | |
| |||
592 | 607 | | |
593 | 608 | | |
594 | 609 | | |
595 | | - | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
596 | 614 | | |
597 | 615 | | |
598 | 616 | | |
| |||
625 | 643 | | |
626 | 644 | | |
627 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
628 | 652 | | |
629 | 653 | | |
630 | 654 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
0 commit comments