Skip to content

fix(admin): keep privilege edits per database, and admit unknown user status - #524

Merged
EVWorth merged 1 commit into
mainfrom
fix/admin-privilege-edits-and-status
Aug 29, 2026
Merged

EVWorth merged 1 commit into
mainfrom
fix/admin-privilege-edits-and-status

Conversation

@EVWorth

@EVWorth EVWorth commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Refs #440, #441. Two ways the admin panel quietly told the user something untrue.

Privilege edits vanished on a database switch (#441)

The editor held one pair of sets — current and edited — for whichever database was selected. Switching database reloaded into those same sets, so edits on the first one were gone: no warning, no way back, and the checkboxes simply looked like the user had never touched them.

Privileges are now keyed by database:

  • switching away and back returns to the pending edit, not the server's state
  • Apply emits statements for every database with changes, not only the visible one
  • Reset clears them all, rather than leaving edits behind on off-screen databases that Apply would then send
  • databases with unapplied changes are marked in the dropdown and named above it — Apply sending changes the user can't currently see is only reasonable if the UI says so

A locked account looked like a healthy one (#440)

The user list falls back to a narrower query when the full one fails — MariaDB lacks some columns, and so does a restricted grant. The fallback can't read account_locked or password_expired, so it filled them with null, and null rendered as no badge: exactly how a healthy account renders.

Those accounts now show an explicit unknown marker with a tooltip explaining the server didn't expose the columns, and the first error is logged rather than discarded.

Note on the issue's framing: #440 describes the empty catch as swallowing failures. It doesn't quite — a genuine failure still surfaces from the second query's catch. The defect is narrower and worse than "an error goes missing": the two queries disagreeing produces a confident wrong answer. I've recorded that on the issue.

On the tests

Two things worth flagging, because both would have produced tests that passed while proving nothing:

  1. The persistence tests were run against the unfixed code and fail there. I removed the guard, watched both fail, and restored it.
  2. The queries are scoped to the database section. The global privilege checkboxes come first in the DOM, so getAllByRole("checkbox")[0] is a global toggle — which persists across a database switch regardless, and would have passed no matter what. That's why there's a data-testid on the database grid.

1650 frontend tests, 66 integration tests against MySQL 8 + MariaDB 11, clippy/tsc/dprint clean.

🤖 Generated with Claude Code

… status

Two ways the admin panel quietly told the user something untrue.

The privileges editor held one pair of sets — current and edited — for
whichever database was selected. Switching database reloaded into those same
sets, so edits made on the first one were gone, with no warning and no way
back. Privileges are now keyed by database, so switching away and back
returns to the pending edit rather than to the server's state, Apply emits
statements for every database with changes rather than only the visible one,
and Reset clears them all rather than leaving edits behind on databases that
are off screen. Databases with unapplied changes are marked in the dropdown
and named above it, because Apply sending changes the user cannot currently
see is only reasonable if the UI says so. (#441)

The user list falls back to a narrower query when the full one fails, which
happens on MariaDB and under a restricted grant. The fallback cannot read
account_locked or password_expired, so it filled them with null — and null
rendered as no badge, which is exactly how a healthy account renders. A
locked account appeared unremarkable. The fallback is now recorded and those
accounts show an explicit "unknown" marker explaining that the server did not
expose the columns. The first error is logged rather than discarded. (#440)

The issue for the second described the empty catch as swallowing failures.
It does not quite — a real failure still surfaces from the second query's
catch. The defect is narrower and worse: the two queries disagreeing produces
a confident wrong answer rather than an error. That is recorded on the issue.

The persistence tests were checked against the unfixed code and fail there,
and they scope their queries to the database section — the global privilege
checkboxes come first in the DOM, so an unscoped selector would have toggled
a global privilege and passed no matter what.

Refs #440, #441
@EVWorth
EVWorth merged commit ec16dd2 into main Aug 29, 2026
9 checks passed
@EVWorth
EVWorth deleted the fix/admin-privilege-edits-and-status branch August 29, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant