Repository navigation
Description
Problem
A first 7-day project review with no intake snapshot sends 49 GitHub requests (PR #6586). The limit of #4692 for a 7-day collection is 45 requests.
The listing reader of the review (_ReviewListing in src/devops_cli/roadmap/project_review/readers.py) reads the snapshot that intake keeps. With no such snapshot, it reads each issue and pull request that changed at or after the window start. The review writes no snapshot, so each review with no intake snapshot reads the whole window again.
Scope
- The review keeps its own listing snapshot, in a file that only the review writes. Each snapshot file keeps one writer (perf(roadmap): status lane reads the snapshot, skips idle stops #4854).
- The review reads only the gap since the watermark of its snapshot.
Acceptance criteria
- Test first: a test shows that a second review over a new window reads only the gap pages. The test fails on the base.
- A test: a 7-day review with no intake snapshot stays at or under 45 GitHub requests.
Dependencies
Source
Source: #6586
Alternatives check of 2026-11-21: not-applicable.
Class: perf, no search.
Tool: none found.
Proposed design
Problem statement
A 7-day project review with no intake snapshot sends 49 GitHub requests. The limit of #4692 for a 7-day collection is 45 requests. The review reads the snapshot that intake keeps and writes no snapshot, so each review reads the whole window again. A snapshot with an old watermark also makes the review read more pages than the window needs. The review reads about 25 run pages. This change gives the review its own snapshot, reads the gap from the later of its watermark and the window start, and reads the run counts with one request for each status.
Acceptance criteria
Requirement: Review snapshot store
The project review SHALL write its listing snapshot to a store that only the review writes.
Scenario: A review writes the review snapshot
- WHEN A test runs one review over a 7-day window with an empty review store and an empty intake store.
- THEN The review store holds one snapshot for the repository with the schema key
LISTING_SCHEMA_KEY, and the intake store holds no file.
Requirement: Gap read from the review watermark
The project review SHALL read only the issues and pull requests changed at or after the watermark of its own snapshot.
Scenario: A second review over a new window reads only the gap pages
- WHEN A test runs a review over a 7-day window that starts after the watermark of the review snapshot, and runs the same review with an empty review store.
- THEN The
listingcount of the first run is lower than thelistingcount of the run with the empty store, and its firstlistingrequest namessince=<watermark>.
Requirement: Gap start at the window start
The project review SHALL read the gap from the window start when the watermark of its snapshot is before the window start.
Scenario: A stale review snapshot reads from the window start
- WHEN A test runs a review over a 7-day window with a review snapshot whose watermark is 3 weeks before the window start, and runs the same review with an empty review store.
- THEN The
listingcount of the first run equals thelistingcount of the run with the empty store, and eachlistingrequest names asinceat or after the window start.
Requirement: Second 7-day review under the request limit
A 7-day project review MUST send at most 45 GitHub requests when the review snapshot exists and the intake snapshot does not.
Scenario: A second 7-day review stays under 45 requests
- WHEN A test runs a 7-day review with the review snapshot of the previous review and no intake snapshot, and sums the counts of
Reads. - THEN The sum of the counts in
Reads.countsis at most 45.
Requirement: First 7-day review under the request limit
A 7-day project review MUST send at most 45 GitHub requests when no snapshot of any kind exists.
Scenario: A first 7-day review stays under 45 requests
- WHEN A test runs a 7-day review with an empty review store and an empty intake store, and sums the counts of
Reads. - THEN The sum of the counts in
Reads.countsis at most 45.
Requirement: Run counts with one request for each status
The project review SHALL read the count of the Actions runs of each status with one GitHub request.
Scenario: The review reads the run counts of a window
- WHEN A test runs a review over a window whose runs number more than the result cap, and counts the
github_runsreads. - THEN The
github_runscount is at most 5.
Requirement: One writer for each snapshot file
The project review MUST NOT write the snapshot file that intake writes.
Scenario: A review leaves the intake snapshot unchanged
- WHEN A test runs a review with an intake snapshot that holds a record of an older schema key.
- THEN The intake snapshot file is byte-identical after the review, and the review store holds a new snapshot.
Requirement: Snapshot of another schema
The project review MUST read the whole window when its own snapshot has a schema key other than LISTING_SCHEMA_KEY.
Scenario: A review snapshot of an older schema is replaced
- WHEN A test runs a review with a review snapshot whose
schema_keyis notLISTING_SCHEMA_KEY. - THEN Each
listingrequest names asinceat or afterstart, and the review store holds a snapshot withLISTING_SCHEMA_KEY.
Existing Tool Considered
The alternatives check of 2026-11-21 in the issue body gives not-applicable with no tool, for the class perf with no search (see the block). No open, maintained tool or library covers a GitHub issue-listing snapshot with a watermark. The change reuses the project's SnapshotStore and IncrementalListing in src/devops_cli/roadmap/stores/listing_snapshot.py, so it builds no snapshot code of its own. It adds a review store directory, one save call, the clamp of the gap start and the read of the run counts: about 40 lines of code, about 80 lines of test, about 15,000 tokens to build, keep and fix, and about 3 hours of elapsed time.
Key questions
- Does the project review write the snapshot that intake keeps?: No.
_ReviewListing.readloads the snapshot, merges the changed records and returns them. It calls nosave, and the docstring of the module states that the review never writes a snapshot. [sources: src/devops_cli/roadmap/project_review/readers.py:97, src/devops_cli/roadmap/project_review/readers.py:110] - Where does the project review keep its listing snapshot?: In a
FileSnapshotStoreunderlisting-reviewin the roadmap state directory. The review reads its own store and the intake store, and writes only its own store. (best practice) [sources: src/devops_cli/roadmap/stores/listing_snapshot.py, src/devops_cli/roadmap/project_review/readers.py:97]- Chosen: A separate review store under
listing-review. Each snapshot file keeps one writer (perf(roadmap): status lane reads the snapshot, skips idle stops #4854), aslane_listingdoes for each lane of the Service. - Rejected: The intake store. Two writers would write one file, which perf(roadmap): status lane reads the snapshot, skips idle stops #4854 forbids.
- Rejected: A new snapshot class.
SnapshotStorealready holds the schema key, the watermark and the records.
- Chosen: A separate review store under
- Which watermark does the review write after a read?: The earlier of the read start and the newest
updated_atread, less the overlap.IncrementalListing._keepdoes the same. The read starts at the window end, so the next gap is the time since the last review. (best practice) [sources: src/devops_cli/roadmap/stores/listing_snapshot.py]- Chosen: The earlier of the read start and the newest change, less the overlap. A record changed during the read is at or after the watermark, so the next read gets it.
- Rejected: The window start. The next gap would cover the whole window again, and the snapshot would save nothing.
- Rejected: The window end with no overlap. A local clock ahead of GitHub's would skip a change at the boundary.
- Which gap start does the review read when the snapshot watermark is older than the window?: The later of the watermark and the window start. The held records cover the time before the watermark, so the read from the window start leaves no hole. (best practice) [sources: src/devops_cli/roadmap/project_review/readers.py:110, src/devops_cli/roadmap/stores/listing_snapshot.py:69]
- Chosen: The later of the watermark and the window start. A 3-week-old watermark reads 40 listing pages for a 7-day window. The window start reads 19.
- Rejected: The watermark alone. A stale watermark reads about 70 requests for a 7-day window.
- Rejected: The window start alone. Each review would read the whole window again.
- Which snapshot does the review read when its own store is empty?: Its own store first, then the intake store, then the whole window. The review writes only its own store. (best practice) [sources: src/devops_cli/roadmap/project_review/readers.py:110, src/devops_cli/roadmap/stores/listing_snapshot.py]
- Chosen: Own store, then intake store, then the window. The review keeps the intake reuse and adds its own snapshot.
- Rejected: Own store only. A repository with an intake snapshot and no review snapshot would read the whole window once more.
- Rejected: Intake store only. The review writes no snapshot, so each review reads the whole window again.
- How does the first review, with no snapshot of any kind, stay at or under 45 requests?: It reads the count of the Actions runs of each status with
per_page=1, in 4 requests in place of about 25 run pages. The reply on this issue measures 2,072 runs as success 1,927, failure 29, cancelled 104 and in_progress 12. (best practice) [sources: src/devops_cli/roadmap/project_review/readers.py]- Chosen: One count request for each status with
per_page=1.total_countis exact above the cap of 1,000, and 4 requests replace about 25. - Rejected: Keep the per-run pages and the split read. About 25 run pages leave no room under 45 for a 19-page listing.
- Rejected: One total count with no status filter. It gives no count for each status.
- Chosen: One count request for each status with
Fit
Fits in one pull request.
Suspected block
None.
Activity
dan-petty commentedon Nov 21, 2026
The review exceeds the 45-request budget for a 7-day window, causing performance degradation.Both items change how the project review reads data, but #4692 adds a catalog for facts while this item adds a snapshot file so the review reads only the gap.devops-cli-service commentedon Nov 21, 2026
Next step: the alternatives check records a verdict. See the section Proposed design of the body.
dan-petty commentedon Nov 21, 2026
Two more budget points from the second review of PR #6586. Both are on main (752c6ed), in
src/devops_cli/roadmap/project_review/readers.py. Point 1 is necessary for the first review, which has no snapshot of its own: with the listing at 19 pages, 5 + 25 more requests give 49.read_runsreads each run page, and it discards and reads again a slice whose first page has more than 1,000 runs (2 discarded pages in the 7-day run).total_countis exact also above the cap of 1,000 (2,072 = 750 + 598 + 724), andper_page=1with astatusfilter gives one count in one request (success 1,927, failure 29, cancelled 104, in_progress 12, sum 2,072). If the run facts need only the counts, about 4 requests replace about 25._ReviewListing.readreads the gap from the watermark, not from the start. A watermark 3 weeks old reads 40 listing pages for a 7-day window (about 70 requests), but no snapshot gives 19 pages. The fix: read from the later of the watermark and the window start.Measured:
--last 7dsent 48 requests in 110.8 s. The 7 days to 2026-11-11T14:51:23Z sent 60 (listing 34). A 1-day window on 2026-10-15 sent 64 (listing 54).devops-cli-service commentedon Nov 21, 2026
Next step: the stage job writes the plan of the item. See the section Proposed design of the body.
devops-cli-service commentedon Nov 21, 2026
Plan state: branch
perf/6603-the-project-review-keeps-its-own, draft pull request #6619. The pull request plans the item and closes no issue. The stage job and the step fix-plan edit this comment, and a comment of each run tells what the run did.The task groups, with the tokens of the inputs of each step, for a budget of 64000 tokens:
18 remaining items
devops-cli-service commentedon Nov 22, 2026
The draft pull request #6716 holds the final title and body. In mode
onofroadmap.fix_checks.mode, the watch row marks it ready when its checks pass, and a fix-checks Job repairs a failed check whose name gives the class test, lint or types. In each other case the watch row stops the item: another failed check, a cancelled check, a conflict, a fix-checks Job that ended with no repair, or another mode.Spend: 279 model requests, 28236249 input tokens, 153118 output tokens.
perf(roadmap): the project review keeps its own listing snapshot (#6603)
docs(openspec): archive the change (#6603)
perf(roadmap): the project review keeps its own listing snapshot (#6603)
fix(roadmap): close the snapshot hole and count runs under the cap
devops-cli-service commentedon Nov 22, 2026
Released in v0.191.1: https://github.com/dan-petty/devops-cli/releases/tag/v0.191.1
devops-cli-service commentedon Nov 22, 2026
Live since 2026-11-22 02:54 UTC