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

feat(show-ref): add elapsed_ms/exit_code envelope, fix _FAKE_OID sha256: prefix bug

- Add import time + start_time/_elapsed()/_emit_error() closures in run() - Inject elapsed_ms + exit_code into all JSON output paths: listing, --head, --count, --verify (both exists=true and exists=false) - Fix format error: was emitting JSON to stderr (wrong channel, wrong format); now emits plain text to stderr via _emit_error() — consistent with show.py / rev-parse / shortlog pattern - Fix I/O error path: was emitting JSON to stderr; now uses _emit_error() which routes to stdout (--json) or stderr (text) - Update _ShowRefResult TypedDict: add elapsed_ms: float + exit_code: int - Update module docstring: add envelope fields to JSON schema, add error envelope example, extend output contract with elapsed_ms note

test_cmd_show_ref.py — fix 18 pre-existing failures: - _FAKE_OID was bare hex ('a'*64); validate_object_id requires sha256: prefix so every ref written with _FAKE_OID was silently skipped — all ref-listing assertions were testing an empty list - Import long_id from muse.core._types; replace all bare-hex OID constructions with long_id('a'*64), long_id('b'*64), etc. - stress test: long_id((hex_chars[i % 16]) * 64) - test_json_count_zero: drop exact-equality assert (breaks with envelope); use data['count'] == 0 instead - TestShowRefResultSchema: add elapsed_ms + exit_code assertions

test_cmd_show_ref_hardening.py — 21 new tests: - TestElapsedAndExitCode: envelope present on listing, --count, --head, --verify (exists and not-exists paths) - TestErrorJson: format error is plain text on stderr, stdout empty, stderr is not JSON - TestRequiredKeysUpdated: listing schema includes all required keys - TestValidOidFormat: sha256:-prefixed OID listed; bare hex silently skipped

sha256:d745e94c62f7bfb8cc75d139633ddc7b9431d573f07421e4caef1459a6a4e6f6 sha
sha256:c100dd20a6777a76522ed2ef7b8312f038f170800b216c32f2339249a9964446 snapshot
← Older Oldest on task/supercharge-show-ref
All commits
Newer → Latest on task/supercharge-show-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:d745e94c62f7bfb8cc75d139633ddc7b9431d573f07421e4caef1459a6a4e6f6 --body "your comment"