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

feat(trust): supercharge — elapsed_ms, exit_code, IO error handling, count fields, docstrings

All five subcommands (_run_add, _run_remove, _run_list, _run_hub_list, _run_hub_reset): - Add elapsed_ms (float, ms) and exit_code to every JSON success output - _emit_error() helper in add and remove: OSError → JSON error to stdout in JSON mode so agents always receive parseable output regardless of outcome - _run_list: add count field (len(trusted_dirs)) for agent convenience - _run_hub_list: add count field (len(fingerprints)) for agent convenience - Add full function docstrings to all five _run_* functions (were undocumented) - Update module docstring: document JSON error format and exit codes - Add import time

New tests/test_cmd_trust_supercharge.py: 29 tests covering U1-U10 elapsed_ms + exit_code present in every JSON success path E1-E2 OSError → JSON error on stdout (mocked) S1 IO-error JSON schema completeness SC1-SC2 count field in list and hub-list JSON D1-D5 data integrity (path normalisation, idempotency, absent-path exit codes) P1-P2 performance (elapsed_ms is float, < 5000 ms) Sec1-3 security (relative path expansion, dotdot collapse, ANSI safety) C1-C2 concurrency (isolated parallel adds, concurrent TOML reads)

sha256:1294f732fe20f8dc1aa07278313a2033f05a7bd937bfe1a185f6f9b5b795d24c sha
+51 ~5 symbols
sha256:ce089651710ec3025282a1ad939b087128dc0501d3a7e94c84cb68a6bb5d3734 snapshot
+51
symbols added
~5
symbols modified
0
dead code introduced
Semantic Changes 56 symbols
~ tests/test_cmd_trust_supercharge.py .py 50 symbols added
+ TestConcurrency class class TestConcurrency L400–488
+ test_c1_parallel_add_isolated_configs method method test_c1_parallel_add_isolated_configs L401–443
+ test_c2_parallel_list_reads_consistent method method test_c2_parallel_list_reads_consistent L445–488
+ TestDataIntegrity class class TestDataIntegrity L290–337
+ test_d1_relative_path_expanded_in_json method method test_d1_relative_path_expanded_in_json L291–295
+ test_d2_add_idempotent method method test_d2_add_idempotent L297–304
+ test_d3_remove_absent_is_exit_zero method method test_d3_remove_absent_is_exit_zero L306–314
+ test_d4_hub_reset_absent_is_exit_zero method method test_d4_hub_reset_absent_is_exit_zero L316–324
+ test_d5_elapsed_ms_non_negative method method test_d5_elapsed_ms_non_negative L326–337
+ TestElapsedMsExitCode class class TestElapsedMsExitCode L101–167
+ test_u10_hub_reset_has_exit_code method method test_u10_hub_reset_has_exit_code L163–167
+ test_u1_add_has_elapsed_ms method method test_u1_add_has_elapsed_ms L102–107
+ test_u2_add_has_exit_code method method test_u2_add_has_exit_code L109–113
+ test_u3_remove_has_elapsed_ms method method test_u3_remove_has_elapsed_ms L115–121
+ test_u4_remove_has_exit_code method method test_u4_remove_has_exit_code L123–128
+ test_u5_list_has_elapsed_ms method method test_u5_list_has_elapsed_ms L130–135
+ test_u6_list_has_exit_code method method test_u6_list_has_exit_code L137–141
+ test_u7_hub_list_has_elapsed_ms method method test_u7_hub_list_has_elapsed_ms L143–148
+ test_u8_hub_list_has_exit_code method method test_u8_hub_list_has_exit_code L150–154
+ test_u9_hub_reset_has_elapsed_ms method method test_u9_hub_reset_has_elapsed_ms L156–161
+ TestErrorJsonSchema class class TestErrorJsonSchema L225–249
+ test_s1_io_error_schema_complete method method test_s1_io_error_schema_complete L228–249
+ TestIoErrorJsonToStdout class class TestIoErrorJsonToStdout L174–218
+ test_e1_add_io_error_json_on_stdout method method test_e1_add_io_error_json_on_stdout L175–196
+ test_e2_remove_io_error_json_on_stdout method method test_e2_remove_io_error_json_on_stdout L198–218
+ TestPerformance class class TestPerformance L344–365
+ test_p1_elapsed_ms_is_float method method test_p1_elapsed_ms_is_float L345–350
+ test_p2_all_subcommands_under_5000ms method method test_p2_all_subcommands_under_5000ms L352–365
+ TestSchemaCompleteness class class TestSchemaCompleteness L256–283
+ test_sc1_list_count_zero_when_empty method method test_sc1_list_count_zero_when_empty L266–270
+ test_sc1_list_has_count method method test_sc1_list_has_count L257–264
+ test_sc2_hub_list_count_zero_when_empty method method test_sc2_hub_list_count_zero_when_empty L279–283
+ test_sc2_hub_list_has_count method method test_sc2_hub_list_has_count L272–277
+ TestSecurity class class TestSecurity L372–393
+ test_sec1_relative_path_becomes_absolute method method test_sec1_relative_path_becomes_absolute L373–378
+ test_sec2_dotdot_collapsed method method test_sec2_dotdot_collapsed L380–384
+ test_sec3_ansi_in_path_stored_as_literal method method test_sec3_ansi_in_path_stored_as_literal L386–393
+ _CHDIR_LOCK variable variable _CHDIR_LOCK L70–70
+ _add function function _add L93–94
+ _invoke_home function function _invoke_home L77–90
+ CliRunner import import CliRunner L67–67
+ annotations import import annotations L56–56
+ json import import json L58–58
+ os import import os L59–59
+ pathlib import import pathlib L60–60
+ pytest import import pytest L65–65
+ threading import import threading L61–61
+ time import import time L62–62
+ mock import import unittest.mock L63–63
+ runner variable variable runner L69–69
~ muse/cli/commands/trust.py .py 1 symbol added, 5 symbols modified
+ time import import time L45–45
← Older Oldest on task/supercharge-trust
All commits
Newer → Latest on task/supercharge-trust

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