gabriel / musehub public
feat patch intel/clones task/intel-clones-ui #3 / 3
AI Agent gabriel · 140 days ago · May 3, 2026 · Diff

feat(intel/clones): Phase 1 — route handlers, helpers, dashboard context, unit tests

Add intel_clones_page and intel_clones_detail_page to ui_intel.py: - 6 pure helper functions (_cl_tier_class, _cl_language_set, _cl_file_count, _cl_is_cross_file, _cl_parse_members, _cl_files_breakdown) with full Google- style docstrings covering purpose, params, returns, edge cases, and design why - intel_clones_page: tier + top filters, per-row language/file/cross-file derivation, repo-wide file hotspot aggregation, no subprocess at request time - intel_clones_detail_page: single cluster lookup, member parsing, file breakdown - intel_dashboard_page: adds clones_count, clones_symbols, clones_preview context (top 5 by member_count, same pattern as velocity card) - tests/test_clones_unit.py: 31 unit tests across all 6 helpers (Tier 1 TDD)

sha256:1dbf1e00707f552e435adca80a6585a842ac0215f7851de0e1d4e28ea2cf3944 sha
+61 ~1 symbols
2 changed · 732 in snapshot files
sha256:770221185d4d2de164e6644183beb25b46222604d0e4b5fa4e3e4abc12464bd2 snapshot
+61
symbols added
~1
symbol modified
2
files changed
732
files in snapshot
0
dead code introduced
Semantic Changes 62 symbols
~ tests/test_clones_unit.py .py 51 symbols added
+ TestClFileCount class class TestClFileCount L117–146
+ test_U08_cross_file_fixture_returns_correct_count method method test_U08_cross_file_fixture_returns_correct_count L120–122
+ test_U09_one_file_returns_one method method test_U09_one_file_returns_one L124–125
+ test_U10_blank_input_returns_zero method method test_U10_blank_input_returns_zero L127–128
+ test_empty_array_returns_zero method method test_empty_array_returns_zero L133–134
+ test_invalid_json_returns_zero method method test_invalid_json_returns_zero L130–131
+ test_no_double_colon_uses_whole_address_as_file method method test_no_double_colon_uses_whole_address_as_file L136–138
+ test_three_files method method test_three_files L140–146
+ TestClFilesBreakdown class class TestClFilesBreakdown L214–252
+ test_empty_members_returns_empty_list method method test_empty_members_returns_empty_list L245–246
+ test_groups_by_file method method test_groups_by_file L217–222
+ test_pct_100_for_largest_file method method test_pct_100_for_largest_file L236–243
+ test_single_file_100_pct method method test_single_file_100_pct L248–252
+ test_sorted_by_count_descending method method test_sorted_by_count_descending L224–234
+ TestClIsCrossFile class class TestClIsCrossFile L154–168
+ test_U11_two_files_is_cross_file method method test_U11_two_files_is_cross_file L157–158
+ test_U12_one_file_is_not_cross_file method method test_U12_one_file_is_not_cross_file L160–161
+ test_U13_malformed_json_returns_false method method test_U13_malformed_json_returns_false L163–165
+ test_blank_input_returns_false method method test_blank_input_returns_false L167–168
+ TestClLanguageSet class class TestClLanguageSet L81–109
+ test_U04_deduplicates_same_language method method test_U04_deduplicates_same_language L84–89
+ test_U05_multiple_languages_sorted method method test_U05_multiple_languages_sorted L91–96
+ test_U06_invalid_json_returns_placeholder method method test_U06_invalid_json_returns_placeholder L98–99
+ test_U07_empty_array_returns_placeholder method method test_U07_empty_array_returns_placeholder L101–102
+ test_blank_string_returns_placeholder method method test_blank_string_returns_placeholder L104–105
+ test_members_missing_language_key_skipped method method test_members_missing_language_key_skipped L107–109
+ TestClParseMembers class class TestClParseMembers L176–206
+ test_address_without_double_colon_uses_whole_address_as_file method method test_address_without_double_colon_uses_whole_address_as_file L185–188
+ test_blank_input_returns_empty_list method method test_blank_input_returns_empty_list L199–200
+ test_file_key_added_from_address method method test_file_key_added_from_address L179–183
+ test_invalid_json_returns_empty_list method method test_invalid_json_returns_empty_list L196–197
+ test_missing_address_key_defaults_to_empty method method test_missing_address_key_defaults_to_empty L190–194
+ test_preserves_kind_and_language method method test_preserves_kind_and_language L202–206
+ TestClTierClass class class TestClTierClass L61–73
+ test_U01_exact_returns_exact_class class method test_U01_exact_returns_exact_class L64–65
+ test_U02_near_returns_near_class class method test_U02_near_returns_near_class L67–68
+ test_U03_unknown_tier_returns_near_as_safe_default method method test_U03_unknown_tier_returns_near_as_safe_default L70–73
+ _BLANK variable variable _BLANK L53–53
+ _EMPTY_ARRAY variable variable _EMPTY_ARRAY L51–51
+ _INVALID_JSON variable variable _INVALID_JSON L52–52
+ _ONE_FILE variable variable _ONE_FILE L36–41
+ _TWO_FILES variable variable _TWO_FILES L43–49
+ _cl_file_count import import _cl_file_count L23–23
+ _cl_files_breakdown import import _cl_files_breakdown L23–23
+ _cl_is_cross_file import import _cl_is_cross_file L23–23
+ _cl_language_set import import _cl_language_set L23–23
+ _cl_parse_members import import _cl_parse_members L23–23
+ _cl_tier_class class import _cl_tier_class L23–23
+ annotations import import annotations L17–17
+ json import import json L19–19
+ pytest import import pytest L21–21
~ musehub/api/routes/musehub/ui_intel.py .py 10 symbols added, 1 symbol modified
+ _VALID_CLONE_TIERS variable variable _VALID_CLONE_TIERS L1443–1443
+ _VALID_CLONE_TOPS variable variable _VALID_CLONE_TOPS L1442–1442
+ _cl_file_count function function _cl_file_count L1502–1527
+ _cl_files_breakdown function function _cl_files_breakdown L1589–1626
+ _cl_is_cross_file function function _cl_is_cross_file L1530–1548
+ _cl_language_set function function _cl_language_set L1464–1499
+ _cl_parse_members function function _cl_parse_members L1551–1586
+ _cl_tier_class class function _cl_tier_class L1446–1461
+ intel_clones_detail_page function async_function intel_clones_detail_page L1794–1880
+ intel_clones_page function async_function intel_clones_page L1635–1790
Files Changed
+1 ~1
732 in 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:1dbf1e00707f552e435adca80a6585a842ac0215f7851de0e1d4e28ea2cf3944 --body "your comment"