Skip to content

fix(gapwheels): refresh cached list before reporting none fit (resolves #612) - #620

Merged
patrickballard merged 2 commits into
wheelgap:mainfrom
dianatofficial:feat/gapwheels-cache-refresh-612
Nov 21, 2026
Merged

patrickballard merged 2 commits into
wheelgap:mainfrom
dianatofficial:feat/gapwheels-cache-refresh-612

Conversation

@dianatofficial

Copy link
Copy Markdown
Contributor

Resolves #612

Summary

When --fix\ was used with a cached gap wheel list, if new wheels were published to the gap wheel index recently, wheelgap could falsely report:
\
wheelgap: note: --fix: no wheel on the gap wheel index fills these gaps
\
even though the index does contain wheels for those gaps.

This PR implements the requested two-phase lookup and dedicated cache TTL:

  1. Fresh retry before concluding no wheels fit:
    • If the cached gap wheel list yields >= 1\ fills for the current run, it answers immediately with 0 network calls (preserving fast cached runs).
    • If the cached list yields 0 fills for this run, wheelgap makes a single request (\gapwheels.fetch()) to fetch the fresh gap wheel list from \pypi.fetch_gap_wheels()\ and saves it if \write_cache\ is enabled.
    • If that fresh fetch succeeds, it evaluates fills against the fresh list.
    • If that fresh fetch fails (e.g. network outage or timeout), it falls back to the cached list and outputs the fallback note:
      \wheelgap: note: --fix: no wheel on the gap wheel list fetched at HH:MM UTC fills these gaps; the list couldn't be refreshed\
    • If no cached list exists and fetch fails, it outputs \wheelgap: note: couldn't read the gap wheel list, so --fix has no suggestions\ (even with -q).
  2. Dedicated 1-hour cache lifetime for gap wheels:
    • Added \GAP_WHEELS_MAX_AGE = 60 * 60\ (1 hour) in \src/wheelgap/cache.py.
    • 1 hour was chosen because gap wheels are published frequently (often daily or multiple times a week), and 1 hour ensures fresh builds/releases are discovered promptly on the same day without causing stampedes across parallel CI matrix jobs.
  3. Documentation & Changelog:
    • Updated \docs/how-it-works.md#cache\ and \docs/cli.md\ (--fix\ section).
    • Added changelog entry in \CHANGELOG.md\ under ## Unreleased.
  4. Tests:
    • Added unit tests in \ ests/test_fix.py:
      • Cached list without wheel + live list with wheel: fill is found with 1 fetch.
      • Cached list with wheel: fill is found with 0 fetches.
      • Cached list without wheel + failing fetch: prints fallback note with \HH:MM UTC.
      • Cached list older than 1 hour: fetched again.
    • Added \ est_gap_wheels_cache_age_limit\ in \ ests/test_cache.py\ verifying \GAP_WHEELS_MAX_AGE.

…ap#612)

Fetch fresh gap wheels once if the cached list yields 0 fills for this run. Fall back to cached list with UTC timestamp note if fetch fails. Shorten gap wheels cache TTL to 1 hour (GAP_WHEELS_MAX_AGE) to avoid CI stampedes while picking up new wheels promptly.
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @dianatofficial, this looks good overall: a run the cached list already fills makes no request, a run it doesn't fill fetches once before saying "no wheel fills these gaps", and a failed refresh answers from the cached list with its fetch time, as #612 asked. The four cases in tests/test_fix.py and the age-limit test match the issue's list, and the PR says why you chose an hour.

One small thing to flag: the CHANGELOG bullet ends with (#612, …), the issue number. It should carry the PR number, (#620, …).

#612 is a help wanted issue, so Patrick will review and merge this one himself, and he'll sort out that bullet as part of it. Nothing more needed from you for now.

(Review assisted by Claude.)

…he MCP fix argument

A failed refresh of a cached gap wheel list that fills nothing is a run that couldn't ask the index, so its note is printed even with -q, like the unreadable-list note. docs/output.md and AGENTS.md still said the list is kept for 24 hours; the CHANGELOG bullet carries the PR number; gapwheels.look_up had no caller left. Tests: --online fetches every time and never answers from the cached list, and the MCP fix argument gets the refresh, the fallback note and the no-request path.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Collaborator

Thanks @dianatofficial! This does what #612 asks: a cached list that fills nothing is read again before wheelgap says nothing fits, a list that fills the gap makes no request, and the fallback note gives the cached list's time.

Adding to the earlier review, we've made these changes so it can go in:

  • The "couldn't be refreshed" note is shown even with -q, like the "couldn't read the gap wheel list" note beside it. Without it, a quiet run that couldn't ask the index read as "nothing fits".
  • docs/output.md and AGENTS.md still said 24 hours for the gap wheel list; they now say an hour.
  • The CHANGELOG bullet carries the PR number, (#620, …).
  • gapwheels.look_up() had no caller left and still returned a cached list unconditionally, so it is removed.
  • New tests for --online and for the MCP fix argument.

It'll merge once a final review passes.

(Review assisted by Claude.)

@patrickballard
patrickballard merged commit 42f4fa3 into wheelgap:main Nov 21, 2026
13 checks passed
@patrickballard

Copy link
Copy Markdown
Collaborator

Merged, thanks @dianatofficial! --fix now reads the gap wheel list again before it says nothing fits, so a wheel published an hour ago is found. The final review walked every path through the lookup and found nothing to change.

If you would like another, tracker#205 is open and unclaimed: the repo checker ends in "No packages were checked" for a pyproject.toml with [tool.uv] sources, which most uv projects have.

(Reply assisted by Claude.)

patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
…ched

wheelgap#620 removed gapwheels.look_up() and gave the cached gap wheel list a one-hour life. The hint now reads the cached list through look_up_cached(), which never fetches, so cached_list() is gone. Tests count fetches with the gap_wheels fixture and also cover: an expired or corrupt cached list (the plain line again), several filled cells, and no hint from a cached list with -q, --json, --offline, --index-url, a mirror, --no-binary or a private package. docs/output.md says the list is kept for an hour and that no line is not a statement that nothing fits.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
patrickballard added a commit to kunalkshah1/wheelgap that referenced this pull request Nov 21, 2026
CHANGELOG keeps both bullets. main's new check_lockfile test for a stale gap wheel list (wheelgap#620) read the note as the command line words it; through the MCP tool it now starts with 'the fix argument'.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--fix: "no wheel on the gap wheel index fills these gaps" can come from a day-old cached list

2 participants