Skip to content

feat(#5907): surface reindex-after-upgrade in dashboard + doctor + update#5911

Merged
cajasmota merged 3 commits into
mainfrom
worktree-agent-ab32d18e2e0e48aab
Jul 22, 2026
Merged

feat(#5907): surface reindex-after-upgrade in dashboard + doctor + update#5911
cajasmota merged 3 commits into
mainfrom
worktree-agent-ab32d18e2e0e48aab

Conversation

@cajasmota

Copy link
Copy Markdown
Owner

Surfacing slice of #5907 — makes the stale-format auto-reindex (engine core merged in #5910) VISIBLE instead of a silent multi-minute stall. Report/display only; no engine/trigger logic touched.

FIX3 — web dashboard: indexStatusRepo now carries ReindexRequired/ReindexReason (previously dropped) + a derived Status (idle/indexing/enhancing/reindex-required/reindexing-after-upgrade). webui-v2 threads it through and shows a warning-tone badge per-repo + on the monorepo group header, mirroring the existing "enhancing" badge.
FIX4 — doctor: new report-only Check 9 (checkReindexRequired) scanning registered repos via graph.ReindexRequiredReason.
FIX4 — update: UpdateResult.ReposNeedingReindex populated post-restart; CLI prints "N repo(s) reindexing after upgrade" (FIX2 already enqueues — this is report-only, no duplicate trigger).

Skipped the optional FormatUpgradeReason — the derived Status already distinguishes reindex-required vs reindexing-after-upgrade without touching load.go.

Verified: display/report-only (no engine/trigger files touched), deriveIndexStatus precedence correct, gofmt/build/vet clean, dashboard+install+cli tests green.

🤖 Generated with Claude Code

https://claude.ai/code/session_017quGgaqK7NRoxGT6BTqV2o

jcajasmc added 3 commits July 22, 2026 15:46
…index-status API + feed (#5907 FIX3)

The web dashboard's GET /api/v2/groups/{group}/index-status endpoint dropped
statusfile.File's ReindexRequired/ReindexReason when building indexStatusRepo,
so a repo whose graph.fb was stamped by an older grafel build read as an idle
row — a silent multi-minute stall from the frontend's point of view, even
though the engine's FIX2 loop-guarded auto-reindex had already enqueued a
fix.

- indexStatusRepo now carries ReindexRequired/ReindexReason verbatim, plus a
  derived `status` field (idle/indexing/enhancing/reindex-required/
  reindexing-after-upgrade) so the frontend doesn't have to re-derive the
  same precedence from four booleans.
- webui-v2: threaded reindexRequired/reindexReason through ProgressRow /
  ProgressGroup / the status-plane join, and added a warning-tone
  "reindex required" / "reindexing after upgrade" badge to
  IndexProgressFeed's per-repo and monorepo-group rows, mirroring the
  existing "enhancing" badge.

Report-only surfacing slice of #5907 — no engine/trigger logic changes.
…rade (#5907 FIX4)

Adds Check 9 to `grafel doctor`: scans every registered repo (across every
group) via graph.ReindexRequiredReason(daemon.StateDirForRepo(repo.Path)) and
reports (Info severity) when one or more repos' on-disk graph.fb was written
by an older grafel build than this binary supports.

Report-only by design: the engine's FIX2 auto-reindex arm
(internal/daemon/stale_reindex.go's loop-guarded maybeEnqueue) already owns
enqueueing the fix, so doctor must not duplicate that decision — it only
makes the otherwise-silent post-upgrade reindex visible in doctor output.

Tests (internal/install/reindex_required_test.go) reuse the
writeOldFormatGraphFB fixture technique from
internal/graph/reindex_required_test.go to fabricate a stale-format graph.fb
without an actual old binary, and cover: stale repo reported with summary +
per-repo drift line, current-format repo not reported, no registered groups
not reported.
#5907 FIX4)

RunUpdate now reports, after the daemon restart + version probe (RunCopy),
how many registered repos need a reindex after this format upgrade
(UpdateResult.ReposNeedingReindex), via the same
graph.ReindexRequiredReason(daemon.StateDirForRepo(path)) check doctor uses.
`grafel update`'s CLI summary prints "N repo(s) reindexing after upgrade"
when non-zero.

Report-only: RunUpdate never enqueues a reindex itself — the engine's own
loop-guarded auto-reindex arm (internal/daemon/stale_reindex.go) already owns
that once the restarted daemon's next heartbeat observes the mismatch. This
just prevents the reindex from looking like a silent stall right after
`grafel update` returns.

Tests (internal/install/update_reindex_test.go) register a fake group/repo
against the same GRAFEL_HOME/XDG_CONFIG_HOME the existing update tests use,
fabricate a stale-format graph.fb (writeOldFormatGraphFB technique from
internal/graph/reindex_required_test.go), and cover both the stale-count and
current-format-no-count cases.
@cajasmota
cajasmota merged commit e9e04ae into main Jul 22, 2026
0 of 2 checks passed
@cajasmota
cajasmota deleted the worktree-agent-ab32d18e2e0e48aab branch July 22, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants