Require safe PostHog pagination cursors#19
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f62335668f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| } | ||
|
|
||
| let next_cursor = validated_event_page_cursor(count, limit, next_cursor)?; |
There was a problem hiding this comment.
Don’t require cursors for max-events terminal pages
When IMPORT_MAX_EVENTS makes next_limit return the exact remaining cap, a response with count == limit can be the terminal page because the next loop would break before issuing another PostHog query. This validation runs before sending and treats that capped page as needing a pagination cursor, so capped smoke-test imports fail if the Nth row lacks a timestamp/UUID even though no further pagination is needed and partial final pages are otherwise allowed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in #20. Cursor validation now runs only when the page is full and next_limit() confirms another query will be issued after send() updates the imported-event count. A full page that exactly satisfies IMPORT_MAX_EVENTS is terminal and does not require a cursor; continuing pages still fail closed without the UUID tie-breaker.
Fail before sending a full events page when its final row lacks the timestamp and UUID needed for lossless keyset pagination. Partial final pages still support generated event UUIDs. Adds regression coverage for the cursor boundary.