muse reflog — use long IDs in human text output
Problem
_fmt_entry in muse/cli/commands/reflog.py renders commit IDs using short_id
(12 hex chars) in the human text output:
def _fmt_entry(idx: int, entry: ReflogEntry, short: int = 12) -> str:
new_short = sanitize_display(short_id(entry.new_id))
old_short = (
"initial"
if entry.old_id == NULL_COMMIT_ID
else sanitize_display(short_id(entry.old_id))
)
This produces output like:
@{0} sha256:3f9a1c2d4e7b (sha256:9b2e4a1f8c3d) 2026-06-28 14:22:11 UTC claude-code fix: off-by-one in total
Every other Muse command that surfaces a commit ID in human text uses long_id —
the canonical sha256:<64-hex> form. The reflog is inconsistent and the IDs it
displays cannot be passed directly to other commands without risk of prefix collision.
The docstring even contradicts itself: it claims short IDs are used "for consistency with all other Muse commands" when the opposite is true.
Additionally, the short: int = 12 parameter in _fmt_entry is declared but never
referenced in the function body — dead parameter, should be removed.
The JSON output layer already uses long_id correctly via _ReflogEntryJson. Only
the human text path needs fixing.
Fix
In muse/cli/commands/reflog.py:
- Replace both
short_id(...)calls in_fmt_entrywithlong_id(...). - Remove the unused
short: int = 12parameter. - Update the docstring to reflect that full IDs are rendered.
- Update the format spec comment string at the top of
run()docstring (<new_sha12>→<new_sha256>).
Correct output after the fix:
@{0} sha256:3f9a1c2d4e7b9c2a4f1d8e3b6c9f2d1a7e4b8c1f5a9d2e6b3c7f0a4d1e8b2c5f (sha256:9b2e4a1f8c3d7b4e2c1a5f9d3e7b2c8f1a4e7b3c9f2a6d1e4b8c3f7a0d2e5b98) 2026-06-28 14:22:11 UTC claude-code fix: off-by-one in total
Deliverables
- [ ]
LI_01—_fmt_entryuseslong_idfornew_id; output issha256:<64-hex> - [ ]
LI_02—_fmt_entryuseslong_idforold_id;"initial"sentinel unchanged - [ ]
LI_03— Unusedshort: int = 12parameter removed from_fmt_entrysignature - [ ]
LI_04—_fmt_entrydocstring updated; no stale reference to short IDs or the false "consistency" claim - [ ]
LI_05—run()docstring format spec updated to reflect full IDs - [ ]
LI_06— Test:muse refloghuman text output contains the full 64-hex commit ID of the most recent entry, not a 12-char prefix
Test file: tests/test_cmd_reflog_long_ids.py
Out of scope
- JSON output — already correct (
long_idused in_ReflogEntryJson). - Any other command's ID rendering.