fix(session-search): only an unread backlog keeps the phase at indexing

An armed cadence sweep on a drained index is not a backlog, so it no
longer flashes the pane to indexing with nothing due.
This commit is contained in:
Jinwoo-H
2026-09-14 20:18:16 -04:00
parent 3226aec322
commit b47f0d3a44
@@ -243,8 +243,8 @@ export class SessionSearchIndexer {
/**
* `current` is a claim, so it takes all of it: nothing owed a read by a row,
* nothing owed a read that has no row yet, no sweep owed, no row whose last
* read failed, and a whole sweep that finished. `idle` is the other end of it
* nothing owed a read that has no row yet, no row whose last read failed,
* and a whole sweep that finished. `idle` is the other end of it
* — an indexer nobody started has not promised to index anything, and calling
* that `current` would claim an index nobody built is up to date.
*/
@@ -260,9 +260,8 @@ export class SessionSearchIndexer {
if (this.degradedRoots.length > 0 || counts.failed > 0) {
return 'degraded'
}
// Work the rows cannot show: a candidate the deadline cut off has no row,
// and an owed sweep has not looked at the machine yet.
if (this.left > 0 || this.sweepNext) {
// Work the rows cannot show: a candidate the deadline cut off has no row.
if (this.left > 0) {
return 'indexing'
}
return counts.due === 0 && this.lastSweepCompletedAt !== null ? 'current' : 'indexing'