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

feat(name-rev): agent supercharge — TypedDicts, exit_code, duration_ms, JSON error routing

- Add _NameRevJson TypedDict: results, duration_ms, exit_code - Add _NameRevErrorJson TypedDict: status, error, exit_code - Add _emit_error(fmt, msg, code) — routes errors to stdout JSON in --json mode - Add t0/duration_ms timing; add exit_code: 0 to JSON output envelope - Convert all 5 error paths (bad fmt, bad max_walk, no inputs, invalid hex, I/O error) to use _emit_error - Fix _resolve_prefix: bare hex prefixes now match sha256:-prefixed name_map keys by normalising input to 'sha256:'+hex before prefix matching - Update module docstring: duration_ms, exit_code, error schema, prefix note - Fix test_cmd_name_rev.py: 3 pre-existing failures from sha256: migration (cid[:4] was 'sha2'; _map() keys were bare hex; error assertions vs stderr) - Add tests/test_name_rev_supercharge.py: 28 tests across 7 coverage tiers

sha256:935f7ff6d61a737e1008a02ec2a9a022b3eef24c8325a3217d578d8116eab89c sha
+60 ~15 symbols
sha256:0ca24f065f446a289a4870f449241bea6a0412ce9fb1bef2f584a41d637f2f67 snapshot
+60
symbols added
~15
symbols modified
0
dead code introduced
Semantic Changes 75 symbols
~ tests/test_name_rev_supercharge.py .py 56 symbols added
+ TestDocstring class class TestDocstring L314–323
+ _doc method method _doc L315–317
+ test_docstring_documents_duration_ms method method test_docstring_documents_duration_ms L322–323
+ test_docstring_documents_exit_code method method test_docstring_documents_exit_code L319–320
+ TestErrorPayload class class TestErrorPayload L152–201
+ test_bad_max_walk_error_goes_to_stdout method method test_bad_max_walk_error_goes_to_stdout L169–176
+ test_error_payload_has_error_field method method test_error_payload_has_error_field L191–196
+ test_error_payload_has_exit_code method method test_error_payload_has_exit_code L184–189
+ test_error_payload_has_status_error method method test_error_payload_has_status_error L178–182
+ test_invalid_hex_error_goes_to_stdout method method test_invalid_hex_error_goes_to_stdout L161–167
+ test_no_emoji_on_stderr_in_json_mode method method test_no_emoji_on_stderr_in_json_mode L198–201
+ test_no_inputs_error_goes_to_stdout method method test_no_inputs_error_goes_to_stdout L153–159
+ TestJsonEnvelopeDurationMs class class TestJsonEnvelopeDurationMs L121–144
+ test_branches_filter_has_duration_ms method method test_branches_filter_has_duration_ms L138–144
+ test_found_has_duration_ms method method test_found_has_duration_ms L122–129
+ test_undefined_has_duration_ms method method test_undefined_has_duration_ms L131–136
+ TestJsonEnvelopeExitCode class class TestJsonEnvelopeExitCode L85–113
+ test_found_has_exit_code_zero method method test_found_has_exit_code_zero L86–93
+ test_mixed_found_and_undefined_exit_code_zero method method test_mixed_found_and_undefined_exit_code_zero L106–113
+ test_undefined_result_still_exit_code_zero method method test_undefined_result_still_exit_code_zero L95–104
+ TestNoProsePollution class class TestNoProsePollution L258–275
+ test_found_stdout_is_valid_json method method test_found_stdout_is_valid_json L259–263
+ test_no_emoji_in_success_json method method test_no_emoji_in_success_json L270–275
+ test_undefined_stdout_is_valid_json method method test_undefined_stdout_is_valid_json L265–268
+ TestPrefixResolutionSha256 class class TestPrefixResolutionSha256 L209–250
+ test_bare_hex_4char_prefix_resolves method method test_bare_hex_4char_prefix_resolves L221–231
+ test_bare_hex_8char_prefix_resolves method method test_bare_hex_8char_prefix_resolves L210–219
+ test_input_field_preserves_bare_hex_prefix method method test_input_field_preserves_bare_hex_prefix L243–250
+ test_sha256_prefixed_short_id_resolves method method test_sha256_prefixed_short_id_resolves L233–241
+ TestStress class class TestStress L331–352
+ test_100_commit_chain_all_have_envelope_fields method method test_100_commit_chain_all_have_envelope_fields L332–352
+ TestTypedDicts class class TestTypedDicts L283–306
+ test_name_rev_error_json_has_required_fields method method test_name_rev_error_json_has_required_fields L302–306
+ test_name_rev_error_json_typeddict_exists method method test_name_rev_error_json_typeddict_exists L288–290
+ test_name_rev_json_has_duration_ms_annotation method method test_name_rev_json_has_duration_ms_annotation L297–300
+ test_name_rev_json_has_exit_code_annotation method method test_name_rev_json_has_exit_code_annotation L292–295
+ test_name_rev_json_typeddict_exists method method test_name_rev_json_typeddict_exists L284–286
+ _DT variable variable _DT L26–26
+ _commit function function _commit L49–67
+ _env function function _env L45–46
+ _hex_prefix function function _hex_prefix L75–77
+ _init_repo function function _init_repo L34–42
+ _nr function function _nr L70–72
+ 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/name_rev.py .py 4 symbols added, 2 symbols modified
+ _NameRevErrorJson class class _NameRevErrorJson L141–145
+ _NameRevJson class class _NameRevJson L134–138
+ _emit_error function function _emit_error L148–162
+ time import import time L107–107
~ run
← Older Oldest on task/name-rev-supercharge
All commits
Newer → Latest on task/name-rev-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:935f7ff6d61a737e1008a02ec2a9a022b3eef24c8325a3217d578d8116eab89c --body "your comment"