gabriel / muse public
feat BREAKING gc task/gc-supercharge-json-agent #1 / 1
AI Agent gabriel · 163 days ago · Apr 17, 2026 · Diff

feat(gc): supercharge JSON schema for agent-readiness

- Add status (ok|error), error, warnings, mode, exit_code fields to --json output - Replace elapsed_seconds with duration_ms (milliseconds, float) for consistency - Add collected_commit_ids and collected_snapshot_ids lists (populated by --full) - Structured JSON error response when --grace-period < 0 in --json mode - GcResult.warnings captures logger.warning() calls via _WarningCapture handler - mode: 'conservative' (default) | 'tight' (--full) communicates reachability strategy - Extract _run_gc_inner() to cleanly wrap warning capture in run_gc() - 33 new TDD tests (test_gc_supercharge_json.py) — all green

sha256:658b27c22adbc07d28a88375c4400231fbc35071b6f67abb495a1818adc94280 sha
+56 ~9 −1 symbols
sha256:045b811b20c4b31d647d586a40800738bc6bf74bc89781a8c55cad8d6740a160 snapshot
+56
symbols added
~9
symbols modified
−1
symbol removed
0
dead code introduced
Semantic Changes 66 symbols
~ tests/test_gc_supercharge_json.py .py 54 symbols added
+ TestGcJsonBadArgs class class TestGcJsonBadArgs L293–357
+ test_bad_grace_period_json_error_field_non_empty method method test_bad_grace_period_json_error_field_non_empty L320–330
+ test_bad_grace_period_json_error_mentions_grace_period method method test_bad_grace_period_json_error_mentions_grace_period L332–344
+ test_bad_grace_period_json_has_exit_code method method test_bad_grace_period_json_has_exit_code L346–357
+ test_bad_grace_period_json_mode_emits_json method method test_bad_grace_period_json_mode_emits_json L307–318
+ test_bad_grace_period_json_mode_exit_code_1 method method test_bad_grace_period_json_mode_exit_code_1 L296–305
+ TestGcJsonCollectedIds class class TestGcJsonCollectedIds L252–286
+ test_collected_commit_ids_conservative_mode_always_empty method method test_collected_commit_ids_conservative_mode_always_empty L271–278
+ test_collected_commit_ids_empty_when_all_reachable method method test_collected_commit_ids_empty_when_all_reachable L255–261
+ test_collected_snapshot_ids_conservative_mode_always_empty method method test_collected_snapshot_ids_conservative_mode_always_empty L280–286
+ test_collected_snapshot_ids_empty_when_all_reachable method method test_collected_snapshot_ids_empty_when_all_reachable L263–269
+ TestGcJsonDurationMs class class TestGcJsonDurationMs L197–225
+ test_duration_ms_is_float method method test_duration_ms_is_float L206–210
+ test_duration_ms_non_negative method method test_duration_ms_non_negative L212–216
+ test_duration_ms_present method method test_duration_ms_present L200–204
+ test_elapsed_seconds_absent method method test_elapsed_seconds_absent L218–225
+ TestGcJsonExitCode class class TestGcJsonExitCode L408–428
+ test_exit_code_zero_on_success method method test_exit_code_zero_on_success L411–415
+ test_exit_code_zero_with_dry_run method method test_exit_code_zero_with_dry_run L417–422
+ test_exit_code_zero_with_full method method test_exit_code_zero_with_full L424–428
+ TestGcJsonMode class class TestGcJsonMode L232–245
+ test_mode_conservative_by_default method method test_mode_conservative_by_default L235–239
+ test_mode_tight_with_full_flag method method test_mode_tight_with_full_flag L241–245
+ TestGcJsonSchema class class TestGcJsonSchema L111–190
+ test_collected_commit_ids_is_list method method test_collected_commit_ids_is_list L180–184
+ test_collected_commit_ids_present method method test_collected_commit_ids_present L168–172
+ test_collected_snapshot_ids_is_list method method test_collected_snapshot_ids_is_list L186–190
+ test_collected_snapshot_ids_present method method test_collected_snapshot_ids_present L174–178
+ test_error_empty_on_success method method test_error_empty_on_success L132–136
+ test_error_field_present method method test_error_field_present L126–130
+ test_exit_code_field_present method method test_exit_code_field_present L162–166
+ test_mode_field_present method method test_mode_field_present L156–160
+ test_status_field_present method method test_status_field_present L114–118
+ test_status_ok_on_success method method test_status_ok_on_success L120–124
+ test_warnings_empty_on_clean_run method method test_warnings_empty_on_clean_run L150–154
+ test_warnings_field_present method method test_warnings_field_present L138–142
+ test_warnings_is_list method method test_warnings_is_list L144–148
+ TestGcJsonWarnings class class TestGcJsonWarnings L364–401
+ test_symlink_object_file_skip_adds_warning method method test_symlink_object_file_skip_adds_warning L367–381
+ test_symlink_snapshot_file_warning method method test_symlink_snapshot_file_warning L386–401
+ _gc_json function function _gc_json L100–104
+ _init_repo function function _init_repo L49–64
+ _make_commit function function _make_commit L75–97
+ _write_object function function _write_object L67–72
+ cli variable variable cli L42–42
+ CliRunner import import CliRunner L39–39
+ annotations import import annotations L29–29
+ datetime import import datetime L31–31
+ hashlib import import hashlib L32–32
+ json import import json L33–33
+ pathlib import import pathlib L34–34
+ pytest import import pytest L37–37
+ uuid import import uuid L35–35
+ runner variable variable runner L41–41
~ muse/cli/commands/gc.py .py 2 symbols modified
~ run
~ muse/core/gc.py .py 1 symbol added, 2 symbols modified
+ _run_gc_inner function function _run_gc_inner L519–633
~ run_gc
~ tests/test_cmd_gc_hardening.py .py 1 symbol added, 1 symbol removed, 5 symbols modified
− test_elapsed_seconds_is_non_negative method method test_elapsed_seconds_is_non_negative L398–402
+ test_duration_ms_is_non_negative method method test_duration_ms_is_non_negative L398–402
← Older Oldest on task/gc-supercharge-json-agent
All commits
Newer → Latest on task/gc-supercharge-json-agent

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:658b27c22adbc07d28a88375c4400231fbc35071b6f67abb495a1818adc94280 --body "your comment"