Feat (search): emit null page / total_pages when no rows on current page#7
Conversation
`datastore_search` / `datastore_search_sql` previously omitted `page` and `total_pages` from `_links` whenever the current page had no rows (empty resource or `offset >= total`). Clients can't distinguish a forgotten field from "no current page exists". Emit explicit `null` in those cases; ints when there are rows; key still omitted only when `total` is genuinely unknown (`include_total=false`).
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR updates pagination metadata handling in the datastore read service. When a page is empty and the total count is known, ChangesPagination Metadata Consistency
🎯 2 (Simple) | ⏱️ ~12 minutes
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
datastore_search/datastore_search_sqlpreviously omittedpageandtotal_pagesfrom_linkswhenever the current page had no rows (empty resource, oroffset >= total).nullin those cases. Ints when the page has rows. Key stays omitted only whentotalis genuinely unknown (include_total=false) so we don't fabricate a count.Response shape
Test plan
_build_pagination_links+_build_sql_pagination_linksin datastore/services/read.py.tests/test_read_service.py(renamed*_drop_page_counters_*→*_null_page_counters_*).tests/test_datastore_search.py.Summary by CodeRabbit
pageandtotal_pagesfields in pagination metadata. These fields are returned asnullwhen unavailable (empty resources or past-end pagination) rather than being omitted, ensuring more predictable response structures.