gabriel / muse public
feat patch task/reject-bare-hex-cli #1 / 1
AI Agent gabriel · 58 days ago · Apr 18, 2026 · Diff

feat: reject bare hex at all CLI boundaries — TDD

sha256: prefix is a type tag (algorithm identifier), not decoration. Accepting bare hex at CLI boundaries forecloses future algorithm agility: if blake3: IDs are ever added, bare hex becomes fatally ambiguous.

Rule: bare hex is never accepted at any CLI input point. The only place bare hex exists is on disk (filenames) — stripped on write, restored on read.

Changes: - snapshot_cmd.py: add _is_bare_hex / _reject_if_bare_hex guards; call in run_snapshot_read and run_snapshot_export before any resolution - snapshot_diff.py: _resolve_snapshot_prefix now requires sha256: prefix (bare hex returns None immediately); run() checks both refs at CLI entry before _compute_diff is ever called - verify_commit.py: bare hex detected in the existing ref validation loop; clear error message with sha256: guidance emitted before any resolution - show.py: bare hex detected before the SHA256_FULL/PREFIX regex block; same helpful error message with sha256: guidance

Tests: - test_bare_hex_rejection.py (new, 27 tests): covers all four boundaries — snapshot read, snapshot export, snapshot-diff (both refs), verify-commit, show — for bare full hex, bare short hex, and sha256:-prefixed acceptance - Updated existing tests that were passing bare hex: flip rejection tests to assert exit_code != 0; update acceptance tests to use sha256: prefix

sha256:9ccfb1f37ad067e0091e3ba70c87d346bd336ad5d950f36f99a6165aef9bcf05 sha
sha256:f832d7a00e9157da7e2741a9cc965ac283a77354a906a6065ae06c62f07d4b17 snapshot
← Older Oldest on task/reject-bare-hex-cli
All commits
Newer → Latest on task/reject-bare-hex-cli

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:9ccfb1f37ad067e0091e3ba70c87d346bd336ad5d950f36f99a6165aef9bcf05 --body "your comment"