code-index doctor is blind to staleness, watcher health and resolve state, and check_disk_free only fires at literally zero bytes #150

Closed
opened 2026-09-05 12:54:34 +02:00 by buildagent · 0 comments
Member

Found by a production-readiness review.

doctor has twelve checks. None covers:

  • index staleness
  • watcher health
  • watch-set size
  • resolve state

WatchCounters is instrumented and read by no production consumer.

So every failure mode in the production review above — the decaying watch set (#145), the permanently bricked diff tools (#147), the miscounted parse errors (#148), a daemon stuck mid-migration (#144) — is invisible to the one command whose entire job is to tell an operator what is wrong.

The disk check is vacuous

crates/cli/src/doctor.rs:836 writes 16 bytes and reports "writable". It fires only at literally zero bytes free. A 99%-full disk is green — and a nearly-full disk here presents as linker errors and hangs, not as "disk full", so the green is actively misleading during exactly the incident it should catch.

Ask

doctor should surface what the index already knows. The instrumentation mostly exists (WatchCounters, freshness, resolve counts); it is the reporting that was never wired. A threshold on free space (percentage or absolute headroom, not zero) is a one-line change.

This is a good candidate for the generic treatment: rather than twelve hand-written checks plus four more, derive the check set from the disclosure surfaces that already exist, so a new disclosure gets a doctor line for free.

🤖 Generated with Claude Code

https://claude.ai/code/session_01K1zj5VcFJvJt3pQxe9259K

Found by a production-readiness review. `doctor` has twelve checks. **None** covers: - index staleness - watcher health - watch-set size - resolve state `WatchCounters` is instrumented and **read by no production consumer**. So every failure mode in the production review above — the decaying watch set (#145), the permanently bricked diff tools (#147), the miscounted parse errors (#148), a daemon stuck mid-migration (#144) — is invisible to the one command whose entire job is to tell an operator what is wrong. ## The disk check is vacuous `crates/cli/src/doctor.rs:836` writes 16 bytes and reports `"writable"`. It fires **only at literally zero bytes free**. A 99%-full disk is green — and a nearly-full disk here presents as linker errors and hangs, not as "disk full", so the green is actively misleading during exactly the incident it should catch. ## Ask `doctor` should surface what the index already knows. The instrumentation mostly exists (`WatchCounters`, freshness, resolve counts); it is the reporting that was never wired. A threshold on free space (percentage or absolute headroom, not zero) is a one-line change. This is a good candidate for the generic treatment: rather than twelve hand-written checks plus four more, derive the check set from the disclosure surfaces that already exist, so a new disclosure gets a `doctor` line for free. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01K1zj5VcFJvJt3pQxe9259K
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#150
No description provided.