gabriel / muse public
feat patch merge-tree task/merge-tree-supercharge #1 / 1
AI Agent gabriel · 163 days ago · Apr 17, 2026 · Diff

feat(merge-tree): agent supercharge — TypedDicts, exit_code, duration_ms, JSON error routing

- Add _MergeTreeJson and _MergeTreeErrorJson TypedDicts for stable wire format - Add _emit_error(output_json, msg, code) — routes errors to stdout JSON in --json mode - Add t0/duration_ms timing to all JSON output paths - Add exit_code field to JSON envelope (0=clean, 1=conflict/error) - Update _SAFE_REF_RE to accept sha256:-prefixed commit IDs - Update _resolve_ref to handle sha256:-prefixed commit IDs via validate_object_id - Remove redundant 'import json as _json_mod' inside run() body - Update module docstring with full agent contract (exit_code, duration_ms, error schema) - Fix test_cmd_merge_tree.py: _sha() now returns sha256:-prefixed IDs - Fix test_write_objects_creates_snapshot: strip sha256: prefix in file path check - Fix test_same_inputs_same_output: exclude duration_ms from determinism comparison - Add tests/test_merge_tree_supercharge.py: 28 tests across 7 coverage tiers

sha256:1792b116922d66d9022ba9d4569e2789e647724c2d4dbc512db0c4d07616f8f8 sha
+68 ~9 symbols
sha256:e07c5658e17ca29dbd67f9819a48753727ce7f308c9e936dba5228c8b96a966e snapshot
+68
symbols added
~9
symbols modified
0
dead code introduced
Semantic Changes 77 symbols
~ tests/test_merge_tree_supercharge.py .py 62 symbols added
+ TestDataIntegrity class class TestDataIntegrity L236–283
+ test_base_with_sha256_prefixed_commit_id method method test_base_with_sha256_prefixed_commit_id L249–256
+ test_branch_ids_echoed_in_response method method test_branch_ids_echoed_in_response L258–264
+ test_conflict_paths_have_null_oid method method test_conflict_paths_have_null_oid L266–272
+ test_merged_manifest_oids_are_sha256_prefixed method method test_merged_manifest_oids_are_sha256_prefixed L237–247
+ test_snapshot_id_is_sha256_prefixed method method test_snapshot_id_is_sha256_prefixed L274–283
+ TestDocstring class class TestDocstring L347–356
+ _doc method method _doc L348–350
+ test_docstring_documents_duration_ms method method test_docstring_documents_duration_ms L355–356
+ test_docstring_documents_exit_code method method test_docstring_documents_exit_code L352–353
+ TestErrorPayload class class TestErrorPayload L173–228
+ test_bad_branch1_error_goes_to_stdout method method test_bad_branch1_error_goes_to_stdout L174–180
+ test_bad_branch2_error_goes_to_stdout method method test_bad_branch2_error_goes_to_stdout L182–190
+ test_error_payload_has_error_field method method test_error_payload_has_error_field L217–222
+ test_error_payload_has_exit_code method method test_error_payload_has_exit_code L210–215
+ test_error_payload_has_status_error method method test_error_payload_has_status_error L204–208
+ test_no_common_ancestor_error_goes_to_stdout method method test_no_common_ancestor_error_goes_to_stdout L192–202
+ test_no_duplicate_stderr_prose method method test_no_duplicate_stderr_prose L224–228
+ TestJsonEnvelopeDurationMs class class TestJsonEnvelopeDurationMs L142–165
+ test_clean_merge_has_duration_ms method method test_clean_merge_has_duration_ms L143–150
+ test_conflict_merge_has_duration_ms method method test_conflict_merge_has_duration_ms L152–158
+ test_write_objects_has_duration_ms method method test_write_objects_has_duration_ms L160–165
+ TestJsonEnvelopeExitCode class class TestJsonEnvelopeExitCode L117–134
+ test_clean_merge_has_exit_code_zero method method test_clean_merge_has_exit_code_zero L118–125
+ test_conflict_merge_has_exit_code_nonzero method method test_conflict_merge_has_exit_code_nonzero L127–134
+ TestNoProsePollution class class TestNoProsePollution L291–308
+ test_clean_merge_stdout_is_valid_json method method test_clean_merge_stdout_is_valid_json L292–296
+ test_conflict_merge_stdout_is_valid_json method method test_conflict_merge_stdout_is_valid_json L298–301
+ test_no_emoji_in_clean_json method method test_no_emoji_in_clean_json L303–308
+ TestStress class class TestStress L364–388
+ test_100_files_40_pct_conflicts method method test_100_files_40_pct_conflicts L365–388
+ TestTypedDicts class class TestTypedDicts L316–339
+ test_merge_tree_error_json_has_required_fields method method test_merge_tree_error_json_has_required_fields L335–339
+ test_merge_tree_error_json_typeddict_exists method method test_merge_tree_error_json_typeddict_exists L321–323
+ test_merge_tree_json_has_duration_ms_annotation method method test_merge_tree_json_has_duration_ms_annotation L330–333
+ test_merge_tree_json_has_exit_code_annotation method method test_merge_tree_json_has_exit_code_annotation L325–328
+ test_merge_tree_json_typeddict_exists method method test_merge_tree_json_typeddict_exists L317–319
+ _DT variable variable _DT L30–30
+ _REPO_ID variable variable _REPO_ID L29–29
+ _conflicted function function _conflicted L101–109
+ _diverged function function _diverged L90–98
+ _env function function _env L53–54
+ _init_repo function function _init_repo L42–50
+ _make_commit function function _make_commit L63–82
+ _mt function function _mt L85–87
+ _sha function function _sha L38–39
+ _write_obj function function _write_obj L57–60
+ CliRunner import import CliRunner L25–25
+ CommitRecord import import CommitRecord L24–24
+ SnapshotRecord import import SnapshotRecord L24–24
+ annotations import import annotations L14–14
+ compute_commit_id import import compute_commit_id L23–23
+ compute_snapshot_id import import compute_snapshot_id L23–23
+ datetime import import datetime L16–16
+ get_type_hints import import get_type_hints L20–20
+ hashlib import import hashlib L17–17
+ json import import json L18–18
+ pathlib import import pathlib L19–19
+ write_commit import import write_commit L24–24
+ write_object import import write_object L22–22
+ write_snapshot import import write_snapshot L24–24
+ runner variable variable runner L27–27
~ muse/cli/commands/merge_tree.py .py 6 symbols added, 6 symbols modified
+ _MergeTreeErrorJson class class _MergeTreeErrorJson L132–136
+ _MergeTreeJson class class _MergeTreeJson L120–129
+ _emit_error function function _emit_error L144–158
+ TypedDict import import TypedDict L91–91
+ time import import time L90–90
+ validate_object_id import import validate_object_id L107–107
~ Any
~ run
← Older Oldest on task/merge-tree-supercharge
All commits
Newer → Latest on task/merge-tree-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:1792b116922d66d9022ba9d4569e2789e647724c2d4dbc512db0c4d07616f8f8 --body "your comment"