gabriel / muse public
refactor patch dev
AI Agent gabriel · 155 days ago · Apr 20, 2026 · Diff

refactor: utility anti-pattern sweep — split_sig/split_pubkey, removeprefix fixes, prod bug fixes

- Add split_sig() and split_pubkey() to _types.py: string analogs of split_id() for cryptographic values; replaces all manual removeprefix('ed25519:') calls - Document Cryptographic Value Codec section in docs/agent-guide.md with canonical prefix rules and full utility reference table - Fix gc.py: four algo-prefix glob bugs silently collecting nothing (*.msgpack → */*.msgpack for commits/snapshots, */*/*/*.msgpack for tags) - Fix harmony.py: resolve_escalation NameError (esc_dir → dest.parent) - Fix rebase.py: NameError t0 not defined before _run_replay_loop call - Sweep test_update_ref_supercharge: add --json to 21 _ur() calls - Sweep removeprefix pattern across 8 test files; use split_id/split_sig/ snapshot_path/tag_path/release_path/escalation_path at every boundary - Fix test_integrity_I5: fake_id for repo_id/release_id, correct path helpers - Fix test_harmony_phase4: escalation_path replaces 6 manual constructions - Fix test_directories_feature: status untracked check used wrong key - Fix test_ls_tree_supercharge: error payload key assertion too narrow

sha256:47319766550ec1688724e840a1e71a8f9a7a3ec469a018c0c4c6affa8342b794 sha
+172 ~598 −33 symbols
sha256:56d1350e78357049b1ec0f95f963dac1436945133d2982c4081474782c2b143d snapshot
+172
symbols added
~598
symbols modified
−33
symbols removed
0
dead code introduced
Semantic Changes 803 symbols
~ docs/utility-reference.md .md 42 symbols added
+ Muse Utility Reference & Anti-Pattern Inventory section Muse Utility Reference & Anti-Pattern Inventory L1–362
+ Anti-Pattern Inventory section Anti-Pattern Inventory L110–362
+ Pattern 1 — Manual sha256: prefix construction section Pattern 1 — Manual sha256: prefix construction L112–159
+ table@L115 section table@L115 L115–154
+ Pattern 2 — Manual prefix stripping outside the storage boundary section Pattern 2 — Manual prefix stripping outside the storage boundary L159–205
+ Production code section Production code L164–182
+ table@L166 section table@L166 L166–181
+ Test code section Test code L182–205
+ table@L184 section table@L184 L184–200
+ sha256 for object IDs section Pattern 3 — Manual hashlib.sha256 for object IDs L205–219
+ table@L209 section table@L209 L209–216
+ Pattern 4 — Manual short ID truncation section Pattern 4 — Manual short ID truncation L219–262
+ Production code section Production code L222–240
+ table@L227 section table@L227 L227–237
+ Test code (representative — use short_id consistently) section Test code (representative — use short_id consistently) L240–262
+ table@L242 section table@L242 L242–259
+ Pattern 5 — Manual UTC timestamp section Pattern 5 — Manual UTC timestamp L262–278
+ table@L265 section table@L265 L265–275
+ Pattern 6 — Manual JSON file loading section Pattern 6 — Manual JSON file loading L278–302
+ Production code section Production code L281–292
+ table@L283 section table@L283 L283–289
+ Test code (representative sample) section Test code (representative sample) L292–302
+ table@L294 section table@L294 L294–299
+ uuid4() for content-addressed entity IDs section Pattern 7 — uuid.uuid4() for content-addressed entity IDs L302–337
+ table@L308 section table@L308 L308–334
+ Pattern 8 — Manual fake_id equivalent in tests section Pattern 8 — Manual fake_id equivalent in tests L337–348
+ table@L340 section table@L340 L340–345
+ Pattern 9 — Manual object path construction section Pattern 9 — Manual object path construction L348–362
+ table@L352 section table@L352 L352–362
+ ID Format Rules section ID Format Rules L60–77
+ table@L62 section table@L62 L62–71
+ The Storage-Boundary Rule section The Storage-Boundary Rule L77–110
+ code@L85 variable variable code@L85 L85–92
+ Utility Functions function section Utility Functions L10–60
+ _types section muse.core._types L12–31
+ table@L14 section table@L14 L14–30
+ object_store — Object path section muse.core.object_store — Object path L31–39
+ table@L33 section table@L33 L33–36
+ store — Path constructors section muse.core.store — Path constructors L39–48
+ table@L41 section table@L41 L41–47
+ validation — Input guards section muse.core.validation — Input guards L48–60
+ table@L50 section table@L50 L50–57
~ docs/agent-guide.md .md 7 symbols added, 1 symbol removed, 30 symbols modified
code[bash]@L1146 variable variable code[bash]@L1146 L1146–1159
+ _types section Cryptographic Value Codec — muse.core._types L473–507
+ Rules section Rules L498–507
+ _types) function section Utility functions (all in muse.core._types) L485–498
+ table@L487 section table@L487 L487–497
+ Wire format section Wire format L477–485
+ code@L479 variable variable code@L479 L479–484
+ code[bash]@L1214 variable variable code[bash]@L1214 L1214–1221
~ muse/cli/app.py .py 1 symbol modified
~ main
~ muse/cli/commands/code_check.py .py 1 symbol added, 2 symbols modified
+ long_id import import long_id L53–53
~ muse/cli/commands/dead.py .py 1 symbol added, 1 symbol modified
+ _get_code_subs function function _get_code_subs L601–619
~ muse/cli/commands/docs_cmd.py .py 2 symbols added, 4 symbols modified
+ read_current_branch import import read_current_branch L148–148
+ resolve_commit_ref import import resolve_commit_ref L148–148
~ run
~ muse/cli/commands/fetch.py .py 1 symbol modified
~ muse/cli/commands/hub/__init__.py .py 22 symbols added
+ _MAX_API_RESPONSE_BYTES import import _MAX_API_RESPONSE_BYTES L37–37
+ _MAX_ISSUE_COMMENT_LEN import import _MAX_ISSUE_COMMENT_LEN L37–37
+ _MAX_ISSUE_LABEL_LEN import import _MAX_ISSUE_LABEL_LEN L37–37
+ _MAX_ISSUE_TITLE_LEN import import _MAX_ISSUE_TITLE_LEN L37–37
+ _MAX_LABEL_DESC_LEN import import _MAX_LABEL_DESC_LEN L37–37
+ _MAX_LABEL_NAME_LEN import import _MAX_LABEL_NAME_LEN L37–37
+ _MAX_PROPOSAL_BODY_LINES import import _MAX_PROPOSAL_BODY_LINES L37–37
+ _MAX_PROPOSAL_TITLE_LEN import import _MAX_PROPOSAL_TITLE_LEN L37–37
+ _MAX_REPO_DESC_LEN import import _MAX_REPO_DESC_LEN L37–37
+ _MAX_REPO_NAME_LEN import import _MAX_REPO_NAME_LEN L37–37
+ _PING_OPENER import import _PING_OPENER L37–37
+ _PROPOSAL_PREFIX_RESOLVE_LIMIT import import _PROPOSAL_PREFIX_RESOLVE_LIMIT L37–37
+ _format_proposal import import _format_proposal L37–37
+ _get_hub_and_identity import import _get_hub_and_identity L37–37
+ _hub_api import import _hub_api L37–37
+ _normalise_url import import _normalise_url L37–37
+ _ping_hub import import _ping_hub L37–37
+ _resolve_proposal_id import import _resolve_proposal_id L37–37
+ _resolve_repo_id import import _resolve_repo_id L37–37
+ _validate_hex_color import import _validate_hex_color L59–59
+ get_hub_url import import get_hub_url L37–37
+ run_issue_create import import run_issue_create L60–60
~ muse/cli/commands/log.py .py 1 symbol added, 4 symbols modified
+ long_id import import long_id L114–114
~ run
~ muse/cli/commands/migrate.py .py 1 symbol added, 3 symbols modified
+ short_id import import short_id L67–67
~ muse/cli/commands/name_rev.py .py 1 symbol modified
~ run
~ muse/cli/commands/read.py .py 1 symbol added, 2 symbols modified
+ long_id import import long_id L85–85
~ run
~ muse/cli/commands/read_commit.py .py 1 symbol added, 2 symbols modified
+ long_id import import long_id L65–65
~ run
~ muse/cli/commands/rebase.py .py 1 symbol modified
~ run
~ muse/cli/commands/release.py .py 1 symbol modified
~ muse/cli/commands/rev_parse.py .py 1 symbol added, 1 symbol modified
+ long_id import import long_id L55–55
~ run
~ muse/cli/commands/rhythm.py .py 1 symbol added, 1 symbol modified
+ short_id import import short_id L31–31
~ run
~ muse/cli/commands/scale_detect.py .py 1 symbol added, 1 symbol modified
+ short_id import import short_id L32–32
~ run
~ muse/cli/commands/tension.py .py 1 symbol added, 1 symbol modified
+ short_id import import short_id L33–33
~ run
~ muse/cli/commands/velocity_profile.py .py 1 symbol added, 1 symbol modified
+ short_id import import short_id L41–41
~ run
~ muse/core/_types.py .py 2 symbols added
+ split_pubkey function function split_pubkey L483–508
+ split_sig function function split_sig L454–480
~ muse/core/bisect.py .py 1 symbol added, 1 symbol modified
+ now_utc_iso import import now_utc_iso L68–68
~ _ts
~ muse/core/coordination.py .py 1 symbol modified
~ muse/core/gc.py .py 3 symbols added, 9 symbols modified
+ _commit_path import import _commit_path L69–69
+ _snapshot_path import import _snapshot_path L69–69
+ long_id import import long_id L66–66
~ muse/core/harmony.py .py 1 symbol modified
~ muse/core/object_store.py .py 1 symbol added, 6 symbols modified
+ split_id import import split_id L60–60
~ muse/core/store.py .py 1 symbol modified
~ muse/plugins/code/stage.py .py 1 symbol removed, 3 symbols modified
_legacy_json_path function function _legacy_json_path L73–75
~ muse/plugins/midi/plugin.py .py 1 symbol added, 1 symbol modified
+ short_id import import short_id L64–64
~ tests/test_cmd_archive_hardening.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
uuid import import uuid L71–71
+ fake_id import import fake_id L76–76
~ tests/test_cmd_bisect.py .py 1 symbol added, 1 symbol removed, 2 symbols modified
uuid import import uuid L16–16
+ fake_id import import fake_id L23–23
~ tests/test_cmd_bisect_hardening.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
uuid import import uuid L19–19
+ fake_id import import fake_id L25–25
~ tests/test_cmd_check.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
uuid import import uuid L81–81
+ fake_id import import fake_id L88–88
~ tests/test_cmd_code_add.py .py 2 symbols added, 2 symbols removed, 10 symbols modified
test_V4_legacy_json_migrated_on_first_read method method test_V4_legacy_json_migrated_on_first_read L564–580
hashlib import import hashlib L38–38
+ object_path import import object_path L48–48
+ split_id import import split_id L47–47
~ tests/test_cmd_config.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
uuid import import uuid L15–15
+ fake_id import import fake_id L18–18
~ tests/test_cmd_docs.py .py 1 symbol added, 5 symbols modified
~ tests/test_cmd_fetch_hardening.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
test_format_json_equivalent_to_json_flag method method test_format_json_equivalent_to_json_flag L640–641
+ test_json_flag_produces_valid_json method method test_json_flag_produces_valid_json L640–642
~ tests/test_cmd_gc.py .py 4 symbols added, 2 symbols removed, 10 symbols modified
hashlib import import hashlib L14–14
uuid import import uuid L17–17
+ blob_id import import blob_id L19–19
+ fake_id import import fake_id L19–19
+ object_path import import object_path L20–20
+ short_id import import short_id L19–19
~ tests/test_cmd_gc_hardening.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
uuid import import uuid L61–61
+ fake_id import import fake_id L65–65
~ tests/test_cmd_integration.py .py 1 symbol modified
~ tests/test_cmd_invariants.py .py 2 symbols added, 1 symbol removed, 8 symbols modified
~ tests/test_cmd_merge.py .py 1 symbol added, 1 symbol removed, 2 symbols modified
uuid import import uuid L16–16
+ fake_id import import fake_id L19–19
~ tests/test_cmd_merge_base.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L20–20
~ _parse
~ tests/test_cmd_merge_dry_run.py .py 1 symbol added, 1 symbol removed, 2 symbols modified
uuid import import uuid L17–17
+ fake_id import import fake_id L20–20
~ tests/test_cmd_plan_merge.py .py 1 symbol added, 1 symbol removed, 3 symbols modified
uuid import import uuid L71–71
+ fake_id import import fake_id L75–75
~ tests/test_cmd_read_commit.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L20–20
~ _parse
~ tests/test_cmd_read_snapshot.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L20–20
~ _parse
~ tests/test_cmd_reflog.py .py 1 symbol added, 1 symbol removed, 5 symbols modified
uuid import import uuid L16–16
+ fake_id import import fake_id L19–19
~ tests/test_cmd_reset_revert.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
uuid import import uuid L15–15
+ fake_id import import fake_id L18–18
~ tests/test_cmd_shelf.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
uuid import import uuid L39–39
+ fake_id import import fake_id L43–43
~ tests/test_cmd_tag.py .py 1 symbol added, 1 symbol removed, 7 symbols modified
~ tests/test_cmd_update_ref.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L18–18
~ tests/test_code_manifest.py .py 2 symbols added, 1 symbol removed, 1 symbol modified
hashlib import import hashlib L3–3
+ blob_id import import blob_id L8–8
+ object_path import import object_path L9–9
~ tests/test_core_gc.py .py 2 symbols added, 6 symbols modified
~ tests/test_gc_full.py .py 1 symbol added, 1 symbol removed, 4 symbols modified
uuid import import uuid L69–69
+ fake_id import import fake_id L82–82
~ tests/test_gc_supercharge.py .py 3 symbols added, 2 symbols removed, 4 symbols modified
hashlib import import hashlib L31–31
uuid import import uuid L34–34
+ blob_id import import blob_id L37–37
+ fake_id import import fake_id L37–37
+ object_path import import object_path L38–38
~ tests/test_implicit_edge_cache.py .py 1 symbol added, 1 symbol removed, 2 symbols modified
hashlib import import hashlib L39–39
+ blob_id import import blob_id L49–49
~ tests/test_integrity_I5_commit_integrity.py .py 4 symbols added, 53 symbols modified
~ tests/test_ls_tree_supercharge.py .py 2 symbols added, 1 symbol removed, 6 symbols modified
test_error_payload_has_exactly_three_keys method method test_error_payload_has_exactly_three_keys L198–202
+ test_error_payload_has_required_keys method method test_error_payload_has_required_keys L198–202
+ split_id import import split_id L26–26
~ tests/test_merge_base_supercharge.py .py 1 symbol added, 2 symbols modified
+ fake_id import import fake_id L20–20
~ _parse
~ tests/test_merge_data_integrity.py .py 1 symbol added, 1 symbol removed, 3 symbols modified
uuid import import uuid L38–38
+ object_path import import object_path L43–43
~ tests/test_merge_supercharge.py .py 1 symbol added, 1 symbol removed, 2 symbols modified
uuid import import uuid L17–17
+ fake_id import import fake_id L23–23
~ tests/test_porcelain_security.py .py 3 symbols added, 2 symbols removed, 4 symbols modified
hashlib import import hashlib L17–17
uuid import import uuid L20–20
+ blob_id import import blob_id L22–22
+ fake_id import import fake_id L22–22
+ object_path import import object_path L23–23
~ tests/test_read_commit_supercharge.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L26–26
~ _parse
~ tests/test_read_snapshot_supercharge.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L24–24
~ _parse
~ tests/test_rebase_missing_snapshot_guard.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L42–42
~ tests/test_security_ast_dos.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
uuid import import uuid L25–25
+ fake_id import import fake_id L29–29
~ tests/test_security_code_porcelain.py .py 1 symbol added, 1 symbol removed, 1 symbol modified
uuid import import uuid L26–26
+ fake_id import import fake_id L30–30
~ tests/test_verify_tag_supercharge.py .py 1 symbol added, 5 symbols modified
~ tests/test_workdir_integrity.py .py 1 symbol added, 3 symbols modified
+ fake_id import import fake_id L54–54
~ tools/demo.py .py 2 symbols added, 2 symbols modified
+ load_json_file import import load_json_file L30–30
+ now_utc_iso import import now_utc_iso L30–30
~ main
~ tools/render_html.py .py 1 symbol added
+ load_json_file import import load_json_file L19–19
← 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:47319766550ec1688724e840a1e71a8f9a7a3ec469a018c0c4c6affa8342b794 --body "your comment"