gabriel / muse public
refactor BREAKING store task/store-phase3-commits #1 / 1
AI Agent gabriel · 113 days ago · May 21, 2026 · Diff

refactor(store): Phase 3 — extract commit layer to muse.core.commits

Move CommitRecord, CommitDict, MissingParentError, WalkResult, and all commit I/O functions (write_commit, read_commit, resolve_commit_ref, etc.) from store.py into muse/core/commits.py.

Extract shared deserializer helpers (_str_val, _int_val, _str_or_none, _str_list, _str_dict, _float_val) into muse/core/record_helpers.py to avoid circular imports with SnapshotRecord/TagRecord/ReleaseRecord that remain in store.py.

store.py re-exports all extracted symbols for backward-compatible imports. No callers need updating — existing from muse.core.store import X still works.

sha256:63508f7da4df6cf72f8518fe9c825edf74add2a4b6901fb2e2fe24691e629cf8 sha
+113 −41 symbols
sha256:515772ea63ec7cdd57c22f6b69c82a30d8d80cc2b95e4a947a90c1ab51f56218 snapshot
+113
symbols added
−41
symbols removed
0
dead code introduced
Semantic Changes 154 symbols
~ muse/core/commits.py .py 70 symbols added
+ CommitDict class class CommitDict L128–185 ← moved from muse/core/store.py
+ CommitReadCorrupt class class CommitReadCorrupt L332–335 ← moved from muse/core/store.py
+ CommitReadNotFound class class CommitReadNotFound L329–330 ← moved from muse/core/store.py
+ CommitReadOk class class CommitReadOk L325–327 ← moved from muse/core/store.py
+ CommitRecord class class CommitRecord L192–319
+ from_dict method method from_dict L259–319 ← moved from muse/core/store.py
+ to_dict method method to_dict L229–256 ← moved from muse/core/store.py
+ MissingParentError class class MissingParentError L114–122 ← moved from muse/core/store.py
+ WalkResult class class WalkResult L337–347 ← moved from muse/core/store.py
+ _as_structured_delta function function _as_structured_delta L83–92 ← moved from muse/core/store.py
+ _find_commit_by_prefix function function _find_commit_by_prefix L674–696
+ _known_commits_dirs variable variable _known_commits_dirs L365–365 ← moved from muse/core/store.py
+ _resolve_branch_commit_id function function _resolve_branch_commit_id L722–739
+ _sem_ver_bump_val function function _sem_ver_bump_val L95–108
+ _verify_commit_id function function _verify_commit_id L375–411
+ commit_exists function function commit_exists L367–369
+ commit_path function function commit_path L353–359
+ commit_read_is_corrupt function function commit_read_is_corrupt L521–525 ← moved from muse/core/store.py
+ commit_read_is_not_found function function commit_read_is_not_found L514–518 ← moved from muse/core/store.py
+ commit_read_is_ok function function commit_read_is_ok L507–511 ← moved from muse/core/store.py
+ find_commits_by_prefix function function find_commits_by_prefix L699–719 ← moved from muse/core/store.py
+ get_all_commits function function get_all_commits L766–792
+ get_commits_for_branch function function get_commits_for_branch L742–763
+ get_head_snapshot_id function function get_head_snapshot_id L603–614 ← moved from muse/core/store.py
+ Literal import import Literal L50–50
+ Manifest import import Manifest L65–65
+ Metadata import import Metadata L65–65
+ MsgpackDict import import MsgpackDict L65–65
+ MsgpackValue import import MsgpackValue L65–65
+ SemVerBump import import SemVerBump L65–65
+ StructuredDelta import import StructuredDelta L75–75
+ TypeGuard import import TypeGuard L50–50
+ TypedDict import import TypedDict L50–50
+ _float_val import import _float_val L55–55
+ _int_val import import _int_val L55–55
+ _json import import _json L43–43
+ _objects_dir import import _objects_dir L53–53
+ _ref_path import import _ref_path L54–54
+ _remotes_dir import import _remotes_dir L54–54
+ _str_dict import import _str_dict L55–55
+ _str_list import import _str_list L55–55
+ _str_or_none import import _str_or_none L55–55
+ _str_val import import _str_val L55–55
+ annotations import import annotations L40–40
+ compute_commit_id import import compute_commit_id L64–64
+ dataclass class import dataclass L49–49
+ datetime import import datetime L42–42
+ field import import field L49–49
+ get_head_commit_id import import get_head_commit_id L63–63
+ logging import import logging L44–44
+ long_id import import long_id L65–65
+ os import import os L45–45
+ pathlib import import pathlib L46–46
+ re import import re L47–47
+ read_ref import import read_ref L63–63
+ resolve_any_ref import import resolve_any_ref L63–63
+ sanitize_glob_prefix import import sanitize_glob_prefix L74–74
+ short_id import import short_id L65–65
+ tempfile import import tempfile L48–48
+ validate_ref_id import import validate_ref_id L74–74
+ write_text_atomic import import write_text_atomic L52–52
+ logger variable variable logger L77–77
+ overwrite_commit function function overwrite_commit L556–577
+ read_commit function function read_commit L484–504
+ read_commit_result function function read_commit_result L528–550
+ resolve_commit_ref function function resolve_commit_ref L617–671
+ update_commit_metadata function function update_commit_metadata L580–597 ← moved from muse/core/store.py
+ walk_commits_between function function walk_commits_between L798–813
+ walk_commits_between_result function function walk_commits_between_result L816–839
+ write_commit function function write_commit L414–478 ← moved from muse/core/store.py
~ muse/core/record_helpers.py .py 9 symbols added
+ _float_val function function _float_val L60–76 ← moved from muse/core/store.py
+ _int_val function function _int_val L20–29 ← moved from muse/core/store.py
+ _str_dict function function _str_dict L50–57 ← moved from muse/core/store.py
+ _str_list function function _str_list L40–47 ← moved from muse/core/store.py
+ _str_or_none function function _str_or_none L32–37
+ _str_val function function _str_val L12–17
+ Manifest import import Manifest L9–9
+ MsgpackDict import import MsgpackDict L9–9
+ annotations import import annotations L7–7
~ muse/core/store.py .py 34 symbols added, 41 symbols removed
CommitDict class class CommitDict L374–431 → moved to muse/core/commits.py
CommitReadCorrupt class class CommitReadCorrupt L1117–1120 → moved to muse/core/commits.py
CommitReadNotFound class class CommitReadNotFound L1114–1115 → moved to muse/core/commits.py
CommitReadOk class class CommitReadOk L1110–1112 → moved to muse/core/commits.py
CommitRecord class class CommitRecord L461–598
from_dict method method from_dict L528–598 → moved to muse/core/commits.py
to_dict method method to_dict L498–525 → moved to muse/core/commits.py
MissingParentError class class MissingParentError L334–342 → moved to muse/core/commits.py
WalkResult class class WalkResult L1422–1432 → moved to muse/core/commits.py
_COMMITS_DIR variable variable _COMMITS_DIR L344–344
_RELEASES_DIR variable variable _RELEASES_DIR L347–347
_SNAPSHOTS_DIR variable variable _SNAPSHOTS_DIR L345–345
_TAGS_DIR variable variable _TAGS_DIR L346–346
_as_structured_delta function function _as_structured_delta L256–265 → moved to muse/core/commits.py
_find_commit_by_prefix function function _find_commit_by_prefix L1293–1316
_float_val function function _float_val L238–254 → moved to muse/core/record_helpers.py
_int_val function function _int_val L199–208 → moved to muse/core/record_helpers.py
_known_commits_dirs variable variable _known_commits_dirs L918–918 → moved to muse/core/commits.py
_resolve_branch_commit_id function function _resolve_branch_commit_id L1340–1360
_str_dict function function _str_dict L229–236 → moved to muse/core/record_helpers.py
_str_list function function _str_list L220–227 → moved to muse/core/record_helpers.py
_str_or_none function function _str_or_none L210–218
_str_val function function _str_val L188–197
_verify_commit_id function function _verify_commit_id L1002–1048
commit_exists function function commit_exists L906–914
commit_path function function commit_path L810–818
commit_read_is_corrupt function function commit_read_is_corrupt L1134–1138 → moved to muse/core/commits.py
commit_read_is_not_found function function commit_read_is_not_found L1128–1132 → moved to muse/core/commits.py
commit_read_is_ok function function commit_read_is_ok L1122–1126 → moved to muse/core/commits.py
find_commits_by_prefix function function find_commits_by_prefix L1318–1338 → moved to muse/core/commits.py
get_all_commits function function get_all_commits L1392–1420
get_commits_for_branch function function get_commits_for_branch L1362–1390
get_head_snapshot_id function function get_head_snapshot_id L1215–1226 → moved to muse/core/commits.py
overwrite_commit function function overwrite_commit L1168–1194
read_commit function function read_commit L1081–1108
read_commit_result function function read_commit_result L1140–1166
resolve_commit_ref function function resolve_commit_ref L1228–1291
update_commit_metadata function function update_commit_metadata L1196–1213 → moved to muse/core/commits.py
walk_commits_between function function walk_commits_between L1434–1461
walk_commits_between_result function function walk_commits_between_result L1463–1504
write_commit function function write_commit L920–1000 → moved to muse/core/commits.py
+ CommitDict import import CommitDict L191–191
+ CommitReadCorrupt import import CommitReadCorrupt L191–191
+ CommitReadNotFound import import CommitReadNotFound L191–191
+ CommitReadOk import import CommitReadOk L191–191
+ CommitRecord import import CommitRecord L191–191
+ MissingParentError import import MissingParentError L191–191
+ WalkResult import import WalkResult L191–191
+ _find_commit_by_prefix import import _find_commit_by_prefix L191–191
+ _float_val import import _float_val L183–183
+ _int_val import import _int_val L183–183
+ _known_commits_dirs import import _known_commits_dirs L191–191
+ _resolve_branch_commit_id import import _resolve_branch_commit_id L191–191
+ _str_dict import import _str_dict L183–183
+ _str_list import import _str_list L183–183
+ _str_or_none import import _str_or_none L183–183
+ _str_val import import _str_val L183–183
+ _verify_commit_id import import _verify_commit_id L191–191
+ commit_exists import import commit_exists L191–191
+ commit_path import import commit_path L191–191
+ commit_read_is_corrupt import import commit_read_is_corrupt L191–191
+ commit_read_is_not_found import import commit_read_is_not_found L191–191
+ commit_read_is_ok import import commit_read_is_ok L191–191
+ find_commits_by_prefix import import find_commits_by_prefix L191–191
+ get_all_commits import import get_all_commits L191–191
+ get_commits_for_branch import import get_commits_for_branch L191–191
+ get_head_snapshot_id import import get_head_snapshot_id L191–191
+ overwrite_commit import import overwrite_commit L191–191
+ read_commit import import read_commit L191–191
+ read_commit_result import import read_commit_result L191–191
+ resolve_commit_ref import import resolve_commit_ref L191–191
+ update_commit_metadata import import update_commit_metadata L191–191
+ walk_commits_between import import walk_commits_between L191–191
+ walk_commits_between_result import import walk_commits_between_result L191–191
+ write_commit import import write_commit L191–191
← Older Oldest on task/store-phase3-commits
All commits
Newer → Latest on task/store-phase3-commits

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