gabriel / muse public
feat minor hub feat/label-crud-cli-tests #1 / 1
gabriel · 160 days ago · Apr 10, 2026 · Diff

feat(hub): add label CRUD subcommands and hardening tests

- Add `muse hub label create/list/update/delete` with full input validation - Validate color as 7-char hex (#xxxxxx) before any network I/O - Validate name length (≤50) and description length (≤200) - update/delete resolve label UUID by name via GET /labels lookup - 41 new hardening tests: validation, security (ANSI/XSS), text+JSON output

sha256:6e2eca81eb3d7065fef2f3101ce2627f6de50ec41ff32a3a62db111a4e9166d5 sha
+58 ~1 symbols
sha256:382a1229564ad4d407173d9e99389fddcb84133dfb1e751554a0897325bd59c0 snapshot
+58
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 59 symbols
~ muse/cli/commands/hub.py .py 9 symbols added, 1 symbol modified
+ _LabelEntry class class _LabelEntry L228–235
+ _MAX_LABEL_DESC_LEN variable variable _MAX_LABEL_DESC_LEN L132–132
+ _MAX_LABEL_NAME_LEN variable variable _MAX_LABEL_NAME_LEN L131–131
+ _lookup_label_by_name function function _lookup_label_by_name L2440–2459
+ _validate_hex_color function function _validate_hex_color L2425–2437
+ run_label_create function function run_label_create L2462–2524
+ run_label_delete function function run_label_delete L2669–2714
+ run_label_list function function run_label_list L2527–2569
+ run_label_update function function run_label_update L2572–2666
~ tests/test_cmd_hub_hardening.py .py 49 symbols added
+ TestLabelCreateHardening class class TestLabelCreateHardening L7227–7401
+ test_ansi_in_name_sanitized_in_error method method test_ansi_in_name_sanitized_in_error L7391–7401
+ test_description_too_long_exits_nonzero_no_network method method test_description_too_long_exits_nonzero_no_network L7325–7344
+ test_empty_name_error_message method method test_empty_name_error_message L7243–7253
+ test_empty_name_exits_nonzero_no_network method method test_empty_name_exits_nonzero_no_network L7230–7241
+ test_invalid_color_no_hash_exits_nonzero method method test_invalid_color_no_hash_exits_nonzero L7286–7297
+ test_invalid_color_non_hex_exits_nonzero method method test_invalid_color_non_hex_exits_nonzero L7312–7323
+ test_invalid_color_wrong_length_exits_nonzero method method test_invalid_color_wrong_length_exits_nonzero L7299–7310
+ test_name_at_max_length_accepted method method test_name_at_max_length_accepted L7270–7284
+ test_name_too_long_exits_nonzero_no_network method method test_name_too_long_exits_nonzero_no_network L7255–7268
+ test_success_json_output method method test_success_json_output L7346–7358
+ test_success_text_output_prints_id method method test_success_text_output_prints_id L7360–7371
+ test_with_description_accepted method method test_with_description_accepted L7373–7389
+ TestLabelDeleteHardening class class TestLabelDeleteHardening L7616–7673
+ test_ansi_in_name_sanitized_in_not_found_error method method test_ansi_in_name_sanitized_in_not_found_error L7661–7673
+ test_empty_name_exits_nonzero_no_network method method test_empty_name_exits_nonzero_no_network L7619–7626
+ test_label_not_found_exits_nonzero method method test_label_not_found_exits_nonzero L7628–7638
+ test_success_exits_zero method method test_success_exits_zero L7640–7648
+ test_success_json_output method method test_success_json_output L7650–7659
+ TestLabelListHardening class class TestLabelListHardening L7409–7476
+ test_empty_list_prints_no_labels_message method method test_empty_list_prints_no_labels_message L7436–7444
+ test_json_items_contain_expected_fields method method test_json_items_contain_expected_fields L7423–7434
+ test_json_output_is_array method method test_json_output_is_array L7412–7421
+ test_multiple_labels_all_shown method method test_multiple_labels_all_shown L7460–7476
+ test_text_output_contains_color_and_name method method test_text_output_contains_color_and_name L7446–7458
+ TestLabelSecurity class class TestLabelSecurity L7719–7777
+ test_create_color_injection_attempt method method test_create_color_injection_attempt L7722–7733
+ test_create_name_xss_attempt_sanitized method method test_create_name_xss_attempt_sanitized L7735–7746
+ test_label_name_255_spaces_rejected method method test_label_name_255_spaces_rejected L7748–7759
+ test_update_ansi_in_new_name_sanitized_in_error method method test_update_ansi_in_new_name_sanitized_in_error L7761–7777
+ TestLabelSubparserRegistration class class TestLabelSubparserRegistration L7681–7711
+ test_label_constants_imported method method test_label_constants_imported L7700–7703
+ test_label_create_in_help method method test_label_create_in_help L7684–7686
+ test_label_delete_in_help method method test_label_delete_in_help L7696–7698
+ test_label_list_in_help method method test_label_list_in_help L7688–7690
+ test_label_update_in_help method method test_label_update_in_help L7692–7694
+ test_validate_hex_color_imported method method test_validate_hex_color_imported L7705–7711
+ TestLabelUpdateHardening class class TestLabelUpdateHardening L7484–7608
+ test_empty_current_name_exits_nonzero method method test_empty_current_name_exits_nonzero L7504–7514
+ test_invalid_new_color_exits_nonzero_no_network method method test_invalid_new_color_exits_nonzero_no_network L7516–7526
+ test_label_not_found_exits_nonzero method method test_label_not_found_exits_nonzero L7542–7554
+ test_new_name_too_long_exits_nonzero_no_network method method test_new_name_too_long_exits_nonzero_no_network L7528–7540
+ test_no_fields_error_message method method test_no_fields_error_message L7496–7502
+ test_no_fields_exits_nonzero_no_network method method test_no_fields_exits_nonzero_no_network L7487–7494
+ test_success_recolor_json_output method method test_success_recolor_json_output L7576–7594
+ test_success_rename_json_output method method test_success_rename_json_output L7556–7574
+ test_success_text_output method method test_success_text_output L7596–7608
+ _label_list_resp function function _label_list_resp L7216–7219
+ _label_resp function function _label_resp L7200–7213
← Older Oldest on feat/label-crud-cli-tests
All commits
Newer → Latest on feat/label-crud-cli-tests

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:6e2eca81eb3d7065fef2f3101ce2627f6de50ec41ff32a3a62db111a4e9166d5 --body "your comment"