fix(utilities): pgstatindex for Postgres fragmentation, MariaDB its own family, and SQLite credentials selectable again - #274
Merged
Conversation
…t cannot have A real break, found by running the revert e2e before releasing rather than after. `selectSavedConnection` treats "no stored password" as "prompt the user", which was never reached for SQLite while the credential form still offered a Save-password box. #271 hid that box for file dialects — correctly, a file has no password — so SQLite credentials now save with `hasPassword: false`, and picking one as Source or Target opened a password prompt, snapped the picker back to "— Saved —", and left no connection selected. Snapshot, Compare and Migrate all stayed disabled with nothing on screen explaining why. Reproduced by hand in the browser, not inferred from the test: pick a saved SQLite credential, watch the select revert. `isFileDialect` / `dialectUsesPassword` now live in `provider-settings` beside the rest of the per-dialect truth, and both the picker and the connection modal read them instead of each carrying their own copy of the list. Also updates the last e2e that asserted the old filter behaviour: it checked `isChecked()` on Function and Procedure boxes, which this seed's schema does not have and which are therefore no longer rendered — an assertion on an absent control hangs rather than fails. E2E after this, against the running app: schema-revert 4/4, schema-version-revert-edges 10/10, schema-history 6/6. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…, and MariaDB is not MySQL
Two reported failures, both reproduced against the live engines rather than
reasoned about.
**Index fragmentation on PostgreSQL could never have worked.** The probe read
`SELECT leaf_fragmentation FROM pgstattuple(ci.oid)`. Against PostgreSQL 17:
-- extension absent (the default, and the reported error)
ERROR: function pgstattuple(oid) does not exist
-- extension installed — the obvious fix
ERROR: column "leaf_fragmentation" does not exist
`pgstattuple` reports *table* statistics. `leaf_fragmentation` belongs to
`pgstatindex`, which returns 0 for a real index. So installing the extension
swapped one error for another; the feature was broken either way. Now uses
`pgstatindex(ci.oid::regclass)`, verified returning values on that server.
Two follow-ons. `pgstatindex` yields NaN for an index with no leaf pages yet —
"nothing measured", not a number, and `NaN%` in a column reads as a bug — so it
is nulled out. And a missing extension now explains itself: the panel says the
server needs `CREATE EXTENSION pgstattuple;` and that a superuser can add it,
instead of relaying the driver's sentence.
**MariaDB was aliased to the MySQL family and two probes were wrong on it.**
Against MariaDB 11.8:
SELECT @@innodb_buffer_pool_instances; -- ERROR 1193: Unknown system variable
SELECT ... FROM performance_schema.global_status ... -- (empty)
SELECT ... FROM information_schema.GLOBAL_STATUS ... -- 245412
The removed variable killed System info outright, which is the reported bug. The
empty one was quieter and worse: performance_schema is off by default on
MariaDB, so the pool panel showed blank connection counts with no error at all.
MariaDB is now its own family, reading status from `information_schema` and
dropping the variable it no longer has; sessions and sizes share the MySQL
queries, which do work on it.
Verified live, all four utilities: pool 151 max / 1 connected, sessions listed,
system up 245536s on 11.8.8-MariaDB, sizes reported per table.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_66cb2f09-3dcb-4b18-ad70-4ee2ac909036) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three fixes that missed the #273 squash — it was taken from the branch before these landed, so
maindoes not have them. Caught while verifyingmainahead of a release tag: the unit count onmainwas 1955 against 1961 on the branch.Two of these are bugs reported from the running app, and one is a regression from #271.
Index fragmentation on PostgreSQL could never have worked
The probe read
SELECT leaf_fragmentation FROM pgstattuple(ci.oid). Against PostgreSQL 17:pgstattuplereports table statistics.leaf_fragmentationbelongs topgstatindex, which returns0on a real index. Installing the extension only swapped one error for another.Now uses
pgstatindex(ci.oid::regclass), verified returning values. Two follow-ons:pgstatindexyieldsNaNfor an index with no leaf pages yet — nulled out, sinceNaN%in a column reads as a bug — and a missing extension now explains itself (CREATE EXTENSION pgstattuple;, superuser needed) instead of relaying the driver's sentence.MariaDB was aliased to MySQL, and two probes are wrong on it
Against MariaDB 11.8:
The removed variable killed System info outright — the reported bug. The empty one was quieter and worse:
performance_schemais off by default on MariaDB, so the pool panel showed blank connection counts with no error at all.MariaDB is now its own family, reading status from
information_schemaand dropping the variable it no longer has. Sessions and sizes share the MySQL queries, which do work on it.Verified live, all four utilities: pool
151 max / 1 connected / 18 cached, sessions listed, systemup 245536s on 11.8.8-MariaDB, sizes per table.Selecting a saved SQLite connection asked for a password it cannot have
Regression from #271.
selectSavedConnectiontreats "no stored password" as "prompt the user" — never reached for SQLite while the credential form still offered a Save-password box. #271 hid that box for file dialects, correctly, so SQLite credentials now save withhasPassword: false. Picking one as Source or Target opened a password prompt, snapped the picker back to "— Saved —", and left nothing selected; Snapshot, Compare and Migrate all sat disabled with nothing explaining why.Reproduced by hand in the browser before trusting the test.
isFileDialect/dialectUsesPasswordnow live inprovider-settingsbeside the rest of the per-dialect truth, so the picker and the connection modal read one definition.Reviewer note
maincurrently ships all three bugs. I'd merge this before tagging a release — that is what stopped me taggingv0.2.110.Gates
tsc --noEmitclean ·vitest run1961 pass / 2 expected-fail · eslint 0 errors. E2E on the source branch: schema-revert 4/4, revert-edges 10/10, schema-history 6/6.🤖 Generated with Claude Code
Note
Medium Risk
Changes touch live connection selection, PostgreSQL fragmentation SQL, and MariaDB utility probes against real databases; scope is bounded and covered by unit tests.
Overview
Fixes three production bugs: PostgreSQL index fragmentation that could never succeed, MariaDB DBA utilities aliased to MySQL, and saved SQLite/DuckDB connections blocked by a password prompt.
PostgreSQL index fragmentation now calls
pgstatindex(frompgstattuple) instead ofpgstattupleforleaf_fragmentation, withNULLIFso unmeasured indexes do not showNaN%. API failures from a missing extension are rewritten to mentionCREATE EXTENSION pgstattuple;.MariaDB is no longer folded into the MySQL family for DBA pool/system probes: status reads
information_schema.GLOBAL_STATUSinstead ofperformance_schema, and system info drops@@innodb_buffer_pool_instances. Sessions and sizes still share MySQL SQL where it works.File dialect credentials get shared
isFileDialect/dialectUsesPasswordhelpers so picking a saved SQLite connection without a stored password no longer opens the session password modal and resets the dropdown.E2E history test expectations are tightened so default type filters are not asserted for object types absent from the seed schema.
Reviewed by Cursor Bugbot for commit 4c2bf25. Bugbot is set up for automated code reviews on this repo. Configure here.