Skip to content

fix: follow the decreasing event sync cursor and never return partial lists - #48

Merged
ehs208 merged 1 commit into
ehs208:mainfrom
hfleige86-rgb:fix/sync-backward-paging
Oct 18, 2026
Merged

ehs208 merged 1 commit into
ehs208:mainfrom
hfleige86-rgb:fix/sync-backward-paging

Conversation

@hfleige86-rgb

Copy link
Copy Markdown
Contributor

Pull Request

Description

get_events and list_memos return only part of a calendar once it spans more than one sync chunk.

The events sync endpoint (/calendar/{id}/events/sync?since=) returns the newest chunk first and reports the oldest updated_at of that chunk as the next since, so the cursor decreases from page to page. fetchEventPages stopped as soon as the cursor did not grow (validated.since <= cursor), which ends paging after the first chunk.

Observed with a personal account on an earlier version with a similar stop condition (counts only): a calendar with about 2,300 events and one with about 680 both came back with 600 events. Callers that compare listings, such as sync tools, read the missing events as deleted.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Related Issue

None filed; this PR describes the problem.

Changes Made

  • Paging continues while the cursor is new, in either direction, so the forward-moving events feed used by getUpdatedEvents keeps working.
  • A repeated cursor or more than 200 pages raises an error instead of silently returning a partial list.
  • Overlapping chunks keep one entry per uuid, the newest by updated_at.
  • Regression tests: decreasing cursor, overlap, repeated cursor, page limit.

Testing

  • Tested with actual TimeTree account: the same paging rule runs in a scheduled read-only sync against a personal account. Listings are complete and no repeated cursor has been observed. No real data committed.
  • npm run typecheck, npm test (68 tests pass), and npm audit --audit-level=high pass, run as separate steps
  • Added/updated tests

Test Environment

  • Node.js Version: 24.15.0
  • Operating System: Windows 11
  • TimeTree Account: Personal account

Documentation

  • Updated CHANGELOG.md under [Unreleased]
  • Added/updated code comments

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have tested that my changes work correctly
  • No sensitive data (credentials, session IDs) is exposed
  • Rate limiting is respected (no API abuse): every page still goes through the rate limiter, and the page cap bounds the worst case
  • "Allow edits by maintainers" is checked (for PRs from forks)

Breaking Changes

None for valid responses. Responses that previously ended in a silently truncated list now raise an error.

Additional Notes

The cursor semantics come from observed behavior of an undocumented API. Allowing either direction instead of assuming a decreasing cursor keeps both endpoints working if TimeTree changes the order.

🤖 Generated with Claude Code

… lists

The events sync endpoint returns the newest chunk first and reports the
oldest updated_at of that chunk as the next cursor, so the cursor
decreases. fetchEventPages stopped as soon as the cursor did not grow,
which truncated get_events and list_memos after the first chunk in
calendars with more than one chunk.

Paging now continues while the cursor is new, in either direction. A
repeated cursor or more than 200 pages raises an error instead of
returning a partial list, and overlapping chunks keep one entry per
event (the newest by updated_at).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hfleige86-rgb
hfleige86-rgb requested a review from ehs208 as a code owner October 18, 2026 05:54
@ehs208

ehs208 commented Oct 18, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T07:57:17.494917Z 7721f99 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7721f99edf

ℹ️ 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".

Comment thread CHANGELOG.md
## [Unreleased]

### Fixed
- `get_events` and `list_memos` now read every event in large calendars. The events sync endpoint returns the newest chunk first with a decreasing cursor, and paging stopped after the first chunk. Paging now continues while the cursor is new, in either direction.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Document the new paging behavior in every user guide

This announces a user-visible change to get_events and list_memos—including complete large-calendar results and new paging failures—but the commit leaves README.md, README.ko.md, README.ja.md, and COMMANDS.md unchanged. Add matching descriptions (including the shared pager's effect on get_updated_events) so every supported guide documents the new result and failure contract as required by the repository review rule.

AGENTS.md reference: AGENTS.md:L171-L171

Useful? React with 👍 / 👎.

@ehs208

ehs208 commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you for your contribution!

@ehs208
ehs208 merged commit 634254c into ehs208:main Oct 18, 2026
2 checks passed
@ehs208 ehs208 mentioned this pull request Oct 18, 2026
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.

2 participants