gabriel / muse public
patch task/supercharge-symbolic-ref #1 / 1
AI Agent gabriel · 160 days ago · Apr 18, 2026 · Diff

supercharge: muse symbolic-ref — elapsed_ms, exit_code, JSON errors to stdout

- Add elapsed_ms (float, ms) and exit_code (int) to _SymbolicRefResult TypedDict - All JSON success paths include elapsed_ms and exit_code - _emit_error(): in JSON mode errors go to stdout; in text mode to stderr - Add register() docstring - Update module docstring with new fields and JSON error schema - Fix 5 pre-existing test failures: stale fake commit IDs (bare hex) now use long_id() to produce sha256:-prefixed IDs that pass read_head() validation - Remove unidiomatic --format xml test inputs; replace with --format bad or unsupported-ref triggers - Update 3 existing tests whose assertions assumed errors went to stderr (now JSON-mode errors go to stdout — consistent with other commands) - 35 new tests: U1-U4, E1-E5, I1-I5, S1-S4, D1-D5, P1-P3, C1-C2

sha256:440d85c4bc6d54efead53e91cc6f68a01871de059fe4e09b7016bd99a0fe3233 sha
+71 ~18 −2 symbols
sha256:77a37935b0438ebde22b610addaf5abc68f9331806ce0c8a355e60bb379eda4d snapshot
+71
symbols added
~18
symbols modified
−2
symbols removed
0
dead code introduced
Semantic Changes 91 symbols
+ TestConcurrent class class TestConcurrent L432–478
+ test_C1_8_concurrent_reads method method test_C1_8_concurrent_reads L433–454
+ test_C2_4_concurrent_writes method method test_C2_4_concurrent_writes L456–478
+ TestDataIntegrity class class TestDataIntegrity L353–389
+ test_D1_elapsed_ms_is_float method method test_D1_elapsed_ms_is_float L354–356
+ test_D2_exit_code_is_int_not_bool method method test_D2_exit_code_is_int_not_bool L358–361
+ test_D3_head_consistent_after_set method method test_D3_head_consistent_after_set L363–369
+ test_D4_detached_commit_id_exact_roundtrip method method test_D4_detached_commit_id_exact_roundtrip L371–380
+ test_D5_write_then_read_roundtrip method method test_D5_write_then_read_roundtrip L382–389
+ TestElapsedAndExitCode class class TestElapsedAndExitCode L136–191
+ test_U1_elapsed_ms_create_branch method method test_U1_elapsed_ms_create_branch L149–153
+ test_U1_elapsed_ms_detached_head method method test_U1_elapsed_ms_detached_head L155–164
+ test_U1_elapsed_ms_read_mode method method test_U1_elapsed_ms_read_mode L137–141
+ test_U1_elapsed_ms_write_mode method method test_U1_elapsed_ms_write_mode L143–147
+ test_U2_exit_code_read_mode method method test_U2_exit_code_read_mode L166–170
+ test_U2_exit_code_write_mode method method test_U2_exit_code_write_mode L172–176
+ test_U3_typeddict_has_elapsed_ms method method test_U3_typeddict_has_elapsed_ms L178–181
+ test_U3_typeddict_has_exit_code method method test_U3_typeddict_has_exit_code L183–186
+ test_U4_commit_id_sha256_prefixed method method test_U4_commit_id_sha256_prefixed L188–191
+ TestIntegration class class TestIntegration L258–313
+ test_I1_detached_head_json_has_all_fields method method test_I1_detached_head_json_has_all_fields L259–273
+ test_I2_write_set_json_has_all_fields method method test_I2_write_set_json_has_all_fields L275–284
+ test_I3_create_branch_json_has_all_fields method method test_I3_create_branch_json_has_all_fields L286–295
+ test_I4_all_read_mode_keys_present method method test_I4_all_read_mode_keys_present L297–303
+ test_I5_all_write_mode_keys_present method method test_I5_all_write_mode_keys_present L305–313
+ TestJsonErrors class class TestJsonErrors L199–250
+ test_E1_bad_format_json_error_to_stdout method method test_E1_bad_format_json_error_to_stdout L200–210
+ test_E2_unsupported_ref_json_error_to_stdout method method test_E2_unsupported_ref_json_error_to_stdout L212–216
+ test_E3_branch_not_found_json_error_to_stdout method method test_E3_branch_not_found_json_error_to_stdout L218–222
+ test_E4_invalid_branch_name_json_error_to_stdout method method test_E4_invalid_branch_name_json_error_to_stdout L224–230
+ test_E5_format_error_has_elapsed_ms method method test_E5_format_error_has_elapsed_ms L246–250
+ test_E5_json_error_has_elapsed_ms method method test_E5_json_error_has_elapsed_ms L232–236
+ test_E5_json_error_has_exit_code method method test_E5_json_error_has_exit_code L238–244
+ TestSecurity class class TestSecurity L321–345
+ test_S1_null_byte_in_set_branch_json_error method method test_S1_null_byte_in_set_branch_json_error L322–327
+ test_S2_path_traversal_in_set_branch_rejected method method test_S2_path_traversal_in_set_branch_rejected L329–335
+ test_S3_ansi_in_set_branch_rejected method method test_S3_ansi_in_set_branch_rejected L337–340
+ test_S4_json_error_values_no_ansi method method test_S4_json_error_values_no_ansi L342–345
+ TestStress class class TestStress L397–424
+ test_P1_100_rapid_reads_all_have_elapsed_ms method method test_P1_100_rapid_reads_all_have_elapsed_ms L398–406
+ test_P2_elapsed_ms_always_positive method method test_P2_elapsed_ms_always_positive L408–411
+ test_P3_20_branch_writes_all_include_elapsed_ms method method test_P3_20_branch_writes_all_include_elapsed_ms L413–424
+ _CHDIR_LOCK variable variable _CHDIR_LOCK L66–66
+ _TS variable variable _TS L65–65
+ _commit function function _commit L101–111
+ _env function function _env L74–75
+ _init_repo function function _init_repo L82–92
+ _snap function function _snap L95–98
+ _sr function function _sr L78–79
+ CliRunner import import CliRunner L57–57
+ CommitRecord import import CommitRecord L60–60
+ SnapshotRecord import import SnapshotRecord L60–60
+ annotations import import annotations L48–48
+ compute_commit_id import import compute_commit_id L59–59
+ compute_snapshot_id import import compute_snapshot_id L59–59
+ datetime import import datetime L61–61
+ json import import json L50–50
+ long_id import import long_id L58–58
+ os import import os L51–51
+ pathlib import import pathlib L52–52
+ pytest import import pytest L55–55
+ threading import import threading L53–53
+ write_commit import import write_commit L60–60
+ write_snapshot import import write_snapshot L60–60
+ repo function function repo L115–119
+ runner variable variable runner L63–63
+ two_branch_repo function function two_branch_repo L123–128
~ muse/cli/commands/symbolic_ref.py .py 1 symbol added, 4 symbols modified
+ time import import time L108–108
~ run
~ tests/test_cmd_symbolic_ref.py .py 3 symbols added, 2 symbols removed, 14 symbols modified
− test_format_error_goes_to_stderr method method test_format_error_goes_to_stderr L398–403
− test_unsupported_ref_rejected method method test_unsupported_ref_rejected L405–410
+ test_format_error_goes_to_stderr_in_text_mode method method test_format_error_goes_to_stderr_in_text_mode L399–404
+ test_unsupported_ref_json_error_to_stdout method method test_unsupported_ref_json_error_to_stdout L406–412
+ long_id import import long_id L31–31
← Older Oldest on task/supercharge-symbolic-ref
All commits
Newer → Latest on task/supercharge-symbolic-ref

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:440d85c4bc6d54efead53e91cc6f68a01871de059fe4e09b7016bd99a0fe3233 --body "your comment"