Skip to content

fix(roadmap): scoped intake reads a bounded page count #3670

Closed

Description

@dan-petty

Problem

A scoped update can read every issue of the repository. Each webhook delivery that runs an intake update then costs a full listing. Evidence from #3497, in the window 2026-11-03T15:05Z to 2026-11-04T15:05Z:

  • _execute_scoped runs with no row (src/devops_cli/server/service.py:559), so its requests count as other. devops-cli has 4683 requests in that row.
  • candidates and items read _every_issue (src/devops_cli/roadmap/github_store.py:698, :665), and _every_issue reads state=all (:1019). That is about 35 pages for this repository. This is inferred from the highest issue number.

Expected

Scoped intake has a bounded read. It reads the issue of the event and a window of recent changes, up to a set number of pages. The reconciling poll stays the full read, as ADR 0017 states, so a scoped update hides no change.

The refine plan on #3497 proposes a setting with a limit of 10 pages for one scoped run. The plan of this item confirms the limit against the code, and states what the update does when it gets to the limit.

Acceptance criteria

  • A test: scoped intake reads a bounded number of pages.

Existing tool considered

The GitHub issue listing has the since parameter, and the session already reads pages. This change adds no library.

Related

Split from #3497, which holds the evidence. It holds criterion 6 of that issue.

Related: #3497, #1533

Source: #3497

Proposed design

Problem statement

A scoped intake run lists every issue of the repository. _every_issue reads state=all, so one webhook delivery costs about 35 pages, and devops-cli counts 4683 requests in the other row. The change bounds the pages that a scoped run reads to the issue of the event and a window of recent changes. The reconciling poll keeps the full read, so the scoped run hides no change.

Acceptance criteria

Requirement: Bounded page count in a scoped run

A scoped intake run SHALL send at most roadmap.intake.scoped_max_pages issue-listing page requests.

Scenario: A scoped run stops at the page limit

  • WHEN A scoped intake run lists recent changes and the page limit is 10.
  • THEN The store sends at most 10 page requests and sends no 11th request.

Requirement: Full read in the reconciling poll

The reconciling poll MUST read the issue listing to its last page.

Scenario: The poll reads every page

  • WHEN The poll lists the issues of a repository that has more pages than the scoped limit.
  • THEN The store follows each next-page link and returns the issues of every page.

Requirement: Warning at the page limit

A scoped run that stops at the page limit SHALL log one warning that names the limit and the repository.

Scenario: The store reaches the last permitted page

  • WHEN The store reads the last permitted page and GitHub reports a next page.
  • THEN The run logs one warning with the limit and the repository, and the run completes without error.

Requirement: Page limit setting

The page limit of a scoped run SHALL be the setting roadmap.intake.scoped_max_pages, with a default of 10.

Scenario: The setting is absent

  • WHEN The setting is absent from the configuration.
  • THEN A scoped run sends at most 10 page requests.

Existing Tool Considered

No alternatives check has run. The GitHub REST issue listing covers the need: it has the since parameter to bound the window and per_page with Link pagination to bound the pages, and the store already reads pages. It lacks a request for the last N changes, so the client must stop at the page limit. The change adds no library and no new dependency.

Key questions

  • Which number bounds the pages of one scoped run?: 10 pages, held in the setting roadmap.intake.scoped_max_pages. (best practice) [sources: src/devops_cli/roadmap/github_store.py:1104, docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]
  • What does a scoped run read?: The issue that the event names and the issues updated since the last reconciling poll, up to the page limit. (best practice) [sources: docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]
    • Chosen: The event issue and the issues updated since the last poll. The scoped update sees the event and every change since the last full read.
    • Rejected: The event issue only. A related change waits for the next poll.
    • Rejected: Every issue. It is the full listing that the change removes.
  • What does a scoped run do when it reaches the page limit?: It stops after the last permitted page. It logs one warning that names the limit and the repository. It returns the issues that it read, and the next reconciling poll reads the full listing. (best practice) [sources: docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]
    • Chosen: Stop and warn. The bound stays, and the poll reconciles the rest.
    • Rejected: Fall back to a full read. It removes the bound and costs the pages that the change saves.
    • Rejected: Fail the round. A busy repository would block intake.
  • Does the reconciling poll keep the full read?: Yes. The poll reads every page, so a scoped run that stops at the limit hides no change. (best practice) [sources: docs/adr/0017-each-subscribed-webhook-event-runs-the-update-scoped-to-it.md]
    • Chosen: Full read in the poll. ADR 0017 makes the poll the reconciling path.
    • Rejected: Bounded read in the poll. A change after the limit would never reach the roadmap.
  • Which calls read every issue today?: items at line 719, candidates at line 752 and the open-issue listing at line 816. All three call _every_issue at line 1104, which reads state=all. [sources: src/devops_cli/roadmap/github_store.py:719, src/devops_cli/roadmap/github_store.py:752, src/devops_cli/roadmap/github_store.py:816, src/devops_cli/roadmap/github_store.py:1104]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Alternatives check of 2026-11-08: partly.
Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub), Apache-2.0, last activity 2026-09-25, maintained.

Activity

  1. added
    source/agent
    on Nov 5, 2026
  2. added
    type/bug
    scope/roadmap
    status/new
    value/medium
    effort/low
    on Nov 5, 2026
  3. dan-petty commented on Nov 5, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

  4. added
    priority/p2-medium
    on Nov 5, 2026
  5. added
    status/ready
    and removed
    status/new
    on Nov 7, 2026
  6. devops-cli-service commented on Nov 7, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 0550497 (see proposed design in issue body).

  7. devops-cli-service commented on Nov 8, 2026

    @devops-cli-service
    Contributor

    Alternatives check: partly

    Reason: gidgethub, the async GitHub API library that the project's session already sends its GitHub requests through (ADR 0006), is an open, maintained library that makes the issue-listing requests with the REST parameters the scoped read needs (since, per_page, page URLs) without hiding the GitHub API, so no new library is required. It supplies no page cap, no warning when a limit is reached and no roadmap.intake.scoped_max_pages setting, so the stop-at-the-limit behaviour and its test stay in the store's own code, as the issue proposes.

    Tool: gidgethub/gidgethub (https://github.com/gidgethub/gidgethub)

    • License: Apache-2.0
    • Last activity: 2026-09-25
    • Maintained: yes

    Covers:

    • Makes the REST issue-listing requests with the query parameters the API documents, such as since and per_page, without a model layer in the way
    • Already carries the session's GitHub requests, so the page-by-page reads of the store use it today
    • Keeps the request path thin, so a change of the API needs no library release

    Lacks:

    • No option that caps the number of pages a caller reads
    • No stop-at-the-limit warning that names the limit and the repository
    • No roadmap.intake.scoped_max_pages setting or default
    • No test that a scoped run sends at most N page requests

    Tools considered:

    Searches run:

    • gidgethub pagination getiter GitHub API Python, results: 5
    • GitHub REST API list issues since parameter per_page Link pagination, results: 5
    • "List repository issues" REST API "since" "per_page" docs.github.com, results: 5
    • github docs REST issues list issues for a repository parameters since per_page page, results: 5
    • GitHub REST API list repository issues documentation, results: 5
    • docs.github.com/en/rest/issues/issues list issues since parameter, results: 5
    • octokit paginate stop after N pages limit request, results: 5
    • GitHub REST API reference issues endpoint, results: 5
    • github issues api "since" parameter only issues updated after a certain time, results: 5
    • site:docs.github.com REST API issues list issues for a repository, results: 5

    Sources:

    Checked on 2026-11-08. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    owner/agent
    on Nov 11, 2026
  9. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Scope from the project brain plan (2026-11-11)

    This item is child 2 of the project brain plan #4624. It keeps its title and its parent #3497. The solution changes as follows.

    Measured (24 h): the Service rows other (scoped updates) and intake sent 27,138 GitHub requests (11,014 counted 200 answers and 16,113 answers of 304) for about 800 intake rounds (799 successes). The Service reads every issue in each round (_every_issue, twice a round), because only the CLI intake uses IncrementalListing (src/devops_cli/commands/roadmap.py:215). The snapshot also drops at each package version (src/devops_cli/roadmap/stores/listing_snapshot.py:173), and 117 releases came in 7 days.

    New solution:

    New acceptance criteria:

    • A test counts at most 2 listing requests for a scoped round with a warm snapshot.
    • A test: a new package version with the same IssueRecord schema reuses the snapshot, and a schema change drops it.
    • Live, 24 h after the rollout: sum(increase(devops_cli_github_requests_total{job="roadmap-service",row=~"other|intake"}[24h])) is under 3,000 (27,138 before).

    The tiered cache child of #4624 (#4668) builds on this item: it adds the shared Valkey tier behind the same seam.

  10. dan-petty commented on Nov 11, 2026

    @dan-petty
    OwnerAuthor

    Changed solution

    The plan of this item changes. The title stays.

    • Old solution: a cap of 10 pages on the listing of a scoped round. Rejected: a capped listing holds only the newest issues, and intake compares each candidate with every item. The duplicate check would then miss old items.
    • New solution: the intake rounds of the triage lane and the scoped intake of each delivery read every issue through IncrementalListing and FileSnapshotStore (perf(roadmap): intake reads only the issues that changed #4448) in listing of the state directory of the Service, on its volume. A round with a kept snapshot reads only the issues changed since the watermark: one request when 100 or fewer changed. The full read every 24 hours stays. The snapshot keys to the schema of IssueRecord (the first 16 hex characters of the sha256 of its JSON schema), not to the package version, so a release that keeps the schema keeps the snapshot.

    Evidence, Prometheus, 2026-11-11: the rows intake and other of the Service sent 28,317 GitHub requests in 24 hours. In the last 2 hours the triage lane ran 78 rounds and sent 2,568 GET requests, about 33 a round. #4522 already moved the requests of the scoped intake from other to intake.

    Acceptance:

    • A test: a scoped round with a kept snapshot sends at most 2 listing requests.
    • A test: a new package version with the same IssueRecord schema keeps the snapshot, and another schema drops it.
    • Live, 24 hours after the rollout: sum(increase(devops_cli_github_requests_total{job="roadmap-service",row=~"other|intake"}[24h])) is less than 3,000.
  11. added
    status/in-progress
    status/in-review
    and removed
    status/ready
    status/in-progress
    on Nov 11, 2026
  12. removed
    status/in-review
    owner/agent
    on Nov 11, 2026
  13. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 19:36 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/roadmapsource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions