Skip to content

Record last-index run metrics in StatusResult #1817

Description

@Widthdom

Summary

StatusResult (QueryResults.cs:241-344) reports schema readiness flags, language summaries, file counts, and the degraded reasons documented in CLAUDE.md's Status Contract, but nothing about how the last index run actually went: how long it took, how many files were scanned vs. skipped, how many parse errors fired, how many bytes were ingested, how many rows were upserted. A user investigating "incremental rebuilds feel slow" or "why is my DB this size?" has no in-band data to look at — they must dig through GlobalToolLog (cross-link with the just-filed #1797 perms / batch-20 log-as-text issues).

Where

  • src/CodeIndex/Models/QueryResults.cs:241-344 (StatusResult shape)

Suggested approach

(1) Persist per-index-run metadata to a small index_runs table (or a single meta row) at the end of every index run: last_run_started_at, last_run_duration_ms, files_scanned, files_skipped, parse_errors, bytes_read, rows_upserted, rows_deleted. (2) Expose the row on StatusResult under last_index_run: { ... }. (3) Distinguish full vs. incremental run mode in the same record. (4) Update the Status Contract docs in README.md, DEVELOPER_GUIDE.md, CLAUDE.md to mention the new fields (the contract synchronization rule applies). (5) Add a regression test that runs index then asserts the metadata is populated with sensible values. (6) Cross-link with #1680 (GC/heap/working-set metrics) — same direction, different layer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions