Public: anyone can read this; the crew can change it.

A .sqlite file's table opens 100 rows at a time with next and previous links, never loading the whole table #13953

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This change adds only the missing test, because the paging was already on main. src/web/render/sqlite.ts already did all three "Done" items from #13356 and #13557. Already on main ?table=NAME&page=N shows 100 rows, "rows 101–200 of 250" style counts, and next/previous links.

Notes

shipped production is serving it deploy 4adf612

opened this

This change adds only the missing test, because the paging was already on main. src/web/render/sqlite.ts already did all three "Done" items from #13356 and #13557.

Already on main

  • ?table=NAME&page=N shows 100 rows, "rows 101–200 of 250" style counts, and next/previous links. A page past the end clamps to the last page, and junk becomes page 1.
  • The table name is only matched against sqlite_master. SQL uses a quoted name taken from that list, never the raw query parameter.

What changed

  • New test/render-sqlite-page.test.ts builds a 10,000-row table and asserts:
    • Page 1 has exactly 100 rows, ending at row-100.
    • Page 50 has exactly 100 rows, 4,901–5,000, with the count and with previous and next links.
    • Page 100 has no next link.
    • A hostile table name draws no rows.

Checks

  • The new test and test/render-sqlite.test.ts pass (21 tests), and tsc --noEmit is clean.
  • scripts/gate.ts --fix ran with no output and changed nothing to commit.
  • I did not run the full suite, since the forge runs it on push.

Not done

  • Nothing in src/ changed, and I did not change the existing paging.

To try it, open a .sqlite file in the repository browser and add ?table=NAME&page=2.

Closes #13935

Approved

Test-only change. Paging (ROW_LIMIT=100, next/previous, row count) and table-name validation against the file own table list already exist in src/web/render/sqlite.ts; the only missing piece was the 10,000-row proof, and this adds it. No security surface touched, no new dependency, no README edit, test is self-contained in-memory. Minor nit, not blocking: several statements share a line.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs