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

feat(read-snapshot): supercharge — _short_id, duration_ms, exit_code, 35 new tests

- Add _short_id(): sha256:<12-hex> (19 chars), prefix always preserved - Fix text format: snapshot_id[:12] → _short_id() — was only 5 hex after prefix - Add duration_ms (float, 3dp) and exit_code (0) to all JSON output paths: full manifest, --no-manifest, --path-prefix, combined --no-manifest + --path-prefix - Update _SnapshotOutput TypedDict: add duration_ms, exit_code fields with docstring documenting file_count semantics under --path-prefix filtering - Expand run() docstring: document --no-manifest + --path-prefix combination, file_count reflects filtered count, updated text format spec - Add tests/test_read_snapshot_supercharge.py: 35 tests covering _short_id unit, duration/exit_code on all output paths, text format short-ID, --no-manifest + --path-prefix flag interaction, data integrity (sha256: prefix, unicode paths, timezone-aware created_at), path prefix edge cases (empty prefix, no trailing slash, exact filename, traversal attempt), performance thresholds - Fix test_cmd_read_snapshot.py: bare-hex missing-snapshot test now uses sha256: prefix so it reaches the store lookup instead of validation rejection

sha256:46466579ba1357bcf85f888fe7d09a099e9bf7a134b7f3cc64599fe399877d86 sha
+66 ~4 symbols
sha256:dad2daca762a21b4efe81aca85db18740b6dc13b96a73b3b6afc42ca0a35cd4f snapshot
+66
symbols added
~4
symbols modified
0
dead code introduced
Semantic Changes 70 symbols
+ TestDataIntegrity class class TestDataIntegrity L250–302
+ test_created_at_iso8601_with_timezone method method test_created_at_iso8601_with_timezone L288–293
+ test_file_count_matches_manifest_length method method test_file_count_matches_manifest_length L295–302
+ test_json_output_is_valid_json method method test_json_output_is_valid_json L258–264
+ test_manifest_values_are_strings method method test_manifest_values_are_strings L266–272
+ test_snapshot_id_has_sha256_prefix method method test_snapshot_id_has_sha256_prefix L251–256
+ test_unicode_paths_in_manifest method method test_unicode_paths_in_manifest L274–286
+ TestDurationAndExitCode class class TestDurationAndExitCode L105–148
+ test_duration_ms_3dp_precision method method test_duration_ms_3dp_precision L130–134
+ test_duration_ms_is_float method method test_duration_ms_is_float L118–122
+ test_duration_ms_non_negative method method test_duration_ms_non_negative L124–128
+ test_duration_ms_present_on_success method method test_duration_ms_present_on_success L106–110
+ test_duration_ms_present_with_no_manifest method method test_duration_ms_present_with_no_manifest L136–141
+ test_duration_ms_present_with_path_prefix method method test_duration_ms_present_with_path_prefix L143–148
+ test_exit_code_zero_on_success method method test_exit_code_zero_on_success L112–116
+ TestFlagInteraction class class TestFlagInteraction L204–242
+ test_no_manifest_plus_path_prefix_file_count_is_filtered method method test_no_manifest_plus_path_prefix_file_count_is_filtered L221–229
+ test_no_manifest_plus_path_prefix_has_duration_ms method method test_no_manifest_plus_path_prefix_has_duration_ms L237–242
+ test_no_manifest_plus_path_prefix_manifest_absent method method test_no_manifest_plus_path_prefix_manifest_absent L231–235
+ test_no_manifest_plus_path_prefix_succeeds method method test_no_manifest_plus_path_prefix_succeeds L211–219
+ TestPathPrefixEdgeCases class class TestPathPrefixEdgeCases L310–346
+ test_empty_prefix_matches_all method method test_empty_prefix_matches_all L311–316
+ test_prefix_exact_filename_match method method test_prefix_exact_filename_match L331–337
+ test_prefix_no_match_empty_manifest_with_duration method method test_prefix_no_match_empty_manifest_with_duration L339–346
+ test_prefix_without_trailing_slash method method test_prefix_without_trailing_slash L318–329
+ TestPerformanceSupercharge class class TestPerformanceSupercharge L380–405
+ test_1000_file_manifest_under_1000ms method method test_1000_file_manifest_under_1000ms L390–398
+ test_duration_ms_plausible method method test_duration_ms_plausible L400–405
+ test_single_read_under_500ms method method test_single_read_under_500ms L381–388
+ TestSecuritySupercharge class class TestSecuritySupercharge L354–372
+ test_no_traceback_on_sha256_prefixed_missing_id method method test_no_traceback_on_sha256_prefixed_missing_id L366–372
+ test_path_prefix_with_traversal_attempt method method test_path_prefix_with_traversal_attempt L355–364
+ TestShortId class class TestShortId L70–97
+ test_short_id_12_hex_chars_after_prefix method method test_short_id_12_hex_chars_after_prefix L78–82
+ test_short_id_bare_hex_fallback method method test_short_id_bare_hex_fallback L89–92
+ test_short_id_keeps_sha256_prefix method method test_short_id_keeps_sha256_prefix L73–76
+ test_short_id_matches_regex method method test_short_id_matches_regex L94–97
+ test_short_id_total_length_is_19 method method test_short_id_total_length_is_19 L84–87
+ TestTextFormatShortId class class TestTextFormatShortId L156–196
+ _short_token method method _short_token L159–163
+ test_text_short_id_has_12_hex_chars method method test_text_short_id_has_12_hex_chars L174–180
+ test_text_short_id_has_sha256_prefix method method test_text_short_id_has_sha256_prefix L165–172
+ test_text_short_id_is_prefix_of_full_id method method test_text_short_id_is_prefix_of_full_id L190–196
+ test_text_short_id_total_length_is_19 method method test_text_short_id_total_length_is_19 L182–188
+ _CREATED_AT variable variable _CREATED_AT L27–27
+ _SHA256_FULL variable variable _SHA256_FULL L29–29
+ _SHA256_SHORT_19 variable variable _SHA256_SHORT_19 L30–30
+ _make_repo function function _make_repo L38–45
+ _oid function function _oid L60–62
+ _rs function function _rs L55–57
+ _snap function function _snap L48–52
+ CliRunner import import CliRunner L23–23
+ ExitCode import import ExitCode L20–20
+ InvokeResult import import InvokeResult L23–23
+ SnapshotRecord import import SnapshotRecord L22–22
+ annotations import import annotations L12–12
+ compute_snapshot_id import import compute_snapshot_id L21–21
+ datetime import import datetime L14–14
+ json import import json L15–15
+ pathlib import import pathlib L16–16
+ re import import re L17–17
+ time import import time L18–18
+ write_snapshot import import write_snapshot L22–22
+ runner variable variable runner L25–25
~ muse/cli/commands/read_snapshot.py .py 2 symbols added, 2 symbols modified
+ _short_id function function _short_id L58–67
+ time import import time L44–44
~ run
← Older Oldest on task/supercharge-read-snapshot
All commits
Newer → Latest on task/supercharge-read-snapshot

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