Skip to content

feat(databases): drain cursor for paginated databases list - #239

Merged
anoop-narang merged 4 commits into
mainfrom
feat/databases-list-pagination
Jul 23, 2026
Merged

feat(databases): drain cursor for paginated databases list#239
anoop-narang merged 4 commits into
mainfrom
feat/databases-list-pagination

Conversation

@anoop-narang

@anoop-narang anoop-narang commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What & why

GET /v1/databases is now paginated (runtimedb #960): one capped page + a next_cursor. The SDK's databases().list() gained limit/cursor in hotdata 0.10.0. This bumps the dep to 0.10.0 and adapts the CLI:

  • databases list is now user-paginated--limit / --cursor, showing one page plus a More results available. Use --cursor <next> hint, matching the existing tables list / queries list UX (rather than dumping the whole workspace).
  • Name/catalog resolution (try_resolve_database) and the whole-workspace indexes list scan (list_database_ids, indexes list (unscoped) misses managed-database indexes #168) still need the complete set, so they drain all pages internally via a shared list_all_databases helper (follows next_cursor to the end, with a non-advancing-cursor guard).

The first page keeps the cold-start "waking up worker" spinner; results are shown in the server's newest-first order for coherent cursor continuation.

Depends on hotdata 0.10.0 (published to crates.io). Full CLI test suite passes.

GET /v1/databases is now paginated (one capped page + next_cursor);
the SDK's databases().list gained limit/cursor in hotdata 0.10.0. Bump
the dep and follow the cursor to the end so 'databases list', name/
catalog resolution, and the whole-workspace indexes-list id scan still
see every database.
@anoop-narang
anoop-narang requested a review from a team as a code owner July 23, 2026 12:35
@anoop-narang
anoop-narang requested review from shefeek-jinnah and removed request for a team July 23, 2026 12:35
Comment thread src/commands/databases.rs
Comment thread src/commands/databases.rs Outdated
claude[bot]
claude Bot previously approved these changes Jul 23, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean, well-documented cursor drain that mirrors the existing tables/queries pagination. Left two non-blocking nits inline (missing multi-page test, unnecessary clone).

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.38356% with 26 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/commands/databases.rs 68.11% 22 Missing ⚠️
src/main.rs 0.00% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Show one capped page + a 'use --cursor <next>' hint (matching
tables/queries list) instead of draining the whole workspace into
memory. Name/catalog resolution and the whole-workspace indexes-list
scan still drain every page internally (list_all_databases).
claude[bot]
claude Bot previously approved these changes Jul 23, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the cursor-drain helper, the user-paginated databases list, and the main.rs wiring. Logic is correct (non-advancing-cursor guard is sound) and the display command matches the existing tables list pagination UX. No new issues; the two prior nits stand as already noted.

Address review nits on #239:
- add list_all_databases_follows_cursor: two mocked pages exercise the
  cursor-following drain (the prior mocks were single-page) and the
  non-advancing-cursor guard.
- drop the unnecessary next_cursor clone in list_all_databases by moving
  the page rows out first (partial move).
@anoop-narang

Copy link
Copy Markdown
Contributor Author

Both addressed: added list_all_databases_follows_cursor (two mocked pages exercising the cursor-follow + non-advancing-cursor guard), and dropped the unnecessary next_cursor clone via a partial move.

Comment thread src/commands/databases.rs Outdated
claude[bot]
claude Bot previously approved these changes Jul 23, 2026

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both prior review comments (drain test coverage and the unnecessary clone in list_all_databases) are addressed. Left one non-blocking super nit.

Same next_cursor.clone() avoidance as list_all_databases: read the
cursor before moving the page rows out (partial move).

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All prior review feedback addressed (clones removed via partial-move, multi-page drain test added). No new issues.

@anoop-narang
anoop-narang merged commit f90ad6d into main Jul 23, 2026
14 checks passed
@anoop-narang
anoop-narang deleted the feat/databases-list-pagination branch July 23, 2026 13:37
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