Skip to content

feat(history): filter, sort and export the history - #598

Merged
EVWorth merged 2 commits into
mainfrom
feat/history-filters-export
Sep 10, 2026
Merged

EVWorth merged 2 commits into
mainfrom
feat/history-filters-export

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Closes #589, closes #326.

Stacked on #597 (→ #593 → #584). The commits to read here are the last two.

The panel matched a substring of the SQL and nothing else, so everything else recorded on an entry was unusable for finding it. "What did I run against staging yesterday that failed" and "what were my slowest queries" are both ordinary questions it couldn't answer, and both are standard in DBeaver's Query Manager and DataGrip.

Filters by connection, database, status, date range and minimum duration; sorts by recency, duration or row count; exports what matches as CSV or as a runnable SQL file. All of it is a WHERE clause against history.db — the other half of why history moved there.

The parts that are easy to get wrong, and are tested

  • An empty filter list means "all", not "none". Sending [] would empty the panel the moment someone unticked the last checkbox.
  • Every filter value is bound, never interpolated. Connection names come from rows the app wrote, but a name is still data, and this would otherwise be the one place in the app building SQL by concatenation. A connection called prod' OR '1'='1 has a test.
  • An absent limit now means every match. It defaulted to 500 inside list(), which would have silently capped an export at 500 rows. Caught while wiring the export; fixed with a test.
  • The end date is the end of that day. Midnight would exclude the whole day the user just named.
  • Facets come from the history, not the connection list, so the filter only offers values that would return something.
  • "50 of 812" — without the unpaged count, a full page and a last page look identical.
  • CSV quotes per RFC 4180; a comma inside a statement would otherwise shift every later column by one.
  • The SQL export flattens newlines in an error message — one would end the -- comment and leave the rest of the message in the file as SQL. There's a test asserting no line of the output starts with DROP TABLE.

Verification

25 new Rust tests (46 in the history module), 8 new store tests, 16 new panel tests. Full suites green (1864 frontend, all Rust crates), clippy clean, 0 lint errors.

The second commit fixes a doc edit that silently didn't apply — the requirements table had been reflowed by an earlier dprint pass, so the pattern matched nothing. Worth noting because the failure mode was quiet.

EVWorth and others added 2 commits September 9, 2026 19:03
The panel matched a substring of the SQL and nothing else, so everything
else recorded on an entry was unusable for finding it. "What did I run
against staging yesterday that failed" and "what were my slowest queries"
are both ordinary questions it could not answer, and both are standard in
DBeaver's Query Manager and DataGrip (#589, #326).

Filters by connection, database, status, date range and minimum duration;
sorts by recency, duration or row count; exports what matches as CSV or as
a runnable SQL file. All of it is a WHERE clause against history.db rather
than an array scan, which is the other half of why history moved there.

Several things are load-bearing and easy to get wrong:

An empty filter list means "all", not "none". Sending [] would empty the
panel the moment someone unticked the last checkbox.

Every filter value is bound, never interpolated. Connection names come
from rows the app wrote, but a name is still data, and this would
otherwise be the one place in the app building SQL by concatenation. A
connection called `prod' OR '1'='1` has a test.

An absent limit now means every match. It used to default to 500 inside
list(), which would have silently capped an export at 500 rows.

The end date is taken as the end of that day. Midnight would exclude the
whole day the user just named.

Facets are read from the history rather than from the connection list, so
the filter only offers values that would return something.

The panel says "50 of 812" — without the unpaged count, a full page and a
last page look identical.

CSV quotes per RFC 4180: a comma inside a statement would otherwise shift
every later column by one. The SQL export flattens newlines in an error
message, because one would end the comment and leave the rest of the
message sitting in the file as SQL.

Closes #589
Closes #326

Co-Authored-By: Claude Opus 5 <[email protected]>
Missed in the previous commit: the table had been reflowed by an earlier
dprint pass, so the edit matched nothing and went in silently unapplied.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth force-pushed the feat/history-filters-export branch from bef24d6 to 0fd9966 Compare September 10, 2026 00:04
@EVWorth
EVWorth merged commit d607434 into main Sep 10, 2026
1 check passed
@EVWorth
EVWorth deleted the feat/history-filters-export branch September 10, 2026 00:04
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.

[P1/ux] History has no filters, sort, or export [P1/bug] No filter by connection, date range, or success/failure — only full-text SQL search

1 participant