Commit 1ff427b
committed
fix(host-service): stop rescan() from desyncing interest on a transient gap
rescan()'s cleanup dropped this.interest entries for any workspace missing
from its non-archived scan — but a workspace can be transiently absent
without any client losing interest in it (e.g. archived-then-restored via
the tombstone delete flow). A client that already sent one git:watch has no
reason to send it again, and won't unless it remounts or its socket
reconnects. Once interest was wiped, the retry loop (which only walks
interest.keys()) could never bring the workspace back on its own — the
watcher stayed unattached until an unrelated remount/reconnect, silently.
interest is now touched exclusively by watchWorkspace()/unwatchWorkspace().
rescan() still tears down the live watcher (the real resource) for a gone
workspace via stopWatching(), but leaves interest alone — a stale entry for
a workspace gone for good costs one Map entry, bounded by the per-client
git:watch cap, until the holding client unwatches or its socket closes.
New regression test: hold interest, archive the workspace (rescan tears
down the watcher, interest survives), restore it (rescan re-attaches via
the retry loop, no second watchGit needed). Confirmed failing against the
prior code, passing after.
Found via a second-pass review of #6848.
Claude-Session: https://claude.ai/code/session_01NmLFihnhebmL9bbbojGYCR1 parent 88fe5a3 commit 1ff427b
2 files changed
Lines changed: 58 additions & 5 deletions
File tree
- packages/host-service
- src/events
- test/integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
575 | 592 | | |
576 | 593 | | |
577 | 594 | | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | 595 | | |
584 | 596 | | |
585 | 597 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
245 | 286 | | |
246 | 287 | | |
247 | 288 | | |
| |||
0 commit comments