refactor: extract EXPLAIN parsers and AI client from VisualOptimizer
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- mysql, postgresql, react, sqlite, typescript
Hướng nghiên cứu
Start by reading src/components/results/VisualOptimizer.tsx to trace its EXPLAIN parsing, insight generation, AI calls, and plan tree rendering. Extract the parsers to utils/explainParser.ts, insights to utils/explainInsights.ts, the AI client to src/hooks/useAIExplain.ts, and the recursive tree row as described. Add at least six Vitest tests across the parser and insights modules; done means the component is under about 500 lines and PostgreSQL, MySQL, SQLite, and all four AI providers still work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
src/components/results/VisualOptimizer.tsx is 1,172 lines. The component parses three different EXPLAIN formats (PostgreSQL, MySQL, SQLite), runs heuristic insight generation, calls four AI providers, and renders the plan tree. Each of those is a clean extraction target.
What to extract
utils/explainParser.ts— one exported function per DB type:parsePostgresPlan(raw),parseMySqlPlan(raw),parseSqlitePlan(raw). All return a normalizedPlanNodetree.utils/explainInsights.ts— the heuristic recommendations (seq-scan warnings, missing-index hints, etc.) as pure functions over the normalizedPlanNode.hooks/useAIExplain.ts— the OpenAI / Anthropic / Google / Ollama fetch with the 30s timeout that already landed in the pre-launch pass. Returns{ run, response, error, loading }.<PlanTreeNode>— the recursive tree row, memoized.
Suggested approach
- Parsers are pure functions — perfect Vitest targets. Aim for at least three test cases per parser (simple, nested, edge-case).
useAIExplaincan sit insrc/hooks/.
Done criteria
VisualOptimizer.tsxdrops below ~500 lines and is mostly rendering glue.- The plan-tree visualization works for at least PostgreSQL EXPLAIN (mysql/sqlite already worked, regressions would be a no-go).
- AI assist still works for all four providers.
- At least 6 Vitest tests across the parser + insights modules.
Out of scope
- Adding new EXPLAIN visualization features.
- Adding new AI providers (separate issue).
Audit reference
K6 in the pre-launch audit.
- Ngôn ngữ chính
- TypeScript
- Star
- 6
- Fork
- 1
- Merge trung bình
- 17 phút
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openidle-dev/queryden
-
Multi Query ClusterĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
openidle-dev/queryden#240 ·
-
bug enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
openidle-dev/queryden#187 ·
-
Refresh database listĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
openidle-dev/queryden#237 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
openidle-dev/queryden#192 ·
-
dependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
openidle-dev/queryden#186 ·
Tất cả issue của openidle-dev/queryden
Issue tương tự
-
Mend: dependency security vulnerability
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 65/100
fdm-monster/fdm-monster#5563 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
be-BOP-io-SA/be-BOP#2849 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 1 ngày
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
growilabs/growi#12246 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🐛 The Rulekeeper - An index run that gives up on the lock ends SucceededCó thể đã có người làm @github-actions đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SSWConsulting/SSW.Rules#2809 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày