gabriel / muse public
patch dev
AI Agent gabriel · 163 days ago · Apr 17, 2026 · Diff

supercharge(merge): add TypedDicts, exit_code, duration_ms, unified _emit_error

- Add _MergeJson and _MergeErrorJson TypedDicts for stable wire-format documentation - Add _emit_error(fmt, msg, code): routes errors to stdout as JSON in --json mode, suppresses duplicate stderr prose (fixes self-merge dual-emit bug) - Add t0 = time.monotonic() at _run_merge entry; add duration_ms to all 5 JSON output paths (up_to_date, fast_forward, strategy-merge, conflict, three-way) - Add exit_code to all outcome JSON envelopes (0 on success, non-zero on conflict) - Fix no-branch, format-invalid, autoshelf+force error paths to use _emit_error - Update module docstring to document exit_code, duration_ms, and JSON error schema - Fix pre-existing test failures: sha256: prefix in write_object helpers - Add test_merge_supercharge.py: 29 tests covering envelope, errors, TypedDicts, docstring

sha256:f2a2b09a30de3f2f94bb7f77cd09ae5676409035f4de11c6590e233342aff5b6 sha
+67 ~5 symbols
sha256:26d309feba66ba0bbd82fde85962ec71d5a50508976f63422c0b40600aa02d4f snapshot
+67
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 72 symbols
~ tests/test_merge_supercharge.py .py 62 symbols added
+ TestDocstring class class TestDocstring L357–366
+ _doc method method _doc L358–360
+ test_docstring_documents_duration_ms method method test_docstring_documents_duration_ms L365–366
+ test_docstring_documents_exit_code method method test_docstring_documents_exit_code L362–363
+ TestErrorPayload class class TestErrorPayload L242–293
+ test_error_payload_has_error_field method method test_error_payload_has_error_field L280–285
+ test_error_payload_has_exit_code method method test_error_payload_has_exit_code L273–278
+ test_error_payload_has_status_error method method test_error_payload_has_status_error L267–271
+ test_no_branch_error_is_json method method test_no_branch_error_is_json L245–250
+ test_self_merge_error_is_json method method test_self_merge_error_is_json L252–258
+ test_self_merge_no_duplicate_stderr_prose method method test_self_merge_no_duplicate_stderr_prose L260–265
+ test_unknown_branch_error_is_json method method test_unknown_branch_error_is_json L287–293
+ TestJsonEnvelopeDurationMs class class TestJsonEnvelopeDurationMs L199–235
+ test_conflict_has_duration_ms method method test_conflict_has_duration_ms L224–229
+ test_dry_run_has_duration_ms method method test_dry_run_has_duration_ms L231–235
+ test_fast_forward_has_duration_ms method method test_fast_forward_has_duration_ms L210–215
+ test_three_way_clean_has_duration_ms method method test_three_way_clean_has_duration_ms L217–222
+ test_up_to_date_has_duration_ms method method test_up_to_date_has_duration_ms L202–208
+ TestJsonEnvelopeExitCode class class TestJsonEnvelopeExitCode L153–196
+ test_conflict_has_exit_code method method test_conflict_has_exit_code L177–182
+ test_dry_run_conflict_has_exit_code method method test_dry_run_conflict_has_exit_code L191–196
+ test_dry_run_merged_has_exit_code method method test_dry_run_merged_has_exit_code L184–189
+ test_fast_forward_has_exit_code method method test_fast_forward_has_exit_code L163–168
+ test_three_way_clean_has_exit_code method method test_three_way_clean_has_exit_code L170–175
+ test_up_to_date_has_exit_code method method test_up_to_date_has_exit_code L156–161
+ TestNoProsePollution class class TestNoProsePollution L300–320
+ test_fast_forward_stdout_valid_json method method test_fast_forward_stdout_valid_json L306–309
+ test_merged_stdout_valid_json method method test_merged_stdout_valid_json L311–314
+ test_no_emoji_in_merged_json method method test_no_emoji_in_merged_json L316–320
+ test_up_to_date_stdout_valid_json method method test_up_to_date_stdout_valid_json L301–304
+ TestTypedDicts class class TestTypedDicts L327–350
+ test_merge_error_json_has_required_fields method method test_merge_error_json_has_required_fields L346–350
+ test_merge_error_json_typeddict_exists method method test_merge_error_json_typeddict_exists L332–334
+ test_merge_json_has_duration_ms_annotation method method test_merge_json_has_duration_ms_annotation L341–344
+ test_merge_json_has_exit_code_annotation method method test_merge_json_has_exit_code_annotation L336–339
+ test_merge_json_typeddict_exists method method test_merge_json_typeddict_exists L328–330
+ _conflict_repo function function _conflict_repo L132–146
+ _env function function _env L37–38
+ _ff_repo function function _ff_repo L104–111
+ _init_repo function function _init_repo L41–54
+ _make_commit function function _make_commit L57–79
+ _merge function function _merge L88–90
+ _sha function function _sha L33–34
+ _three_way_clean_repo function function _three_way_clean_repo L114–129
+ _up_to_date_repo function function _up_to_date_repo L97–101
+ _write_obj function function _write_obj L82–85
+ CliRunner import import CliRunner L24–24
+ CommitRecord import import CommitRecord L23–23
+ SnapshotRecord import import SnapshotRecord L23–23
+ annotations import import annotations L12–12
+ compute_commit_id import import compute_commit_id L22–22
+ compute_snapshot_id import import compute_snapshot_id L22–22
+ datetime import import datetime L14–14
+ get_type_hints import import get_type_hints L19–19
+ hashlib import import hashlib L15–15
+ json import import json L16–16
+ pathlib import import pathlib L17–17
+ uuid import import uuid L18–18
+ write_commit import import write_commit L23–23
+ write_object import import write_object L21–21
+ write_snapshot import import write_snapshot L23–23
+ runner variable variable runner L26–26
~ muse/cli/commands/merge.py .py 5 symbols added, 2 symbols modified
+ _MergeErrorJson class class _MergeErrorJson L126–130
+ _MergeJson class class _MergeJson L110–123
+ _emit_error function function _emit_error L133–147
+ TypedDict import import TypedDict L64–64
+ time import import time L63–63
~ run
← 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:f2a2b09a30de3f2f94bb7f77cd09ae5676409035f4de11c6590e233342aff5b6 --body "your comment"