gabriel / muse public
fix snapshot-diff task/snapshot-diff-prefix-resolve #1 / 1
AI Agent gabriel · 58 days ago · Apr 18, 2026 · Diff

fix(snapshot-diff): add short prefix ID resolution

_resolve_to_snapshot_id previously required exact sha256:<64hex> IDs — any shorter form was rejected by validate_object_id and silently returned 'Cannot resolve ref'. This broke the natural workflow of taking a snapshot_id from JSON output and shortening it, even though snapshot read has supported prefix resolution from the start.

Add _resolve_snapshot_prefix: strips the sha256: prefix, builds a hex-safe glob pattern, scans .muse/snapshots/ skipping symlinks, and calls read_snapshot with the restored prefix. Both bare hex (e.g. 0d972e55324c) and sha256:-prefixed short IDs (e.g. sha256:0d972e55324c) are accepted.

Update _resolve_to_snapshot_id resolution order: 1. HEAD 2. Branch name 3. Full sha256:<64hex> ID — snapshot then commit 4. Short hex prefix — _resolve_snapshot_prefix scan (NEW)

Update module docstring with short-prefix example in agent quickstart.

Add 9 tests in TestPrefixIdResolution: bare hex prefix, sha256:<prefix>, full ID still works, correct snapshot resolved, nonexistent prefix errors, _resolve_snapshot_prefix unit (both bare and prefixed forms), batch --stdin with short prefix IDs.

sha256:e8ab50867fbe69e40ea5c0dbaa3d340fc598fdcff338c29d4b67951ed5f42900 sha
sha256:46e55a12823f736a290ccfe502220edb35a57ea0d02a37d13109bca1b3e3eaf6 snapshot
← Older Oldest on task/snapshot-diff-prefix-resolve
All commits
Newer → Latest on task/snapshot-diff-prefix-resolve

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:e8ab50867fbe69e40ea5c0dbaa3d340fc598fdcff338c29d4b67951ed5f42900 --body "your comment"