gabriel / muse public
feat BREAKING storage dev
AI Agent gabriel · 107 days ago · May 21, 2026 · Diff

feat(storage): phase 5 — stage index uses plain JSON, not binary msgpack

- code_stage_path() returns .muse/code/stage.json (was stage.msgpack) - write_stage() writes UTF-8 JSON with atomic fsync+rename - read_stage() parses JSON; returns {} silently for old msgpack bytes (byte > 0x7F guard) - _STAGE_VERSION bumped to 3 to invalidate any existing msgpack stage files - Removed obsolete stage.json → stage.msgpack migration block - test_phase5_stage_index_json.py: 16 new tests covering all Phase 5 requirements - test_code_stage.py: updated legacy migration test to reflect JSON-as-primary

Issue: #12

sha256:3ffc2032aee173bfba8c74b0a4ca26a68acb6618c0eee270ac23ff73277d8e0c sha
+29 ~8 −6 symbols
sha256:789d3b51b399b29afac4f617286819ddc915da9fcdac3e085d657f1803e7df61 snapshot
+29
symbols added
~8
symbols modified
−6
symbols removed
0
dead code introduced
Semantic Changes 43 symbols
~ tests/test_phase5_stage_index_json.py .py 28 symbols added
+ TestReadStage class class TestReadStage L155–226
+ test_add_after_stale_reset method method test_add_after_stale_reset L189–208
+ test_corrupt_json_returns_empty method method test_corrupt_json_returns_empty L210–217
+ test_non_dict_json_returns_empty method method test_non_dict_json_returns_empty L219–226
+ test_read_json_entries method method test_read_json_entries L162–171
+ test_read_missing_returns_empty method method test_read_missing_returns_empty L156–160
+ test_read_stale_msgpack_returns_empty method method test_read_stale_msgpack_returns_empty L173–180
+ test_stale_msgpack_does_not_raise method method test_stale_msgpack_does_not_raise L182–187
+ TestStagePath class class TestStagePath L61–76
+ test_stage_path_has_json_extension method method test_stage_path_has_json_extension L62–65
+ test_stage_path_in_code_dir method method test_stage_path_in_code_dir L72–76
+ test_stage_path_name method method test_stage_path_name L67–70
+ TestWriteStage class class TestWriteStage L83–148
+ test_schema_version_is_3 method method test_schema_version_is_3 L130–137
+ test_write_empty_removes_file method method test_write_empty_removes_file L120–128
+ test_write_file_not_msgpack method method test_write_file_not_msgpack L95–106
+ test_write_idempotent method method test_write_idempotent L139–148
+ test_write_produces_json_file method method test_write_produces_json_file L84–93
+ test_write_read_roundtrip method method test_write_read_roundtrip L108–118
+ _make_entries function function _make_entries L32–45
+ _make_repo function function _make_repo L27–29
+ _write_legacy_msgpack_stage function function _write_legacy_msgpack_stage L48–54
+ annotations import import annotations L12–12
+ code_stage_path import import code_stage_path L20–20
+ json import import json L14–14
+ msgpack import import msgpack L17–17 ← moved from muse/plugins/code/stage.py
+ pathlib import import pathlib L15–15
+ pytest import import pytest L18–18
~ muse/core/paths.py .py 1 symbol modified
~ muse/plugins/code/stage.py .py 5 symbols removed, 6 symbols modified
MsgpackDict import import MsgpackDict L38–38
MsgpackValue import import MsgpackValue L38–38
load_json_file import import load_json_file L36–36
msgpack import import msgpack L34–34 → moved to tests/test_phase5_stage_index_json.py
read_msgpack_file import import read_msgpack_file L38–38
~ tests/test_code_stage.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
test_legacy_json_is_migrated_transparently method method test_legacy_json_is_migrated_transparently L629–650
+ test_stage_json_is_readable_directly method method test_stage_json_is_readable_directly L629–647
← 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:3ffc2032aee173bfba8c74b0a4ca26a68acb6618c0eee270ac23ff73277d8e0c --body "your comment"