Skip to content

test(cache-metrics): Pin the paginated cache URL the caller sends (#962) - #2634

Merged
zackees merged 1 commit into
masterfrom
ci/962-cache-033-cache-metrics-pagination
Oct 27, 2026
Merged

zackees merged 1 commit into
masterfrom
ci/962-cache-033-cache-metrics-pagination

Conversation

@zackees

@zackees zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member

Refs #962. Clears one ci-lint precheck VIOLATION against ci/test_cache_metrics.py.

RED

ci-lint precheck on master (pin a1917ce7…, the pin in ci.toml) reports:

[CACHE-033] VIOLATION ci/test_cache_metrics.py:206
    what:  reads the Actions cache without pagination; GET /repos/{repo}/actions/caches
           returns at most one page, so this undercounts the cache footprint silently

The finding lands on the test's gh mock, whose match string is the bare prefix
"/actions/caches?". The real reader (ci/cache_metrics.py:332) already paginates —
gh("api", f"repos/{repo}/actions/caches?per_page=100", "--paginate", "--slurp") — but the
mock accepted any cache URL, so nothing in the test held the caller to that contract.

GREEN

Commit c85ae6565 makes the mock match the exact URL the caller sends
(/actions/caches?per_page=100) and assert --paginate and --slurp are present, so a
future change that drops pagination fails the test instead of silently undercounting.

uv run --no-project python -m unittest discover -s ci -p test_cache_metrics.py   # Ran 17 tests ... OK
uvx ruff check ci/test_cache_metrics.py                                          # All checks passed!
ci-lint precheck: 19 -> 17 violations (this finding and the merged #2630 native-build
                  finding are gone, 0 new; 558 approved exceptions unchanged)

Test-only; no docs/features.md line.

The gh mock matched the bare '/actions/caches?' prefix, so it accepted a
cache read with no pagination marker. Match the exact URL the caller
sends (per_page=100) and assert --paginate/--slurp, so a future change
that drops pagination fails the test instead of silently undercounting.
Clears the [CACHE-033] ci-lint precheck finding.
@zackees
zackees enabled auto-merge October 27, 2026 13:24
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator. Test-only, based on current origin/master (eda8d426c), ci-lint precheck 19 -> 17 with this [CACHE-033] finding gone and no new one, test_cache_metrics.py 17 tests OK, ruff check clean, auto-merge on.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit a028214 Oct 27, 2026
32 checks passed
@zackees
zackees deleted the ci/962-cache-033-cache-metrics-pagination branch October 27, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant