improvement(tables): harden pagination for short pages and surface name-validation errors#5351
improvement(tables): harden pagination for short pages and surface name-validation errors#5351TheodoreSpeaks wants to merge 2 commits into
Conversation
…me-validation errors
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds an optional dev
Tests cover the pagination module, byte trim, rewritten Reviewed by Cursor Bugbot for commit 431e177. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR hardens table row pagination by replacing the
Confidence Score: 5/5Safe to merge — all production paths are additive or corrective fixes with no regressions introduced. The pagination termination rewrite is well-reasoned: the new count-based rule is strictly more correct than the old page-fullness heuristic, the shared utilities are pure functions with comprehensive unit tests, and the drain loops gain explicit no-progress guards. The UTF-8 byte fix closes a real undercount for multi-byte content, and the validation toast change strictly improves user feedback. The dev-preview byte-cut is disabled by default and isolated behind a null-check. No files require special attention. The acknowledged stale-low totalCount early-exit in hasMoreTableRows and the per-row envelope exclusion in trimRowsToByteBudget are both explicitly documented and accepted as pre-production trade-offs. Important Files Changed
Reviews (2): Last reviewed commit: "fix(tables): align getNextPageParam test..." | Re-trigger Greptile |
|
Addressed review notes:
CI failure was @greptile review |
Summary
totalCountinstead ofrows.length < pageSize, so a short server page can never be misread as end-of-table (prep for byte-bounded pages / larger rows). Termination logic lives in a new pure modulehooks/queries/utils/table-rows-pagination.tsshared bygetNextPageParamand theuse-tabledrain loopsvalidateRowSizemeasures UTF-8 bytes (Buffer.byteLength) instead of UTF-16 code units — a "400KB" CJK row was actually ~1.2MB on disk/wireTABLE_MAX_PAGE_BYTESenv (off by default): server cuts row pages at a byte budget, always keeping ≥1 row. Used to exercise the client termination end-to-end; the production SQL-side cut is a follow-upType of Change
Testing
New pure-fn test suites (pagination termination, byte trim) + rewritten
use-tabletests incl. first coverage ofensureRowsLoadedUpToand the short-page-continues regression case.tsc,lint:check,check:api-validation:strict,check:react-query,check:client-boundaryall pass. Manually exercised locally against a seeded 60×400KB-row table with the byte cut enabled.Checklist