gabriel / muse public
reflog-long-ids.md markdown
69 lines 2.6 KB
Raw
sha256:c0eba5ad689cec79f4a3fcdc4f5da78556cb4b8cb7b330f944634356c10379ed chore: pivot to nightly channel — bump version to 0.2.0.dev… Sonnet 5 patch 12 days ago

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:

  1. Replace both short_id(...) calls in _fmt_entry with long_id(...).
  2. Remove the unused short: int = 12 parameter.
  3. Update the docstring to reflect that full IDs are rendered.
  4. 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_entry uses long_id for new_id; output is sha256:<64-hex>
  • [ ] LI_02_fmt_entry uses long_id for old_id; "initial" sentinel unchanged
  • [ ] LI_03 — Unused short: int = 12 parameter removed from _fmt_entry signature
  • [ ] LI_04_fmt_entry docstring updated; no stale reference to short IDs or the false "consistency" claim
  • [ ] LI_05run() docstring format spec updated to reflect full IDs
  • [ ] LI_06 — Test: muse reflog human 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_id used in _ReflogEntryJson).
  • Any other command's ID rendering.
File History 3 commits
sha256:c287f599c5429903a139eadf3c5db5d930520e57cb0c3c575d9570e953c3b2d6 chore: bump version to 0.2.0.dev2 — nightly.2 Sonnet 4.6 patch 12 days ago
sha256:8de4334a98c945aace420969d389ad678aa926d4ab4e886b2ac4c4241cb3bf2b revert: keep pyproject.toml in canonical PEP 440 form Sonnet 4.6 patch 15 days ago
sha256:50bb615c573aa4b928fca75b60f82ba2a659910066507cec6a95c412ae22ccb9 docs: add issue docs for push have-negotiation bug (#55) an… Sonnet 4.6 18 days ago