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

feat: supercharge muse verify — elapsed_ms, exit_code, _emit_error, fix sha256 prefix bugs

- muse/core/verify.py: - Import long_id alongside short_id - _rehash_object() now returns long_id(h.hexdigest()) — canonical sha256:-prefixed form so comparison against stored object IDs always succeeds - Orphan snapshot sweep: canonicalize snap_id via long_id(snap_file.stem) so verified_snapshots membership checks work correctly (set contains sha256:-prefixed IDs) - Ref validation: accept sha256:-prefixed commit IDs (strip prefix before hex check) - _MAX_REF_BYTES: 65 → 72 (sha256: prefix + 64 hex + newline)

- muse/cli/commands/verify.py: - Add elapsed_ms (float) and exit_code (int) to every JSON success response - Add _VerifyErrorJson TypedDict for error responses - Add _emit_error() helper: JSON mode → stdout, text mode → stderr, quiet → silent - OSError handling uses _emit_error() with error_key='io_error' and exit_code=3 - Update module docstring with JSON error schema and exit code table

- tests/test_cmd_verify.py: fix _sha() to return long_id(hex) — store requires sha256:-prefixed object IDs - tests/test_cmd_verify_hardening.py: same _sha() fix, long_id for bare hex literals, 72-byte ref size cap - tests/test_cmd_verify_supercharge.py: 43 new tests across U/E/S/D/IO/P/Sec/C tiers

sha256:3b28b74b5628ca362ce6006d8d213a57d179d587be44072f248db22c7b11b02c sha
+88 ~14 symbols
sha256:19f9d16da293653edbf0959ea11d7f89e5183da1d711dbe588053bf632ea977e snapshot
+88
symbols added
~14
symbols modified
0
dead code introduced
Semantic Changes 102 symbols
~ tests/test_cmd_verify_supercharge.py .py 83 symbols added
+ TestConcurrent class class TestConcurrent L528–560
+ test_10_concurrent_reads_all_valid_json method method test_10_concurrent_reads_all_valid_json L529–560
+ TestDataIntegrity class class TestDataIntegrity L316–408
+ test_blob_id_unique_per_content method method test_blob_id_unique_per_content L392–395
+ test_branch_none_when_not_specified method method test_branch_none_when_not_specified L357–361
+ test_branch_reflected_in_json method method test_branch_reflected_in_json L351–355
+ test_check_objects_reflected_false method method test_check_objects_reflected_false L345–349
+ test_check_objects_reflected_true method method test_check_objects_reflected_true L339–343
+ test_counters_non_negative method method test_counters_non_negative L331–337
+ test_elapsed_ms_is_float method method test_elapsed_ms_is_float L386–390
+ test_exit_code_one_iff_all_ok_false method method test_exit_code_one_iff_all_ok_false L323–329
+ test_exit_code_zero_iff_all_ok_true method method test_exit_code_zero_iff_all_ok_true L317–321
+ test_fail_fast_reflected_false method method test_fail_fast_reflected_false L369–373
+ test_fail_fast_reflected_true method method test_fail_fast_reflected_true L363–367
+ test_long_id_round_trips method method test_long_id_round_trips L397–402
+ test_nothing_checked_false_when_commits_exist method method test_nothing_checked_false_when_commits_exist L375–379
+ test_nothing_checked_true_empty_repo method method test_nothing_checked_true_empty_repo L381–384
+ test_short_id_abbreviates method method test_short_id_abbreviates L404–408
+ TestElapsedAndExitCode class class TestElapsedAndExitCode L119–180
+ test_branch_scoped_exit_code_zero method method test_branch_scoped_exit_code_zero L164–171
+ test_clean_repo_elapsed_ms_present method method test_clean_repo_elapsed_ms_present L128–135
+ test_clean_repo_exit_code_zero method method test_clean_repo_exit_code_zero L120–126
+ test_fail_fast_exit_code_one method method test_fail_fast_exit_code_one L173–180
+ test_failures_elapsed_ms_present method method test_failures_elapsed_ms_present L147–153
+ test_failures_exit_code_one method method test_failures_exit_code_one L137–145
+ test_no_objects_exit_code_zero method method test_no_objects_exit_code_zero L155–162
+ TestErrorRouting class class TestErrorRouting L188–253
+ test_io_error_json_no_traceback method method test_io_error_json_no_traceback L231–241
+ test_io_error_json_schema method method test_io_error_json_schema L243–253
+ test_io_error_json_to_stdout method method test_io_error_json_to_stdout L189–203
+ test_io_error_quiet_no_output method method test_io_error_quiet_no_output L218–229
+ test_io_error_text_to_stderr method method test_io_error_text_to_stderr L205–216
+ TestIOErrorHandling class class TestIOErrorHandling L416–449
+ test_exit_code_3_on_io_error_json method method test_exit_code_3_on_io_error_json L417–425
+ test_exit_code_3_on_io_error_text method method test_exit_code_3_on_io_error_text L427–433
+ test_io_error_json_no_stderr method method test_io_error_json_no_stderr L435–441
+ test_io_error_text_has_stderr method method test_io_error_text_has_stderr L443–449
+ TestPerformance class class TestPerformance L457–483
+ test_50_commit_chain_no_objects_faster method method test_50_commit_chain_no_objects_faster L473–483
+ test_50_commit_chain_under_5000ms method method test_50_commit_chain_under_5000ms L464–471
+ test_elapsed_ms_positive method method test_elapsed_ms_positive L458–462
+ TestSchemaCompleteness class class TestSchemaCompleteness L270–308
+ test_all_error_keys_present method method test_all_error_keys_present L283–289
+ test_all_success_keys_present_clean method method test_all_success_keys_present_clean L271–275
+ test_all_success_keys_present_with_failures method method test_all_success_keys_present_with_failures L277–281
+ test_failures_kind_is_documented_literal method method test_failures_kind_is_documented_literal L301–308
+ test_failures_list_schema method method test_failures_list_schema L291–299
+ TestSecurity class class TestSecurity L491–520
+ test_no_raw_exception_in_stdout method method test_no_raw_exception_in_stdout L510–520
+ test_no_traceback_on_json_io_error method method test_no_traceback_on_json_io_error L492–499
+ test_no_traceback_on_text_io_error method method test_no_traceback_on_text_io_error L501–508
+ _ERROR_KEYS variable variable _ERROR_KEYS L267–267
+ _REPO_ID variable variable _REPO_ID L45–45
+ _SUCCESS_KEYS variable variable _SUCCESS_KEYS L260–265
+ _env function function _env L68–69
+ _init_repo function function _init_repo L57–65
+ _invoke function function _invoke L109–111
+ _make_commit function function _make_commit L72–106
+ _sha function function _sha L53–54
+ cli variable variable cli L43–43
+ CliRunner import import CliRunner L34–34
+ CommitRecord import import CommitRecord L39–39
+ InvokeResult import import InvokeResult L34–34
+ SnapshotRecord import import SnapshotRecord L39–39
+ annotations import import annotations L24–24
+ blob_id import import blob_id L36–36
+ compute_commit_id import import compute_commit_id L38–38
+ compute_snapshot_id import import compute_snapshot_id L38–38
+ datetime import import datetime L26–26
+ hashlib import import hashlib L27–27
+ json import import json L28–28
+ long_id import import long_id L36–36
+ mock import import mock L31–31
+ object_path import import object_path L37–37
+ pathlib import import pathlib L29–29
+ pytest import import pytest L33–33
+ run_verify import import run_verify L40–40
+ short_id import import short_id L36–36
+ threading import import threading L30–30
+ write_commit import import write_commit L39–39
+ write_object import import write_object L37–37
+ write_snapshot import import write_snapshot L39–39
+ runner variable variable runner L42–42
~ muse/cli/commands/verify.py .py 2 symbols added, 2 symbols modified
+ _VerifyErrorJson class class _VerifyErrorJson L100–106
+ time import import time L70–70
~ run
~ muse/core/verify.py .py 1 symbol added, 4 symbols modified
+ long_id import import long_id L47–47
~ tests/test_cmd_verify.py .py 1 symbol added, 4 symbols modified
~ tests/test_cmd_verify_hardening.py .py 1 symbol added, 4 symbols modified
← Older Oldest on task/verify-supercharge
All commits
Newer → Latest on task/verify-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:3b28b74b5628ca362ce6006d8d213a57d179d587be44072f248db22c7b11b02c --body "your comment"