gabriel / muse public
refactor BREAKING core task/blob-id-hash-file #1 / 1
AI Agent gabriel · 58 days ago · Apr 18, 2026 · Diff

refactor(core): add blob_id() and hash_file() to _types.py, wire into call sites

- Add blob_id(data: bytes) -> str — long_id(sha256(data)) for raw bytes - Add hash_file(path, chunk_size=65536) -> str — streaming file hasher - Both live in _types.py alongside content_hash(); one canonical location for all three SHA-256 ID-derivation patterns - Add 15 new tests in test_core_types.py (blob_id × 7, hash_file × 8) - Document that blob_id(canonical_json_bytes) == content_hash(obj)

Call sites wired (removes ~20 inline long_id/hashlib patterns): snapshot.py — delete local hash_file(); replace 2× blob_id payloads object_store.py — 3× hash_file() for integrity checks; 1× blob_id() workdir.py — inline streaming hash → hash_file() stat_cache.py — _hash_bytes/_hash_str delegate to hash_file() code/plugin.py — delete local _hash_file(); 2× blob_id(merged_bytes) bundle.py — 2× blob_id(raw) for bundle verification verify_pack.py — blob_id(content) for pack integrity check hash_object.py — _hash_bytes() delegates to blob_id() range_diff.py — blob_id(commit_id.encode()) fallback patch ID

Stale hashlib imports removed from all converted files.

sha256:1b890982bd2d008c676dff4daf9d6c38be433878c005d7737a76dc21a8acee00 sha
sha256:3d88f100c1533a3b7c2f6bba217ed2b8cdfea4b1c12fb90bfc06f86121ca4cbe snapshot
← Older Oldest on task/blob-id-hash-file
All commits
Newer → Latest on task/blob-id-hash-file

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