gabriel / muse public
fix patch object_store main #40 / 55
gabriel · 140 days ago · Apr 16, 2026 · Diff

fix(object_store): strip sha256: prefix before constructing filesystem path

object_path() was slicing object_id[:plen]/object_id[plen:] but after the sha256: prefix enforcement the ID starts with 'sha256:' — causing the shard directory to be 'sh/' and filename to be 'a256:...' instead of '7e/364b...'.

Fix: removeprefix('sha256:') before the shard split, same pattern as _commit_path and _snapshot_path in store.py.

sha256:4058d36a2c03c33e95f854d8b237027f186d3afaec2cb1bddcad1f4677da90a7 sha
+37 symbols
sha256:67a57a3af9f16cf938aab103ab66326bf9704e1d3a585bb76ad95d2001435732 snapshot
+37
symbols added
0
dead code introduced
Semantic Changes 37 symbols
~ muse/core/object_store.py .py 37 symbols added
+ _CLEANUP_MIN_AGE_SECS variable variable _CLEANUP_MIN_AGE_SECS L77–77
+ _DEFAULT_SHARD_PREFIX_LEN variable variable _DEFAULT_SHARD_PREFIX_LEN L66–66
+ _OBJECTS_DIR variable variable _OBJECTS_DIR L65–65
+ _OBJECT_MODE variable variable _OBJECT_MODE L70–70
+ _VALID_SHARD_PREFIX_LENS variable variable _VALID_SHARD_PREFIX_LENS L67–67
+ _cached_shard_prefix_len function function _cached_shard_prefix_len L126–141
+ _created_object_shards variable variable _created_object_shards L178–178
+ _ensure_object_shard function function _ensure_object_shard L181–209
+ _fsync_fd function function _fsync_fd L80–109
+ _fsync_path function function _fsync_path L112–122
+ _object_path_with_fallback function function _object_path_with_fallback L324–350
+ _shard_prefix_len function function _shard_prefix_len L144–154
+ cleanup_stale_object_temps function function cleanup_stale_object_temps L212–267
+ has_object function function has_object L353–367
+ MAX_FILE_BYTES import import MAX_FILE_BYTES L55–55
+ MAX_OBJECT_WRITE_BYTES import import MAX_OBJECT_WRITE_BYTES L55–55
+ annotations import import annotations L42–42
+ assert_not_symlink import import assert_not_symlink L55–55
+ assert_write_inside_repo import import assert_write_inside_repo L55–55
+ fcntl import import fcntl L44–44
+ functools function import functools L45–45
+ hashlib import import hashlib L46–46
+ logging import import logging L47–47
+ os import import os L48–48
+ pathlib import import pathlib L49–49
+ shutil import import shutil L50–50
+ sys import import sys L51–51
+ tempfile import import tempfile L52–52
+ time import import time L53–53
+ validate_object_id import import validate_object_id L55–55
+ logger variable variable logger L63–63
+ object_path function function object_path L291–321
+ objects_dir function function objects_dir L270–288
+ read_object function function read_object L542–599
+ restore_object function function restore_object L602–733
+ write_object function function write_object L370–452
+ write_object_from_path function function write_object_from_path L455–539

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