Skip to content

query reports a v4 index against a v3 reader and falls back forever without rebuilding #634

Description

@MongLong0214

Every commitlore_query call in this repository returns:

"diagnostics": [
  "the index is unavailable (index was built by schema v4, this build expects v3);
   answering with a full scan"
]

The answer is still correct — it fell back to scanning history — but the index that exists on disk is newer than the build that reads it, and the build never reconciles them.

Reproduction

  • macOS, commitlore --version0.8.2
  • Index present at .git/commitlore/index.db, 946176 bytes, written while 0.8.2 was the installed version
  • Call commitlore_query with {"kind": "context", "path": "<any tracked path>"}
  • The diagnostic appears on every call

Why the direction matters

A v3 reader meeting a v4 index means the writer is ahead of the reader in the same installation. Either two components of one release disagree about the schema version, or an index written by a newer build survived a downgrade with nothing to invalidate it. Both leave a stale artifact that is never rebuilt: the fallback works, so nothing ever forces the index to be regenerated, and it silently stays unusable.

Cost

The fallback is a full history scan. On this repository that is currently cheap, but the point of the index is that it does not stay cheap. A degradation that always succeeds is one nobody notices until the scan is the bottleneck.

What would resolve it

Either a version check that rebuilds the index when the schema does not match instead of only reporting it, or a stated compatibility rule that makes the mismatch impossible within one release. Reporting-and-falling-back leaves the artifact permanently stale.

What I could not determine

Which component wrote the v4 index — whether an earlier 0.8.x on this machine wrote v4 and 0.8.2 reads v3, or whether the CLI and the MCP server within 0.8.2 disagree. I did not attempt a rebuild, so whether deleting .git/commitlore/index.db regenerates a v3 index is unverified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions