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

feat(read-commit): supercharge — _short_id, duration_ms, exit_code, 31 new tests

- Add _short_id() helper: sha256:<12-hex> (19 chars), prefix always preserved - Fix text format: commit_id[:12] → _short_id() — was only 5 hex after prefix - Add duration_ms (float, 3dp, ms) and exit_code (0) to all JSON success output - duration_ms / exit_code are command metadata — not commit fields; always present even when --fields filters the commit record - Add tests/test_read_commit_supercharge.py: 31 tests covering _short_id unit, duration/exit_code, text format short-ID, data integrity (sha256: on all ID fields), edge cases (HEAD~N depth, unknown branch, --fields empty/duplicate), merge commit parent2, performance threshold - Update test_cmd_read_commit.py: 3 --fields tests that asserted exact key sets now strip duration_ms/exit_code before comparing

sha256:cffcfd57ffbac5104bd6ff4dfb85cae4bb1d8dd14b9535310c9362c7dfa24e0e sha
+66 ~5 symbols
sha256:1d7aa516387a11a4968bf89fa487bab91c6539b496613de64e04d5d5c5568cb5 snapshot
+66
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 71 symbols
~ tests/test_read_commit_supercharge.py .py 64 symbols added
+ TestDataIntegrity class class TestDataIntegrity L251–301
+ test_commit_id_has_sha256_prefix method method test_commit_id_has_sha256_prefix L252–257
+ test_json_output_is_valid_json method method test_json_output_is_valid_json L274–281
+ test_message_with_special_chars_in_json method method test_message_with_special_chars_in_json L283–292
+ test_message_with_unicode_in_json method method test_message_with_unicode_in_json L294–301
+ test_parent_commit_id_has_sha256_prefix method method test_parent_commit_id_has_sha256_prefix L266–272
+ test_snapshot_id_has_sha256_prefix method method test_snapshot_id_has_sha256_prefix L259–264
+ TestDurationAndExitCode class class TestDurationAndExitCode L143–189
+ test_duration_ms_3dp_precision method method test_duration_ms_3dp_precision L182–189
+ test_duration_ms_is_float method method test_duration_ms_is_float L156–160
+ test_duration_ms_non_negative method method test_duration_ms_non_negative L162–166
+ test_duration_ms_present_on_success method method test_duration_ms_present_on_success L144–148
+ test_exit_code_zero_on_success method method test_exit_code_zero_on_success L150–154
+ test_fields_filter_preserves_duration_ms method method test_fields_filter_preserves_duration_ms L168–173
+ test_fields_filter_preserves_exit_code method method test_fields_filter_preserves_exit_code L175–180
+ TestFieldsEdgeCases class class TestFieldsEdgeCases L309–336
+ test_fields_duplicate_deduplicated method method test_fields_duplicate_deduplicated L319–328
+ test_fields_empty_string_errors method method test_fields_empty_string_errors L310–317
+ test_fields_whitespace_only_errors method method test_fields_whitespace_only_errors L330–336
+ TestMergeCommit class class TestMergeCommit L368–388
+ test_parent2_commit_id_in_json_output method method test_parent2_commit_id_in_json_output L369–378
+ test_parent2_has_sha256_prefix method method test_parent2_has_sha256_prefix L380–388
+ TestPerformance class class TestPerformance L396–413
+ test_duration_ms_in_output_plausible method method test_duration_ms_in_output_plausible L407–413
+ test_single_read_under_500ms method method test_single_read_under_500ms L397–405
+ TestShortId class class TestShortId L105–135
+ test_short_id_12_hex_chars_after_prefix method method test_short_id_12_hex_chars_after_prefix L113–117
+ test_short_id_bare_hex_fallback method method test_short_id_bare_hex_fallback L125–130
+ test_short_id_keeps_sha256_prefix method method test_short_id_keeps_sha256_prefix L108–111
+ test_short_id_matches_regex method method test_short_id_matches_regex L132–135
+ test_short_id_total_length_is_19 method method test_short_id_total_length_is_19 L119–123
+ TestSymbolicRefEdgeCases class class TestSymbolicRefEdgeCases L344–360
+ test_head_tilde_exceeds_chain_depth_errors method method test_head_tilde_exceeds_chain_depth_errors L345–352
+ test_unknown_branch_name_errors method method test_unknown_branch_name_errors L354–360
+ TestTextFormatShortId class class TestTextFormatShortId L197–243
+ _short_token method method _short_token L200–205
+ test_text_short_id_has_12_hex_chars method method test_text_short_id_has_12_hex_chars L217–225
+ test_text_short_id_has_sha256_prefix method method test_text_short_id_has_sha256_prefix L207–215
+ test_text_short_id_is_prefix_of_full_id method method test_text_short_id_is_prefix_of_full_id L236–243
+ test_text_short_id_total_length_is_19 method method test_text_short_id_total_length_is_19 L227–234
+ _COMMITTED_AT variable variable _COMMITTED_AT L30–30
+ _SHA256_FULL variable variable _SHA256_FULL L32–32
+ _SHA256_SHORT_19 variable variable _SHA256_SHORT_19 L33–33
+ _SNAP_ID variable variable _SNAP_ID L29–29
+ _commit function function _commit L51–88
+ _make_repo function function _make_repo L41–48
+ _rc function function _rc L91–97
+ CliRunner import import CliRunner L25–25
+ CommitRecord import import CommitRecord L24–24
+ ExitCode import import ExitCode L22–22
+ InvokeResult import import InvokeResult 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
+ pathlib import import pathlib L16–16
+ pytest import import pytest L20–20
+ re import import re L17–17
+ time import import time L18–18
+ write_commit import import write_commit L24–24
+ write_snapshot import import write_snapshot L24–24
+ runner variable variable runner L27–27
~ muse/cli/commands/read_commit.py .py 2 symbols added, 1 symbol modified
+ _short_id function function _short_id L77–86
+ time import import time L52–52
~ run
← Older Oldest on task/supercharge-read-commit
All commits
Newer → Latest on task/supercharge-read-commit

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