Skip to content

Conversation

@galligan
Copy link
Contributor

@galligan galligan commented Jan 23, 2026

Summary

  • Enforce cursor TTL via maxAgeMs in pagination helpers.
  • Add/adjust tests for expiration behavior.
  • Document the new option in the CLI README.

Changes

  • packages/cli/src/types.ts
  • packages/cli/src/pagination.ts
  • packages/cli/src/tests/pagination.test.ts
  • packages/cli/README.md

Testing

  • Not run (not requested).

This was referenced Jan 23, 2026
Copy link
Contributor Author

galligan commented Jan 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@galligan galligan added the bug Something isn't working label Jan 23, 2026
@galligan galligan marked this pull request as ready for review January 23, 2026 20:25
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@greptile-apps
Copy link

greptile-apps bot commented Jan 23, 2026

Greptile Summary

  • Implements cursor TTL (time-to-live) enforcement in the CLI pagination system by adding maxAgeMs option to prevent stale cursors from being used
  • Updates the loadPaginationState function to validate cursor age and return undefined for expired cursors, maintaining backward compatibility
  • Enables previously skipped TTL tests and adds new test coverage to verify both expired cursor rejection and fresh cursor acceptance

Important Files Changed

Filename Overview
packages/cli/src/pagination.ts Core TTL enforcement logic that checks cursor timestamps against maxAgeMs and returns undefined for expired cursors
packages/cli/src/tests/pagination.test.ts Removes skipped test placeholders and adds comprehensive TTL validation testing for both expired and fresh cursors

Confidence score: 4/5

  • This PR is generally safe to merge with minor considerations around edge case handling
  • Score reflects solid implementation but deducted one point due to potential edge cases around timestamp handling and lack of validation for maxAgeMs parameter bounds
  • Pay close attention to packages/cli/src/pagination.ts for the TTL validation logic and ensure the timestamp comparison is robust

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant "loadCursor"
    participant FileSystem
    participant "saveCursor"
    participant API
    
    User->>CLI: "command --next"
    CLI->>loadCursor: "Load pagination state"
    loadCursor->>FileSystem: "Check if cursor.json exists"
    FileSystem-->>loadCursor: "File exists"
    loadCursor->>FileSystem: "Read cursor.json content"
    FileSystem-->>loadCursor: "JSON content"
    loadCursor->>loadCursor: "Validate structure & TTL"
    loadCursor-->>CLI: "PaginationState"
    CLI->>API: "Query with cursor"
    API-->>CLI: "Results with new cursor"
    CLI->>saveCursor: "Save new cursor state"
    saveCursor->>FileSystem: "Create directories if needed"
    saveCursor->>FileSystem: "Write new cursor.json"
    CLI->>User: "Output results"
Loading

@galligan
Copy link
Contributor Author

Checked for new feedback; no changes needed. Stack still up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants