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

supercharge(merge-base): TypedDicts, exit_code, duration_ms, _emit_error; fix _resolve_ref sha256 bug

- Add _MergeBaseFoundJson, _MergeBaseNotFoundJson, _MergeBaseErrorJson TypedDicts - Add _emit_error(fmt, msg, code): routes errors to stdout as JSON in --json mode, suppresses duplicate stderr prose (fixes agent-breaking bug where all errors went to stderr even in --json mode) - Add t0 = time.monotonic() + duration_ms to both JSON output paths - Add exit_code to both JSON output paths (0 on success/not-found) - Fix _resolve_ref: wrap get_head_commit_id in try/except so sha256:-prefixed commit IDs no longer raise ValueError (validate_branch_name rejects colons) - Remove unused muse_dir variable from run() - Update module docstring: add duration_ms, exit_code, JSON error schema - Add test_merge_base_supercharge.py: 28 tests across envelope, errors, data integrity (symmetry, merge-commit input), TypedDicts, docstring, stress (100-commit) - Fix test_cmd_merge_base_and_snapshot_diff.py: update format_error_to_stderr assertion to match new prose message instead of JSON key name

sha256:ae0d835c182bc1794181d62049a52cdd48270db6a83672011601eb25db9fb3a3 sha
+65 ~4 symbols
sha256:52fed5ba23d95f45267cd53d4ef516991a9b56807c14eda7648fe3c8d8dea57b snapshot
+65
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 69 symbols
~ tests/test_merge_base_supercharge.py .py 59 symbols added
+ TestDataIntegrity class class TestDataIntegrity L237–282
+ test_commit_a_and_b_echoed_correctly method method test_commit_a_and_b_echoed_correctly L268–274
+ test_found_merge_base_is_correct method method test_found_merge_base_is_correct L261–266
+ test_merge_commit_as_input method method test_merge_commit_as_input L248–259
+ test_not_found_merge_base_is_null method method test_not_found_merge_base_is_null L276–282
+ test_symmetry method method test_symmetry L240–246
+ TestDocstring class class TestDocstring L348–357
+ _doc method method _doc L349–351
+ test_docstring_documents_duration_ms method method test_docstring_documents_duration_ms L356–357
+ test_docstring_documents_exit_code method method test_docstring_documents_exit_code L353–354
+ TestErrorPayload class class TestErrorPayload L183–229
+ test_bad_ref_error_has_error_field method method test_bad_ref_error_has_error_field L208–213
+ test_bad_ref_error_has_exit_code method method test_bad_ref_error_has_exit_code L201–206
+ test_bad_ref_error_has_status_error method method test_bad_ref_error_has_status_error L195–199
+ test_bad_ref_error_is_json_on_stdout method method test_bad_ref_error_is_json_on_stdout L186–193
+ test_no_duplicate_stderr_prose method method test_no_duplicate_stderr_prose L215–219
+ test_second_bad_ref_error_is_json_on_stdout method method test_second_bad_ref_error_is_json_on_stdout L221–229
+ TestJsonEnvelopeDurationMs class class TestJsonEnvelopeDurationMs L149–175
+ test_found_has_duration_ms method method test_found_has_duration_ms L152–159
+ test_not_found_has_duration_ms method method test_not_found_has_duration_ms L161–167
+ test_same_commit_has_duration_ms method method test_same_commit_has_duration_ms L169–175
+ TestJsonEnvelopeExitCode class class TestJsonEnvelopeExitCode L114–141
+ test_found_has_exit_code method method test_found_has_exit_code L117–124
+ test_not_found_has_exit_code method method test_not_found_has_exit_code L126–133
+ test_same_commit_has_exit_code method method test_same_commit_has_exit_code L135–141
+ TestNoProsePollution class class TestNoProsePollution L290–309
+ test_found_stdout_is_valid_json method method test_found_stdout_is_valid_json L293–297
+ test_no_emoji_in_found_json method method test_no_emoji_in_found_json L304–309
+ test_not_found_stdout_is_valid_json method method test_not_found_stdout_is_valid_json L299–302
+ TestStress class class TestStress L365–381
+ test_100_commit_linear_chain method method test_100_commit_linear_chain L366–381
+ TestTypedDicts class class TestTypedDicts L317–340
+ test_merge_base_error_json_has_required_fields method method test_merge_base_error_json_has_required_fields L336–340
+ test_merge_base_error_json_typeddict_exists method method test_merge_base_error_json_typeddict_exists L322–324
+ test_merge_base_found_json_has_duration_ms_annotation method method test_merge_base_found_json_has_duration_ms_annotation L331–334
+ test_merge_base_found_json_has_exit_code_annotation method method test_merge_base_found_json_has_exit_code_annotation L326–329
+ test_merge_base_found_json_typeddict_exists method method test_merge_base_found_json_typeddict_exists L318–320
+ _DT variable variable _DT L26–26
+ _commit function function _commit L56–77
+ _diverged_repo function function _diverged_repo L92–99
+ _env function function _env L46–47
+ _init_repo function function _init_repo L34–43
+ _mb function function _mb L87–89
+ _set_branch function function _set_branch L80–84
+ _snap function function _snap L50–53
+ _unrelated_repo function function _unrelated_repo L102–106
+ CliRunner import import CliRunner L22–22
+ CommitRecord import import CommitRecord L21–21
+ SnapshotRecord import import SnapshotRecord L21–21
+ annotations import import annotations L13–13
+ compute_commit_id import import compute_commit_id L20–20
+ compute_snapshot_id import import compute_snapshot_id L20–20
+ datetime import import datetime L15–15
+ get_type_hints import import get_type_hints L18–18
+ json import import json L16–16
+ pathlib import import pathlib L17–17
+ write_commit import import write_commit L21–21
+ write_snapshot import import write_snapshot L21–21
+ runner variable variable runner L24–24
~ muse/cli/commands/merge_base.py .py 6 symbols added, 2 symbols modified
+ _MergeBaseErrorJson class class _MergeBaseErrorJson L92–96
+ _MergeBaseFoundJson class class _MergeBaseFoundJson L73–79
+ _MergeBaseNotFoundJson class class _MergeBaseNotFoundJson L82–89
+ _emit_error function function _emit_error L104–118
+ TypedDict import import TypedDict L55–55
+ time import import time L54–54
~ 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:ae0d835c182bc1794181d62049a52cdd48270db6a83672011601eb25db9fb3a3 --body "your comment"