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