refactor: extract EXPLAIN parsers and AI client from VisualOptimizer
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Refactoring
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- mysql, postgresql, react, sqlite, typescript
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- TypeScript
- Stelle
- 6
- Fork
- 1
- Merge medio
- 17m
- PR unite (30g)
- 2
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openidle-dev/queryden
-
Multi Query ClusterAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
openidle-dev/queryden#240 ·
-
bug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
openidle-dev/queryden#187 ·
-
Refresh database listAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 58/100
openidle-dev/queryden#237 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
openidle-dev/queryden#192 ·
-
dependencies
Difficoltà 2/5 1-3 ore Idoneità per principianti 58/100
openidle-dev/queryden#186 ·
Tutte le issue di openidle-dev/queryden
Issue simili
-
Mend: dependency security vulnerability
Difficoltà 1/5 1-3 ore Idoneità per principianti 65/100
fdm-monster/fdm-monster#5563 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
be-BOP-io-SA/be-BOP#2849 ·
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
growilabs/growi#12246 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
🐛 The Rulekeeper - An index run that gives up on the lock ends SucceededForse già presa @github-actions l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SSWConsulting/SSW.Rules#2809 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
automated-triage type/bug type/ci
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno