gabriel / muse public
feat BREAKING unpack-objects task/supercharge-unpack-objects #1 / 1
AI Agent gabriel · 160 days ago · Apr 18, 2026 · Diff

feat(unpack-objects): supercharge — elapsed_ms, JSON errors to stdout, exit-3, tags_written

- elapsed_ms field in success JSON (renamed from duration_ms for consistency with supercharged tag and trust commands) - _emit_error() helper: JSON mode errors route to stdout so agents always receive parseable output; text mode errors go to stderr - apply_mpack() wrapped in try/except OSError → exit 3 with JSON error (fixes undocumented crash: docstring claimed exit 3 but code never did it) - tags_written added to success JSON and to ApplyResult TypedDict in pack.py (apply_mpack already iterated bundle tags but never counted them) - text-mode output updated to include tags in the summary line - Docstrings updated: error routing contract, JSON error schema, all exit codes - 26 new tests (test_cmd_unpack_objects_supercharge.py): elapsed_ms/exit_code in success JSON, JSON errors to stdout in all error paths, schema completeness, data integrity (exit 1 vs 3 semantics), performance bounds, security (no traceback on any error path including mocked write failures) - Fixed existing test_format_error_to_stderr assertion to match new text output

sha256:0dc4b2f4193752a7ead353f99b281c4420499fddb2cb6cd2e3c356760ae59253 sha
+58 ~5 symbols
sha256:f39a810040d25aa11b63814545952281bba975d0e64515a86ae3e5fa20f4dead snapshot
+58
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 63 symbols
+ TestDataIntegrity class class TestDataIntegrity L312–368
+ test_d1_exit_code_1_for_invalid_msgpack_json_mode method method test_d1_exit_code_1_for_invalid_msgpack_json_mode L315–319
+ test_d2_exit_code_1_for_not_a_dict_json_mode method method test_d2_exit_code_1_for_not_a_dict_json_mode L321–326
+ test_d3_exit_code_3_for_write_failure_json_mode method method test_d3_exit_code_3_for_write_failure_json_mode L328–339
+ test_d4_tags_written_is_zero_for_tagless_pack method method test_d4_tags_written_is_zero_for_tagless_pack L341–351
+ test_d5_success_json_all_count_fields_present method method test_d5_success_json_all_count_fields_present L353–368
+ TestElapsedMsExitCode class class TestElapsedMsExitCode L103–165
+ test_u1_success_json_has_elapsed_ms method method test_u1_success_json_has_elapsed_ms L106–116
+ test_u2_success_json_has_exit_code_zero method method test_u2_success_json_has_exit_code_zero L118–128
+ test_u3_elapsed_ms_is_float method method test_u3_elapsed_ms_is_float L130–140
+ test_u4_elapsed_ms_non_negative method method test_u4_elapsed_ms_non_negative L142–152
+ test_u5_tags_written_in_success_json method method test_u5_tags_written_in_success_json L154–165
+ TestErrorJsonSchema class class TestErrorJsonSchema L253–304
+ _parse_error method method _parse_error L256–257
+ test_s1_corrupted_msgpack_error_schema method method test_s1_corrupted_msgpack_error_schema L259–265
+ test_s2_not_a_dict_error_schema method method test_s2_not_a_dict_error_schema L267–274
+ test_s3_apply_mpack_oserror_schema method method test_s3_apply_mpack_oserror_schema L276–289
+ test_s4_error_elapsed_ms_is_float method method test_s4_error_elapsed_ms_is_float L291–297
+ test_s5_error_exit_code_matches_process_exit method method test_s5_error_exit_code_matches_process_exit L299–304
+ TestJsonErrorsToStdout class class TestJsonErrorsToStdout L173–245
+ test_e1_corrupted_msgpack_json_error_on_stdout method method test_e1_corrupted_msgpack_json_error_on_stdout L176–187
+ test_e2_corrupted_msgpack_error_is_valid_json method method test_e2_corrupted_msgpack_error_is_valid_json L189–197
+ test_e3_not_a_dict_json_error_on_stdout method method test_e3_not_a_dict_json_error_on_stdout L199–207
+ test_e4_apply_mpack_oserror_exit_3_json_on_stdout method method test_e4_apply_mpack_oserror_exit_3_json_on_stdout L209–224
+ test_e5_apply_mpack_oserror_stderr_empty_in_json_mode method method test_e5_apply_mpack_oserror_stderr_empty_in_json_mode L226–237
+ test_e6_text_mode_errors_on_stderr method method test_e6_text_mode_errors_on_stderr L239–245
+ TestPerformance class class TestPerformance L376–405
+ test_p1_elapsed_ms_under_5000ms_for_single_commit method method test_p1_elapsed_ms_under_5000ms_for_single_commit L379–389
+ test_p2_elapsed_ms_under_5000ms_for_five_commit_chain method method test_p2_elapsed_ms_under_5000ms_for_five_commit_chain L391–405
+ TestSecurity class class TestSecurity L413–452
+ test_sec1_no_traceback_on_corrupted_msgpack_json_mode method method test_sec1_no_traceback_on_corrupted_msgpack_json_mode L416–422
+ test_sec2_no_traceback_on_apply_mpack_oserror method method test_sec2_no_traceback_on_apply_mpack_oserror L424–437
+ test_sec3_no_traceback_on_apply_mpack_oserror_text_mode method method test_sec3_no_traceback_on_apply_mpack_oserror_text_mode L439–452
+ _commit function function _commit L57–70
+ _make_pack function function _make_pack L87–95
+ _make_repo function function _make_repo L36–43
+ _po function function _po L77–79
+ _set_head function function _set_head L73–74
+ _snap function function _snap L46–54
+ _uo function function _uo L82–84
+ CliRunner import import CliRunner L26–26
+ CommitRecord import import CommitRecord L24–24
+ ExitCode import import ExitCode L22–22
+ InvokeResult import import InvokeResult L26–26
+ Manifest import import Manifest L25–25
+ SnapshotRecord import import SnapshotRecord L24–24
+ annotations import import annotations L12–12
+ compute_commit_id import import compute_commit_id L23–23
+ compute_snapshot_id import import compute_snapshot_id L23–23
+ datetime import import datetime L14–14
+ json import import json L15–15
+ mock import import mock L17–17
+ msgpack import import msgpack L19–19
+ pathlib import import pathlib L16–16
+ pytest import import pytest L20–20
+ write_commit import import write_commit L24–24
+ write_snapshot import import write_snapshot L24–24
+ runner variable variable runner L28–28
~ muse/cli/commands/unpack_objects.py .py 1 symbol modified
~ run
~ muse/core/pack.py .py 2 symbols modified
← Older Oldest on task/supercharge-unpack-objects
All commits
Newer → Latest on task/supercharge-unpack-objects

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