Skip to content

bug: unbounded paginationΒ #415

Description

@exploreriii

πŸ§‘β€πŸ’» Intermediate Issue β€” a complex task spanning multiple modules, with real design decisions to own.
Time: ~25 hours Β· Prerequisites: comfortable navigating this repo (a completed beginner issue is the usual route; demonstrated CI/CD proficiency substitutes for workflow-focused issues).
We expect more than "it works": maintainable code that fits the existing architecture.

The task

Problem:
pagination.py:56-86 advances with cursor = next_cursor and loops while has_next is true, without ever checking that the cursor actually moved.

This means we could get unbounded requests that burns the rate-limit budget while results grows without bound

The max_pages guard would catch it, but no call site passes it: ../hiero-hackers-analytics/src/hiero_analytics/data_sources/github_ingest/_common.py:109, contributors.py:95 and :138, pull_requests.py:89, hip_references.py:82 all call paginate_cursor(page) bare.

What done looks like:
We should ensure the errors are handled correctly

for example, add the error type next to DEFAULT_PAGE_SIZE:
class CursorStalledError(RuntimeError):
"""The API claimed another page but gave no cursor that advances to it."""

Then ensure this is used appropriately and raised - a transient GitHub hiccup self-heals on the retry, and a persistent one surfaces loudly

We should ensure there are pagination tests and downstream effects are covered

Modules involved / constraints:

How to work on this

  1. Claim it: comment /assign and wait to be assigned β€” unassigned PRs are closed automatically.
  2. Get a plan: once assigned, comment @coderabbitai plan for a draft plan, then do your own investigation β€” docs/architecture.md maps the layers and their rules.
  3. Propose your approach as a comment before coding. A paragraph is enough; early feedback here routinely saves days of rework.

πŸ€– AI: tools are welcome; verified work is required β€” you can explain every line and defend every design choice. See the AI policy. Fully automated bot PRs are closed.

Worth knowing about this repo before you design:

  • The layer rules in docs/architecture.md are strict β€” review will hold your solution to them.
  • Tests mirror src (tests/<pkg>/test_<module>.py), and the output-contract test pins the pipeline output surface β€” if your change adds or renames outputs, update the contract deliberately.

Before opening your PR:

  • I proposed my approach on this issue and incorporated any feedback
  • The solution fits the existing architecture and layer rules, and is clear enough for others to debug without me
  • Tests cover the happy path, edge cases, and error handling (testing guide)
  • I reviewed my own diff line by line; scope is limited to this issue
  • Workflow checks pass β€” CI green, signed commits, linked issue

Stuck? Comment here with what you've tried β€” see getting help.

Activity

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

Metadata

Metadata

Assignees

Labels

intermediateA broader or larger issue requiring self-research and often, testing.pythonTouches Python code (src/, tests/)

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions