Skip to content

feat(grid): per-column filters and paging (#391) - #628

Merged
EVWorth merged 2 commits into
mainfrom
feat/results-filter-paginate
Sep 11, 2026
Merged

EVWorth merged 2 commits into
mainfrom
feat/results-filter-paginate

Conversation

@EVWorth

@EVWorth EVWorth commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #627.

Filters (FR-3.1.3)

There was no filtering at all — narrowing a result meant editing the query and running it again, a round trip to the server to answer a question about data already on screen.

Deliberately client-side. A filter that re-ran the query would change what the grid shows underneath any pending edits, and would disagree with the server about collation and NULL ordering in ways the user cannot see. These filter the rows you have; the query is still how you choose which rows to fetch.

Operator before operand, because the operand's shape depends on it — between takes two, is NULL takes none. Comparisons lead on numeric/date columns, contains on the rest, but every operator is offered everywhere: > 'm' is a real question to ask of a surname.

Details that decide whether it's usable:

  • NULL is found only by is NULL, and never slips through a negated filter. SQL agrees: "does not equal x" must not start reporting rows whose value is unknown.
  • Numbers compare as numbers even when carried as strings, which BIGINT and DECIMAL are so JSON can't truncate them. Text comparison puts 9 above 30.
  • A half-typed regex shows everything rather than emptying the grid on every keystroke.
  • The footer says "12 of 4000 row(s)" — "12 row(s)" alone reads as the query having returned twelve.

Paging (FR-3.1.8)

The row limit was a hard stop, not a window: a query matching a million rows showed the first 1000, and reaching row 1001 meant editing the SQL.

Paging discards rows while reading rather than appending LIMIT/OFFSET. That follows the decision already made for the row cap in #520: rewriting the user's SQL breaks SHOW in every form, locking clauses, trailing comments, and subqueries that already carry a LIMIT — and it can't reach the result sets a procedure returns at all. Skipping the read works on all of them. The server still produces the skipped rows, but OFFSET scans and discards just the same, and the stream is drained either way.

No total is shown, because there isn't one: the statement is streamed and stopped at the cap. The footer says which rows these are and whether more follow; the end is recognised by a page coming back short.

Three things that only surfaced once it was used:

  • A page whose rows were all skipped — the last page when the row count is an exact multiple of the page size — had no row left to read column metadata from, so it came back with no columns and the grid drew an empty box instead of the end of the data. One skipped row is now kept for its shape.
  • The skip counter resets per result set, so each statement in a batch pages from its own start.
  • A page change no longer writes a history entry. The statement was run once.

Verification

2307 unit + 318 browser tests. New: 17 filter-predicate tests, 7 browser filter tests driving real TanStack, 9 store paging tests, 6 browser page-control tests, and 5 live-server Rust tests covering SHOW, FOR UPDATE and a trailing comment — each of which rejects an appended LIMIT. The filter tests were mutation-checked.

Closes #391

🤖 Generated with Claude Code

@EVWorth
EVWorth force-pushed the feat/results-sort-reorder branch from 1fc2711 to 2c680b4 Compare September 11, 2026 05:15
@EVWorth
EVWorth changed the base branch from feat/results-sort-reorder to main September 11, 2026 05:16
EVWorth and others added 2 commits September 11, 2026 00:18
FR-3.1.3, which did not exist. Narrowing a result meant editing the query and
running it again — a round trip to the server to answer a question about data
already on screen (#391).

Deliberately client-side. A filter that re-ran the query would change what the
grid shows underneath any pending edits, and would disagree with the server
about collation and NULL ordering in ways the user cannot see. These filter
the rows you have; the query is still how you choose which rows to fetch.

The operator comes before the operand because the operand's shape depends on
it — `between` takes two, `is NULL` takes none — and a single text box cannot
express any of that. Comparison operators lead on numeric and date columns,
`contains` on the rest, but every operator is offered on every column: `> 'm'`
is a real question to ask of a surname.

Details that decide whether it is usable:

- NULL is found only by `is NULL`, and never slips through a negated filter.
  SQL agrees: "does not equal x" must not start reporting rows whose value is
  unknown.
- Numbers compare as numbers even when carried as strings, which BIGINT and
  DECIMAL are so JSON cannot truncate them. Text comparison puts 9 above 30.
- A half-typed regex shows everything rather than emptying the grid, which
  would make the input unusable.
- A filter with no operand yet does not narrow anything, so opening a menu
  does not blank the result.
- The footer says "12 of 4000 row(s)": "12 row(s)" alone reads as the query
  having returned twelve, which is a different fact.

Co-Authored-By: Claude Opus 5 <[email protected]>
FR-3.1.8. The row limit was a hard stop, not a window: a query matching a
million rows showed the first 1000, and reaching row 1001 meant editing the
SQL (#391).

Paging discards rows while reading rather than appending LIMIT/OFFSET to the
statement. That follows the decision already made for the row cap (#520):
rewriting the user's SQL breaks SHOW in every form, locking clauses, trailing
comments, and subqueries that already carry a LIMIT — and it cannot reach the
result sets a procedure returns at all. Skipping the read works on all of
them. The server still produces the skipped rows, but OFFSET scans and
discards just the same, and the stream has to be drained either way.

What the footer says is bounded by what is actually known. There is no total,
because the statement is streamed and stopped at the cap, so it shows which
rows these are and whether more follow. The end is recognised by a page coming
back short.

Three things that only show up once it is used:

- A page whose rows were all skipped — the last page of a result whose size is
  an exact multiple of the page size — had no row left to read the column
  metadata from, so it came back with no columns and the grid drew an empty
  box instead of the end of the data. One skipped row is kept for its shape.
- The skip counter resets per result set, so each statement in a batch pages
  from its own start rather than the first one consuming the offset.
- A page change no longer writes a history entry. The statement was run once;
  one row per Next click is not a record of anything the user did.

Verified against live MySQL 8, including SHOW, FOR UPDATE and a trailing
comment — each of which rejects an appended LIMIT.

Co-Authored-By: Claude Opus 5 <[email protected]>
@EVWorth
EVWorth force-pushed the feat/results-filter-paginate branch from b7c7863 to f48850e Compare September 11, 2026 05:18
@EVWorth
EVWorth merged commit df60343 into main Sep 11, 2026
12 checks passed
@EVWorth
EVWorth deleted the feat/results-filter-paginate branch September 11, 2026 05:21
@EVWorth EVWorth mentioned this pull request Sep 11, 2026
48 tasks
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.

[P0] [doc-drift] FR-3.1.3 filters + FR-3.1.8 pagination — completely missing

1 participant