fix(persistence): treat thread reply pagination limit of 0 as unset#2803
Draft
VelikovPetar wants to merge 2 commits into
Draft
fix(persistence): treat thread reply pagination limit of 0 as unset#2803VelikovPetar wants to merge 2 commits into
VelikovPetar wants to merge 2 commits into
Conversation
`getThreadMessagesByParentId` moved thread reply pagination into SQL, which turned a `limit` of 0 into `LIMIT 0` (zero rows). The pre-SQL implementation treated 0 as "unlimited" and returned every reply, and both the backend `getReplies` endpoint (0 -> default page) and the iOS SDK (`fetchLimit` 0 -> all rows) treat 0 as unset rather than empty. Only apply the SQL `LIMIT` for a positive limit so a limit of 0 keeps returning all matching replies. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
MessageDao.getThreadMessagesByParentIdrecently moved offline thread-reply pagination into SQL. That change turned aPaginationParams.limitof0into a SQLLIMIT 0(zero rows), whereas the pre-SQL implementation treated0as "unlimited" and returned every reply.Across the stack,
limit: 0means unset, not "empty":getReplies:limit == 0is treated as unset → default page of 100.fetchLimit == 0→ unlimited (all rows).0→ returned all rows.This PR only applies the SQL
LIMITwhen a positive limit is provided, restoring the "0 = unset → return all matching replies" contract.Low-risk in practice —
PaginationParams.limitis non-nullable and defaults to 10, and no in-repo call site passes 0 — so this is a latent-correctness fix.Scope is intentionally threads only.
getMessagesByCidhas the same unguarded pattern but is left untouched here.Originally surfaced while reviewing #2750 (the v9 backport), where the same fix was applied.
Test
Added
limit of 0 is treated as unset and returns all repliesto thegetThreadMessagesByParentIdgroup: seeds 30 replies, queries withPaginationParams(limit: 0), asserts all 30 come back in ASC order. Full group passes locally.🤖 Generated with Claude Code