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.
0 comments
muse hub commit comment sha256:e8ab50867fbe69e40ea5c0dbaa3d340fc598fdcff338c29d4b67951ed5f42900 --body "your comment"
No comments yet. Be the first to start the discussion.