Commit 035ee42
PG UX polish: dialect-aware AI prompts, button visibility, label cleanup
Four issues surfaced in actual PG dashboard use:
1. EXPLAIN false-positive on Rails query annotations
SQL like `SELECT COUNT(*) FROM "taggings" /*action='table_sizes',
...*/` was rejected as "truncated" because the closing `*/` ends
in `/` and tripped the trailing-operator check. looks_complete?
now strips block comments before inspecting the trailing token.
2. AI assistant generates MySQL backticks on a PG database
`Suggestion`, `RewriteQuery`, `Optimization`, `IndexAdvisor`,
`IndexPlanner`, `MigrationRisk`, `SchemaReview`, `WorkloadDigest`,
and `PatternGrouper` all hardcoded "MySQL" in their system
prompts; Suggestion also told the model to "use backticks for
table and column names." On PG this produced unparseable SQL.
New Ai::DialectHints module exposes name_for(conn) and
identifier_quoting_rule(conn). Every prompt now interpolates the
dialect name; Suggestion's quoting rule swaps to double quotes
on PG. IndexPlanner's prompt also specifies dialect-appropriate
DROP INDEX syntax.
3. MySQL-only AI buttons visible on PG dashboard
"Why is it slow?", "Anomaly Detection", "Variable Review",
"Connection Advisor", "InnoDB Health" all require MySQL-only data
sources. The buttons were rendered, clicking them returned a
friendly "MySQL/MariaDB-only" error — but the noise was the user
experience. capability?(:mysql_only_ai) now returns false on PG,
and the Server tab gates those five buttons on it. The controller-
side friendly-error guard stays as a defensive backstop.
4. Misleading server labels on PG
- "InnoDB Buffer Pool" card → renamed "Buffer Cache" (works for
both InnoDB and shared_buffers).
- PG ServerOverview was reporting tmp_disk_pct = 100% whenever
temp_files > 0, flagging a red badge on every dashboard. PG's
temp_files is a single count with no in-memory denominator, so
it now reports 0% and shows N / N for the count.
- Was mapping xact_rollback to "Aborted Clients" which is a
different concept; PG's connections block now reports 0 for
aborted_clients/aborted_connects until a proper PG-side mapping
exists.
https://claude.ai/code/session_01Xy96nK3Ron2NqukBiSgtzE1 parent 0dd2625 commit 035ee42
18 files changed
Lines changed: 164 additions & 33 deletions
File tree
- app/controllers/concerns/mysql_genius
- lib/mysql_genius
- core
- ai
- analysis
- views/mysql_genius/queries
- spec/mysql_genius/core
- ai
- analysis
Lines changed: 26 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
54 | 74 | | |
55 | 75 | | |
56 | 76 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
0 commit comments