You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1][arch] useQueryExecution is a one-consumer abstraction — 12 features bypass it and call api.executeQuery directly #448
src/hooks/useQueryExecution.ts was extracted (commit d909ede 2026-04-07) to centralize query-execution context (connection-id, database, isExecuting flag). The doc comment at line 1-9 says: "Centralizes query execution context so callers never have to thread connectionId/database manually." It is used by exactly one component.
Problem
grep -n "useQueryExecution" src/ finds 8 hits: 1 production consumer (QueryToolbar.tsx) + 7 test files. Every other feature that runs SQL bypasses the hook and calls api.executeQuery(connectionId, sql, database) directly:
The abstraction exists, but only one consumer uses it. Either delete the hook (paper-tiger) or refactor all 12 bypassers through it (consistency).
The cross-cutting audit (docs/audits/cross-cutting.md F2) flagged this as P1.
Files
src/hooks/useQueryExecution.ts:1-64
src/components/editor/QueryToolbar.tsx:18, 58 — only consumer
11 other consumer files (listed above)
Repro
grep -rn "useQueryExecution" src/ | grep -v test# Only QueryToolbar.tsx matches in production code
grep -rn "api\.executeQuery(" src/ | grep -v test# 13 production call sites
Expected
Either every consumer routes through useQueryExecution().executeQuery(sql) (consistency), or the hook is removed and inlined into QueryToolbar (no dead abstraction). Pick one.
Proposed fix
Scope M. Refactor all 12 bypassers to use the hook. Each consumer calls useQueryExecution().executeQuery(sql) and the hook derives connection-id/database from store state. Or: delete useQueryExecution.ts entirely and inline the connectionId/database derivation in QueryToolbar.
Acceptance
A grep -n "api\.executeQuery(" src/ returns 0 hits outside src/stores/resultStore.ts (which has legitimate reason — it's the result-store, not a feature component). Every consumer either calls useQueryExecution().executeQuery(...) or has a comment justifying the direct call.
Activity
refactor(admin): one file per tab, instead of three tabs in one (#619)