fix(gh-priority-sync): use last_edited_time filter for Notion checkpoint resume#206
Open
fix(gh-priority-sync): use last_edited_time filter for Notion checkpoint resume#206
Conversation
…int resume Notion's start_cursor must be a token returned by a previous query (next_cursor), not an arbitrary page ID. Passing checkpoint.id caused "The start_cursor provided is invalid" errors that failed CI. Switch to filtering by last_edited_time on_or_after checkpoint.editedAt, and let pagination start from undefined. The existing post-filter that skips checkpoint.id continues to drop the duplicate boundary entry. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes gh-priority-sync Notion pagination resume logic by avoiding invalid start_cursor usage and instead resuming via last_edited_time filtering, preventing APIResponseError: The start_cursor provided is invalid.
Changes:
- Stop passing
checkpoint.id(Notion page ID) asstart_cursortonotion.dataSources.query. - Introduce a
last_edited_timeon_or_after checkpoint.editedAtfilter and start pagination fromundefined. - Keep the boundary-skip behavior by filtering out
checkpoint.idfrom results.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Removes a dead snippet that referenced an undefined CHECKPOINT identifier (the actual constant is NotionCheckpoint). Addresses Copilot review on PR #206. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When multiple Notion pages share the same last_edited_time as the
checkpoint, the prior implementation only skipped the single checkpoint id
and reprocessed (or got stuck on) the rest each run.
Extend the checkpoint to track all ids processed at the boundary timestamp
(processedIdsAtEditedAt) and use it as a post-filter. As we process items,
we either append to the boundary set (same timestamp) or reset it (new
timestamp), so the persisted checkpoint always reflects every id already
handled at the current boundary. Legacy { id, editedAt } checkpoints are
upgraded by treating { id } as the only processed id at editedAt.
Addresses Copilot review on PR #206.
Co-Authored-By: Claude Opus 4.7 (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
APIResponseError: The start_cursor provided is invalid: 34a6d73d-3650-810c-89ee-e9c25cd07700.gh-priority-syncpassedcheckpoint.id(a Notion page ID) intonotion.dataSources.query({ start_cursor }). Notion'sstart_cursoronly accepts a token previously returned asnext_cursor— feeding it an arbitrary page ID makes Notion reject the request.last_edited_time on_or_after checkpoint.editedAtand start pagination fromundefined. The existing post-filtere.id !== checkpoint?.idstill drops the boundary entry.Test plan
gh-combined-tasksworkflow)GitHub Issue Priorities Labeler Taskno longer throwsstart_cursorvalidation errors and resumes from the prior checkpoint vialast_edited_timefilter🤖 Generated with Claude Code