gabriel / muse public
feat patch bundle task/bundle-supercharge #1 / 1
AI Agent gabriel · 162 days ago · Apr 16, 2026 · Diff

feat(bundle): supercharge with inspect, diff, unbundle --verify; fix sha256: prefix bugs

- New subcommands: inspect (commit log + agent provenance), diff (new vs known commits), unbundle --verify (integrity-gated writes) - _verify_bundle_integrity() shared helper used by verify and unbundle --verify - _BundleUnbundleJson now includes verified: bool field - Fix _MAX_REF_BYTES 65→72 for sha256:<64hex> format - Fix run_verify hash comparison: prepend sha256: to computed digest - Fix run_list_heads: strip sha256: prefix for bare-hex JSON + text display - Fix run_unbundle validation: accept sha256:[0-9a-f]{64} format - Fix _make_commit in test_cmd_bundle.py and test_cmd_bundle_hardening.py: obj_id needs sha256: prefix - Add docs/agent-guide.md Bundle section with agent decision chain (inspect→verify→diff→unbundle) - 64 new tests in test_cmd_bundle_supercharged.py, all green

sha256:ea64371940a8a0fec3aa1ac3a33a0743314655a9696017326837498bca5d64ba sha
+129 ~28 −1 symbols
sha256:43becfbef958266ecd08c41b8cd0978eab63cce876e0af259472b014de010e5f snapshot
+129
symbols added
~28
symbols modified
−1
symbol removed
0
dead code introduced
Semantic Changes 158 symbols
~ tests/test_cmd_bundle_supercharged.py .py 112 symbols added
+ TestBundleDiffDataIntegrity class class TestBundleDiffDataIntegrity L958–1002
+ test_diff_new_count_matches_actual_writes method method test_diff_new_count_matches_actual_writes L981–1002
+ test_diff_then_unbundle_gives_zero_new method method test_diff_then_unbundle_gives_zero_new L959–979
+ TestBundleDiffPerformance class class TestBundleDiffPerformance L1005–1024
+ test_diff_100_commit_bundle_under_1s method method test_diff_100_commit_bundle_under_1s L1006–1024
+ TestBundleDiffSecurity class class TestBundleDiffSecurity L939–955
+ _has_ansi method method _has_ansi L940–941
+ test_ansi_in_bundle_message_stripped method method test_ansi_in_bundle_message_stripped L943–955
+ TestBundleDiffStress class class TestBundleDiffStress L1027–1043
+ test_diff_200_commit_bundle method method test_diff_200_commit_bundle L1028–1043
+ TestBundleDiffText class class TestBundleDiffText L912–936
+ test_text_output_mentions_new_commits method method test_text_output_mentions_new_commits L913–925
+ test_text_output_up_to_date_message method method test_text_output_up_to_date_message L927–936
+ TestBundleDiffUnit class class TestBundleDiffUnit L725–909
+ test_diff_commit_entry_schema method method test_diff_commit_entry_schema L827–842
+ test_diff_commits_list_contains_new_entries method method test_diff_commits_list_contains_new_entries L805–825
+ test_diff_file_not_found method method test_diff_file_not_found L885–891
+ test_diff_help_exits_0 method method test_diff_help_exits_0 L728–730
+ test_diff_help_mentions_agent method method test_diff_help_mentions_agent L732–734
+ test_diff_j_alias method method test_diff_j_alias L893–909
+ test_diff_json_schema_keys method method test_diff_json_schema_keys L736–745
+ test_diff_known_commits_when_already_applied method method test_diff_known_commits_when_already_applied L747–758
+ test_diff_new_commits_in_fresh_repo method method test_diff_new_commits_in_fresh_repo L760–776
+ test_diff_partial_known_commits method method test_diff_partial_known_commits L844–869
+ test_diff_refs_to_advance_empty_when_known method method test_diff_refs_to_advance_empty_when_known L793–803
+ test_diff_refs_to_advance_populated method method test_diff_refs_to_advance_populated L778–791
+ test_diff_requires_repo method method test_diff_requires_repo L871–883
+ TestBundleInspectDataIntegrity class class TestBundleInspectDataIntegrity L427–473
+ test_inspect_branch_commit_id_matches_list_heads method method test_inspect_branch_commit_id_matches_list_heads L461–473
+ test_inspect_commit_ids_match_create_json method method test_inspect_commit_ids_match_create_json L430–444
+ test_inspect_consistent_with_verify method method test_inspect_consistent_with_verify L446–459
+ TestBundleInspectPerformance class class TestBundleInspectPerformance L476–490
+ test_inspect_100_commit_bundle_under_1s method method test_inspect_100_commit_bundle_under_1s L477–490
+ TestBundleInspectSecurity class class TestBundleInspectSecurity L378–424
+ _has_ansi method method _has_ansi L381–382
+ test_ansi_in_agent_id_stripped method method test_ansi_in_agent_id_stripped L409–416
+ test_ansi_in_branch_name_stripped method method test_ansi_in_branch_name_stripped L395–407
+ test_ansi_in_commit_message_stripped method method test_ansi_in_commit_message_stripped L384–393
+ test_oversized_bundle_rejected method method test_oversized_bundle_rejected L418–424
+ TestBundleInspectStress class class TestBundleInspectStress L493–548
+ test_concurrent_inspect_consistent method method test_concurrent_inspect_consistent L522–548
+ test_inspect_200_commit_bundle method method test_inspect_200_commit_bundle L494–504
+ test_inspect_multi_branch_bundle method method test_inspect_multi_branch_bundle L506–520
+ TestBundleInspectText class class TestBundleInspectText L348–375
+ test_text_output_includes_commit_message method method test_text_output_includes_commit_message L369–375
+ test_text_output_mentions_branch method method test_text_output_mentions_branch L360–367
+ test_text_output_mentions_commits method method test_text_output_mentions_commits L351–358
+ TestBundleInspectUnit class class TestBundleInspectUnit L170–345
+ test_inspect_agent_id_empty_for_human_commit method method test_inspect_agent_id_empty_for_human_commit L258–266
+ test_inspect_agent_id_from_agent_commit method method test_inspect_agent_id_from_agent_commit L248–256
+ test_inspect_branch_annotated_on_tip_commit method method test_inspect_branch_annotated_on_tip_commit L281–290
+ test_inspect_branches_map method method test_inspect_branches_map L229–236
+ test_inspect_commit_entry_schema method method test_inspect_commit_entry_schema L196–207
+ test_inspect_commit_message_present method method test_inspect_commit_message_present L238–246
+ test_inspect_commits_newest_first method method test_inspect_commits_newest_first L268–279
+ test_inspect_does_not_require_repo method method test_inspect_does_not_require_repo L304–314
+ test_inspect_empty_bundle method method test_inspect_empty_bundle L326–334
+ test_inspect_file_not_found method method test_inspect_file_not_found L316–318
+ test_inspect_help_exits_0 method method test_inspect_help_exits_0 L173–175
+ test_inspect_help_mentions_agent method method test_inspect_help_mentions_agent L177–179
+ test_inspect_help_mentions_json_schema method method test_inspect_help_mentions_json_schema L181–183
+ test_inspect_invalid_msgpack method method test_inspect_invalid_msgpack L320–324
+ test_inspect_j_alias method method test_inspect_j_alias L336–345
+ test_inspect_json_schema_keys method method test_inspect_json_schema_keys L185–194
+ test_inspect_non_tip_commit_has_no_branch method method test_inspect_non_tip_commit_has_no_branch L292–302
+ test_inspect_total_commits_count method method test_inspect_total_commits_count L209–218
+ test_inspect_total_objects_positive method method test_inspect_total_objects_positive L220–227
+ TestBundleUnbundleVerifyFlag class class TestBundleUnbundleVerifyFlag L556–692
+ _src_dst method method _src_dst L559–568
+ test_no_verify_flag_still_works method method test_no_verify_flag_still_works L654–661
+ test_verify_and_no_update_refs_combined method method test_verify_and_no_update_refs_combined L663–676
+ test_verify_flag_applies_objects method method test_verify_flag_applies_objects L583–590
+ test_verify_flag_clean_bundle_exits_0 method method test_verify_flag_clean_bundle_exits_0 L575–581
+ test_verify_flag_corrupt_bundle_exits_1 method method test_verify_flag_corrupt_bundle_exits_1 L592–603
+ test_verify_flag_corrupt_does_not_write method method test_verify_flag_corrupt_does_not_write L605–621
+ test_verify_flag_help_mentioned method method test_verify_flag_help_mentioned L570–573
+ test_verify_flag_json_corrupt_verified_false method method test_verify_flag_json_corrupt_verified_false L638–652
+ test_verify_flag_json_output_has_verified_field method method test_verify_flag_json_output_has_verified_field L623–636
+ test_verify_flag_security_corrupt_before_parse method method test_verify_flag_security_corrupt_before_parse L678–692
+ TestBundleUnbundleVerifyStress class class TestBundleUnbundleVerifyStress L695–717
+ test_verify_flag_100_commit_bundle method method test_verify_flag_100_commit_bundle L696–717
+ _REPO_ID variable variable _REPO_ID L80–80
+ _counter variable variable _counter L107–107
+ _create_bundle function function _create_bundle L151–154
+ _env function function _env L103–104
+ _init_repo function function _init_repo L92–100
+ _invoke function function _invoke L147–148
+ _make_commit function function _make_commit L110–144
+ _parse_diff function function _parse_diff L161–162
+ _parse_inspect function function _parse_inspect L157–158
+ _sha function function _sha L88–89
+ CliRunner import import CliRunner L73–73
+ CommitRecord import import CommitRecord L76–76
+ InvokeResult import import InvokeResult L73–73
+ Manifest import import Manifest L77–77
+ SnapshotRecord import import SnapshotRecord L76–76
+ annotations import import annotations L60–60
+ compute_commit_id import import compute_commit_id L75–75
+ compute_snapshot_id import import compute_snapshot_id L75–75
+ datetime import import datetime L62–62
+ hashlib import import hashlib L63–63
+ json import import json L64–64
+ msgpack import import msgpack L70–70
+ os import import os L65–65
+ pathlib import import pathlib L66–66
+ pytest import import pytest L71–71
+ threading import import threading L68–68
+ time import import time L67–67
+ write_commit import import write_commit L76–76
+ write_object import import write_object L74–74
+ write_snapshot import import write_snapshot L76–76
+ runner variable variable runner L79–79
~ docs/agent-guide.md .md 10 symbols added, 1 symbol removed, 18 symbols modified
− code[bash]@L212 variable variable code[bash]@L212 L212–234
+ Branch semantic flags section Branch semantic flags L210–236
+ code[bash]@L214 variable variable code[bash]@L214 L214–233
+ code[bash]@L238 variable variable code[bash]@L238 L238–263
+ Bundle — Off-Network Transfer section Bundle — Off-Network Transfer L266–318
+ Agent decision chain section Agent decision chain L272–297
+ code[bash]@L276 variable variable code[bash]@L276 L276–293
+ Create section Create L297–305
+ code[bash]@L299 variable variable code[bash]@L299 L299–304
+ Subcommand reference section Subcommand reference L305–318
+ table@L307 section table@L307 L307–315
~ muse/cli/commands/bundle.py .py 7 symbols added, 6 symbols modified
+ _BundleDiffCommit class class _BundleDiffCommit L160–165
+ _BundleDiffJson class class _BundleDiffJson L168–174
+ _BundleInspectCommit class class _BundleInspectCommit L141–148
+ _BundleInspectJson class class _BundleInspectJson L151–157
+ _verify_bundle_integrity function function _verify_bundle_integrity L683–713
+ run_diff function function run_diff L821–910
+ run_inspect function function run_inspect L716–818
~ tests/test_cmd_bundle.py .py 1 symbol modified
← Older Oldest on task/bundle-supercharge
All commits
Newer → Latest on task/bundle-supercharge

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