Commit a8fb023
feat(P3): Epic 3.5 — TagSearch extraction + /8eyes fixes (#21)
* feat(3.5): extract TagIndex + SearchEngine from monolithic SkillStore
Epic 3.5: Decompose monolithic SkillStore by extracting tag indexing and search operations into a dedicated TagSearch module.
Changes:
- Created openspace/skill_engine/tag_search.py with TagSearch class
- Supports standalone usage (owns connection) and shared usage (injected connection/lock)
- Extracted methods: sync_tags, get_tags, find_skills_by_tool, find_skills_by_tags, search_skills, get_summary, get_stats, get_top_skills, get_count_and_timestamp
- Added comprehensive tag-based search with category/visibility/text filtering
- Proper SQL injection prevention with LIKE wildcard escaping
- Updated SkillStore to delegate tag/search operations to TagSearch
- Updated __init__.py to export TagSearch class
- Created comprehensive test suite (37 tests) covering:
- Tag CRUD operations
- Tag-based skill search (any/all match)
- Tool dependency search
- Skill discovery and statistics
- Complex multi-criteria search
- Shared connection patterns (SkillStore integration)
- Error handling and edge cases
- All 1268 existing tests continue passing
- Cleaned up stale diff files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix(3.5): address /8eyes R1 — dedup tags, match_all, facade completeness, field compat
Fixes all 6 findings from /8eyes reviewers:
Finding 1 (MAJOR): Fixed duplicate tags crash in sync_tags
- Added deduplication at start: tags = list(set(tags))
- Added proper rollback on PK constraint failure
Finding 2 (MAJOR): Fixed match_all counts with duplicate input
- Use unique_tags = list(set(tags)) in find_skills_by_tags()
- Use len(unique_tags) in HAVING clause for both find_skills_by_tags and search_skills
Finding 3 (MAJOR): Added missing SkillStore facade methods
- Added find_skills_by_tags() facade delegation
- Added search_skills() facade delegation
- Added get_tags() facade delegation
- Added get_all_tags() facade delegation
- Added sync_tags() facade delegation
Finding 4 (MAJOR): Fixed get_stats field name for backward compatibility
- Changed 'by_lineage_origin' back to 'by_origin' in TagSearch.get_stats()
Finding 5 (MINOR): Fixed f-string parameterization in search_skills HAVING clause
- Use parameterized query: 'HAVING COUNT(DISTINCT st.tag) = ?' with params.append(len(unique_tags))
Finding 6 (MINOR): Added comprehensive integration tests
- test_sync_tags_with_duplicates — verify deduplication works
- test_find_by_tags_with_duplicate_input — verify match_all with dupes
- test_search_skills_with_duplicate_tags — verify search_skills match_all
- test_skill_store_facade_completeness — verify ALL TagSearch methods accessible
- test_facade_method_delegation — verify delegation works
- test_skill_store_get_stats_field_names — verify backward-compatible field names
- test_tag_search_direct_call_uses_original_field — verify TagSearch field name
All tests pass: 1275 passed, 31 skipped
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Brian Krafft <bkrafft@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent a2a3567 commit a8fb023
10 files changed
Lines changed: 1443 additions & 11839 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
205 | 206 | | |
206 | 207 | | |
207 | 208 | | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
| |||
290 | 294 | | |
291 | 295 | | |
292 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
293 | 305 | | |
294 | 306 | | |
295 | 307 | | |
| |||
765 | 777 | | |
766 | 778 | | |
767 | 779 | | |
| 780 | + | |
| 781 | + | |
768 | 782 | | |
769 | | - | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
774 | | - | |
775 | | - | |
776 | | - | |
777 | | - | |
| 783 | + | |
778 | 784 | | |
779 | 785 | | |
780 | 786 | | |
| |||
795 | 801 | | |
796 | 802 | | |
797 | 803 | | |
| 804 | + | |
| 805 | + | |
798 | 806 | | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
803 | | - | |
804 | | - | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
809 | | - | |
810 | | - | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
| 807 | + | |
815 | 808 | | |
816 | 809 | | |
817 | 810 | | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
847 | | - | |
848 | | - | |
849 | | - | |
850 | | - | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
855 | | - | |
856 | | - | |
857 | | - | |
858 | | - | |
859 | | - | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
864 | 827 | | |
865 | 828 | | |
866 | 829 | | |
| |||
892 | 855 | | |
893 | 856 | | |
894 | 857 | | |
| 858 | + | |
| 859 | + | |
895 | 860 | | |
896 | | - | |
897 | | - | |
898 | | - | |
899 | | - | |
900 | | - | |
901 | | - | |
902 | | - | |
903 | | - | |
904 | | - | |
905 | | - | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
912 | | - | |
913 | | - | |
914 | | - | |
915 | | - | |
916 | | - | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
921 | 864 | | |
922 | 865 | | |
923 | 866 | | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
934 | 872 | | |
935 | 873 | | |
936 | 874 | | |
| |||
1073 | 1011 | | |
1074 | 1012 | | |
1075 | 1013 | | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
| 1014 | + | |
| 1015 | + | |
1086 | 1016 | | |
1087 | 1017 | | |
1088 | 1018 | | |
| |||
1130 | 1060 | | |
1131 | 1061 | | |
1132 | 1062 | | |
1133 | | - | |
| 1063 | + | |
| 1064 | + | |
1134 | 1065 | | |
1135 | 1066 | | |
1136 | 1067 | | |
| |||
1144 | 1075 | | |
1145 | 1076 | | |
1146 | 1077 | | |
1147 | | - | |
| 1078 | + | |
1148 | 1079 | | |
1149 | 1080 | | |
1150 | 1081 | | |
| |||
1158 | 1089 | | |
1159 | 1090 | | |
1160 | 1091 | | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
0 commit comments