Skip to content

index --rebuild reports unqualified success on a mirror it could not read, and cli.md says it always can #400

Description

@MongLong0214

Found by auditing docs/ for claims the product's own behaviour contradicts — the gap I left as Unverified: on #398, which audited only the READMEs.

Reproduced

A clone whose refs/notes/commitlore was never fetched. The origin holds one record in a commit message and one in a note.

$ commitlore index --rebuild
rebuilt: scanned 1 commit, indexed 3 trailers in 90ms
$ echo $?
0

No mention that the notes mirror is unfetched. The note's record is simply absent from the index it just built.

The query path, in the same repository, is honest about it:

$ commitlore context f
commitlore: the notes mirror has not been fetched here, so this answer may be
missing records that exist upstream (git fetch does not fetch
refs/notes/commitlore by default). fix: commitlore doctor --fix, then git fetch
context for f … — 1 limits, … in 1 record
  r-cmt001  ecb1ff78  [claim]  from the commit

So context knows the answer is incomplete and says so. index --rebuild builds that same incomplete answer and reports it as a clean rebuild.

Why this shape matters here

This is the defect fixed in r-fetchowed earlier in this release, one command over: doctor --fix wrote the refspec, fetched nothing, and printed ok"the configuration is right and the records are still missing." The same sentence applies to rebuild.

rebuild is also the command a user runs because they suspect the index is wrong. Answering with an unqualified success is the least useful moment to omit that one of the two record sources was unreadable.

Nothing is lost — the index is a cache and the notes genuinely are not local. The defect is the report, not the data.

The documentation half

docs/cli.md:92-93:

The authority is the commit trailers and refs/notes/commitlore, so commitlore index --rebuild can always reconstruct it

True of what Git holds locally. Read by someone deciding whether they can safely delete the index, it says something stronger than the previous sentence supports, and it is the one place a reader is told the index is disposable.

Expected

index --rebuild should say the same thing context says when the mirror is unfetched — the state is already computed by notesAvailability, so this is a report, not a new check. Exit code need not change: an unfetched mirror is not a rebuild failure.

docs/cli.md should carry the same caveat, or drop "always".

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