gabriel / muse public
fix patch dev
AI Agent gabriel · 132 days ago · Apr 25, 2026 · Diff

fix: enforce sha256: prefix on ref files and repo_id

- read_ref rejects bare-hex values (returns None); only sha256:-prefixed IDs are valid — legacy files are treated as corrupt, not silently promoted - iter_branch_refs inherits the rejection: bare-hex refs are skipped - validate_repo_id now requires sha256:<64 hex> — UUIDs and plain strings are rejected with a descriptive error - clone.py: write branch refs through write_branch_ref (not write_text_atomic) so the prefix invariant is enforced at the write boundary - worktree.py: same — use write_branch_ref for new branch creation - init --force: only preserves existing repo_id if it passes validate_repo_id; legacy UUIDs cause a fresh sha256: ID to be generated - init --force: never clears an existing non-empty branch ref

sha256:c4c8d49a5cee2ef8f7991cc1b1e9c98f1015a372ee2185123c0d93f04c182039 sha
+17 ~22 −3 symbols
sha256:697921405d53787a181eb98def02132ecceef6de55e4a9ba3998f1a80ef36fbc snapshot
+17
symbols added
~22
symbols modified
−3
symbols removed
0
dead code introduced
Semantic Changes 42 symbols
~ muse/cli/commands/clone.py .py 1 symbol added, 5 symbols modified
+ write_branch_ref import import write_branch_ref L72–72
~ run
~ muse/cli/commands/init.py .py 1 symbol added, 5 symbols modified
~ muse/cli/commands/worktree.py .py 1 symbol added, 3 symbols modified
+ write_branch_ref import import write_branch_ref L46–46
~ muse/core/refs.py .py 1 symbol modified
~ muse/core/validation.py .py 2 symbols added, 1 symbol modified
+ _REPO_ID_RE variable variable _REPO_ID_RE L179–179
+ _re import import _re L178–178
~ tests/test_core_refs.py .py 5 symbols added, 3 symbols modified
+ test_bare_hex_in_file_is_skipped method method test_bare_hex_in_file_is_skipped L225–230
+ test_bare_hex_returns_none method method test_bare_hex_returns_none L116–120
+ test_prefixed_id_returned_unchanged method method test_prefixed_id_returned_unchanged L122–126
+ _write_corrupt_ref function function _write_corrupt_ref L59–64
+ _store_write_branch_ref import import _store_write_branch_ref L34–34
~ tests/test_core_validation.py .py 7 symbols added, 3 symbols removed, 4 symbols modified
test_rejects_dotdot_component method method test_rejects_dotdot_component L245–247
test_valid_simple_id method method test_valid_simple_id L234–235
test_valid_uuid_style method method test_valid_uuid_style L230–232
+ test_rejects_bare_hex method method test_rejects_bare_hex L240–242
+ test_rejects_invalid_hex_char method method test_rejects_invalid_hex_char L256–258
+ test_rejects_simple_string method method test_rejects_simple_string L244–246
+ test_rejects_uuid method method test_rejects_uuid L236–238
+ test_valid_sha256_prefixed method method test_valid_sha256_prefixed L233–234
+ _VALID_REPO_ID variable variable _VALID_REPO_ID L229–229
+ long_id import import long_id L16–16
← Older Oldest on dev
All commits
Newer → Latest on dev

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