Skip to content

init reports ready on an unfetched mirror without saying so — the first screen a user meets #402

Description

@MongLong0214

Split out of #401, which fixed the same defect in index and deliberately left this one because it changes an output contract rather than adding a report.

Reproduced

A fresh clone whose refs/notes/commitlore was never fetched, holding a record that lives only in a note upstream:

$ commitlore init
  ✓ Hooks
  ✓ Index
  ✓ Agent integration
  ✓ Final check

init: ready

✓ Index and ready. Nothing about the mirror. The index it just built covers the commit messages alone.

Every query path in the product is honest about this state — context exits 3 and says the answer may be missing records, stale reports the scan is incomplete, guard exits 3, validate says references not checked, and after #401 so does index. init is now the one command that reports success over it in silence.

Why this one is worse than index was

init is the first thing a user runs, and for most users it is the only thing they run before forming a view of whether the tool works. A clone with unfetched notes is not an edge case — git fetch does not fetch refs/notes/commitlore by default, which is the entire reason doctor --fix and the refspec exist. So the default path for a new user on an existing repository is: run init, see ready, and hold an index that is missing every record the team kept in notes.

The sentence already exists. init's doctor --fix step produces it — under --verbose only.

Why it was not fixed in #401

test/init-output.test.ts pins plain init at no more than six lines, deliberately: [T-1012] made the clean run result-oriented rather than a list of internal steps. Adding a line means deciding that this state is worth one of those six, which is a decision about the command's contract, not a missing report.

That decision looks easy from here — a ready that is not ready costs more than a sixth line — but it belongs in its own change with its own test, not smuggled into a fix for a different command.

Expected

init says the mirror is unfetched when it is, in its default output, without becoming a step list again. Exit code should stay 0: an unfetched mirror is not an init failure, and #401 settled that for index.

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