Skip to content

context warns the notes mirror is unfetched in a repo where no notes ref exists anywhere, and doctor --fix reports ok while the ref stays absent #512

Description

@MongLong0214

What happened

In a repository where no notes ref exists anywhere — not locally and not on any remote — every
commitlore context call is prefixed with a warning that its answer may be incomplete, and points at
a fix that cannot change anything:

$ commitlore context Sources/LogicProMCP/State/StatePoller.swift
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
no active records for … — but the notes mirror has not been fetched here, so this is not the same as
"none exist" (commitlore doctor --fix)

But there is nothing upstream to fetch:

$ git ls-remote origin 'refs/notes/*'
(empty)
$ git rev-parse --verify refs/notes/commitlore
(fails — ref absent)

And doctor --fix reports both related checks as ok while the ref stays absent:

ok  notes fetch refspec — git fetch succeeds for fork, origin, … and covers refs/notes/commitlore
ok  notes push — no local mirror yet — nothing to push

Why it matters

The warning is the one thing that tells a caller whether "no records" means "none exist" or "you
haven't looked". When it fires in a repo that provably has no notes anywhere, it trains the reader to
ignore it — and it is the same sentence that would appear in the case where records really are
missing.

Also observed

The warning cleared only after running commitlore doctor --fix twice. After the first run the
ref was still absent and context still warned; after the second, context stopped warning while the
ref was still absent. So whatever state the warning keys on is set by the second invocation rather
than by the condition it describes.

Suggestion

Distinguish "no mirror has been fetched" from "no mirror exists to fetch". When git ls-remote shows
the remote carries no refs/notes/*, the honest answer is that there is nothing upstream, and the
records shown are complete — not that the answer may be missing something.

Environment

  • commitlore 0.7.1
  • git 2.50.1 (Apple Git-155)
  • macOS, repository with 942 commits, 14 of them carrying CommitLore-Version: trailers

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