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

feat(mv): agent supercharge — TypedDicts, exit_code, duration_ms, JSON error routing

- Add _MvErrorJson TypedDict: status, error, exit_code - Extend _MvResultJson with duration_ms and exit_code fields - 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 (success, dry_run) - Add exit_code: 0 to all success JSON envelopes - Convert all 4 error paths in run() to use _emit_error - Update module docstring with full agent contract (exit_code, duration_ms, error schema) - Fix test_cmd_mv.py: _sha() now returns sha256:-prefixed IDs (unblocks 26 failures) - Add tests/test_mv_supercharge.py: 29 tests across 7 coverage tiers

sha256:89a186c86e72370d9bcea5c5e9d6161c9f109559babe71363ffd71b2c29692cf sha
+67 ~4 symbols
sha256:f57b04b672a6c4e07228c477291f014e8f463550bc13eb7981711d872e6cdbef snapshot
+67
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 71 symbols
~ tests/test_mv_supercharge.py .py 64 symbols added
+ TestDataIntegrity class class TestDataIntegrity L226–269
+ test_object_id_is_sha256_prefixed method method test_object_id_is_sha256_prefixed L227–236
+ test_object_id_matches_staged_entry method method test_object_id_matches_staged_entry L246–254
+ test_source_dest_echoed_verbatim method method test_source_dest_echoed_verbatim L238–244
+ test_staged_only_move_object_id_preserved method method test_staged_only_move_object_id_preserved L256–269
+ TestDocstring class class TestDocstring L334–343
+ _doc method method _doc L335–337
+ test_docstring_documents_duration_ms method method test_docstring_documents_duration_ms L342–343
+ test_docstring_documents_exit_code method method test_docstring_documents_exit_code L339–340
+ TestErrorPayload class class TestErrorPayload L152–218
+ test_dest_already_tracked_error_goes_to_stdout method method test_dest_already_tracked_error_goes_to_stdout L173–180
+ test_dest_exists_on_disk_error_goes_to_stdout method method test_dest_exists_on_disk_error_goes_to_stdout L182–190
+ test_error_payload_has_error_field method method test_error_payload_has_error_field L206–212
+ test_error_payload_has_status_error method method test_error_payload_has_status_error L199–204
+ test_missing_disk_source_error_goes_to_stdout method method test_missing_disk_source_error_goes_to_stdout L163–171
+ test_no_emoji_on_stderr_in_json_mode method method test_no_emoji_on_stderr_in_json_mode L214–218
+ test_path_traversal_error_goes_to_stderr_in_text_mode method method test_path_traversal_error_goes_to_stderr_in_text_mode L192–197
+ test_untracked_source_error_goes_to_stdout method method test_untracked_source_error_goes_to_stdout L153–161
+ TestJsonEnvelopeDurationMs class class TestJsonEnvelopeDurationMs L121–144
+ test_dry_run_has_duration_ms method method test_dry_run_has_duration_ms L131–137
+ test_force_move_has_duration_ms method method test_force_move_has_duration_ms L139–144
+ test_success_has_duration_ms method method test_success_has_duration_ms L122–129
+ TestJsonEnvelopeExitCode class class TestJsonEnvelopeExitCode L88–113
+ test_dry_run_has_exit_code_zero method method test_dry_run_has_exit_code_zero L98–105
+ test_error_payload_has_exit_code_nonzero method method test_error_payload_has_exit_code_nonzero L107–113
+ test_success_has_exit_code_zero method method test_success_has_exit_code_zero L89–96
+ TestNoProsePollution class class TestNoProsePollution L277–295
+ test_dry_run_stdout_is_valid_json method method test_dry_run_stdout_is_valid_json L284–288
+ test_no_emoji_in_success_json method method test_no_emoji_in_success_json L290–295
+ test_success_stdout_is_valid_json method method test_success_stdout_is_valid_json L278–282
+ TestStress class class TestStress L351–371
+ test_50_files_move_all_json method method test_50_files_move_all_json L352–371
+ TestTypedDicts class class TestTypedDicts L303–326
+ test_mv_error_json_has_required_fields method method test_mv_error_json_has_required_fields L322–326
+ test_mv_error_json_typeddict_exists method method test_mv_error_json_typeddict_exists L308–310
+ test_mv_result_json_has_duration_ms_annotation method method test_mv_result_json_has_duration_ms_annotation L317–320
+ test_mv_result_json_has_exit_code_annotation method method test_mv_result_json_has_exit_code_annotation L312–315
+ test_mv_result_json_typeddict_exists method method test_mv_result_json_typeddict_exists L304–306
+ _DT variable variable _DT L31–31
+ _REPO_ID variable variable _REPO_ID L30–30
+ _commit function function _commit L58–75
+ _env function function _env L54–55
+ _init_repo function function _init_repo L43–51
+ _mv function function _mv L78–80
+ _sha function function _sha L39–40
+ CliRunner import import CliRunner L26–26
+ CommitRecord import import CommitRecord L23–23
+ Manifest import import Manifest L24–24
+ SnapshotRecord import import SnapshotRecord L23–23
+ annotations import import annotations L13–13
+ compute_commit_id import import compute_commit_id L22–22
+ compute_snapshot_id import import compute_snapshot_id L22–22
+ datetime import import datetime L15–15
+ get_type_hints import import get_type_hints L19–19
+ hashlib import import hashlib L16–16
+ json import import json L17–17
+ make_entry import import make_entry L25–25
+ pathlib import import pathlib L18–18
+ read_stage import import read_stage L25–25
+ write_commit import import write_commit L23–23
+ write_object import import write_object L21–21
+ write_snapshot import import write_snapshot L23–23
+ write_stage import import write_stage L25–25
+ runner variable variable runner L28–28
~ muse/cli/commands/mv.py .py 3 symbols added, 3 symbols modified
+ _MvErrorJson class class _MvErrorJson L109–113
+ _emit_error function function _emit_error L121–135
+ time import import time L75–75
~ run
~ tests/test_cmd_mv.py .py 1 symbol modified
~ _sha
← Older Oldest on task/mv-supercharge
All commits
Newer → Latest on task/mv-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:89a186c86e72370d9bcea5c5e9d6161c9f109559babe71363ffd71b2c29692cf --body "your comment"