Skip to content

Repo checker: a pixi.lock is no longer offered as checkable, and a lock that needs the index keeps the page usable - #190

Merged
patrickballard merged 1 commit into
wheelgap:mainfrom
bfs2021:fix/checker-needs-index
Nov 20, 2026
Merged

patrickballard merged 1 commit into
wheelgap:mainfrom
bfs2021:fix/checker-needs-index

Conversation

@bfs2021

@bfs2021 bfs2021 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Problem

The repo checker offers a pixi.lock as checkable and then red-fails with an API-oriented error. OFFLINE in site/check/driver.py listed pixi.lock among the lockfiles the page checks without asking an index, but wheelgap can't read a pixi.lock offline: it records only the file pixi picked for each of the lock's platforms, so wheelgap looks every PyPI package up for its pinned version, and offline=True refuses it (test_pixi_lock_offline_needs_the_index in wheelgap's own tests pins that contract). So driver.check() returned wheelgap's offline=True: … set offline=False message as a source error, onResult() showed only the red status line and returned before the results section, and with no other checkable lockfile the page was dead-ended. The same could happen with a poetry.lock or pdm.lock that doesn't list every package's files.

Fixes #185

Root cause

OFFLINE in driver.py claimed more than the page can deliver: pixi.lock isn't readable offline at all, and the other listed kinds are only readable offline when each package lists its files — a condition driver.check() never verified before calling api._check_lockfile(path, targets, online=False, offline=True), whose require_offline() failure it reported as kind: "source" (an unreadable lockfile), hiding the results section via the early return in onResult().

Fix

  • site/check/driver.py: took pixi.lock out of OFFLINE and reworded the comment above it. plan() now marks a pixi.lock "offline": false, so pickLockfile() prefers a checkable lockfile elsewhere in the repo, runCheck() answers needsIndex() without fetching, and the picker lists it as "(not readable here)". For the listed kinds, check() now runs sources.load_file() and offline.require_offline([source]) first and returns {"kind": "needs-index", "error": …} when the lock would need the index (bad TOML or an unreadable file still returns kind: "source" as before); it doesn't match wheelgap's message text, it calls wheelgap's own hook.
  • site/check/check.mjs: onResult() handles result.kind === "needs-index" through needsIndex(state.lockfile), which keeps the Targets section and its Lockfile picker on screen so a repo with both a pixi.lock and a uv.lock can switch; noLockfile() no longer promises to read a pixi.lock (and its sentence points pixi projects at uvx wheelgap).

Testing

Per the README's test commands (wheelgap 0.13.0, the version worker.mjs pins):

  • Red first, with only the test change in place: uvx --python 3.14 --with "wheelgap==0.13.0" [email protected] tests/test_check_driver.py → 2 failed, 9 passed — test_plan_picks_files_like_suggest_targets (pixi.lock was marked "offline": True) and the new test_check_reports_a_lockfile_that_needs_the_index_for_its_missing_files ('source' != 'needs-index').
  • Green after the fix: same command → 11 passed in 0.19s. The new test covers plan() marking a pixi.lock not offline, check() returning needs-index for a pixi.lock, and check() returning needs-index for a poetry.lock whose package lists no files; test_check_refuses_lockfiles_that_need_an_index still pins the bad-TOML → source mapping.
  • node --test tests/site/check-logic.test.mjs → 16 pass (check-logic.mjs is untouched; run as a regression check).

Not run: the browser page itself (no browser test harness in this repo — check.mjs's onResult()/noLockfile() changes are covered indirectly by the logic tests only), and uv.lock-in-subfolder preference is exercised through the updated plan()/pickLockfile() behavior rather than a live GitHub fetch.

…index when the lock needs the index

A pixi.lock records only the file pixi picked for each of the lock's
platforms, so the offline check needs PyPI lookups the page doesn't
make: it was listed as checkable, then failed with wheelgap's
API-oriented "set offline=False" error and hid the results section.
plan() now marks it not offline, so a checkable lockfile elsewhere is
preferred, the picker lists it as (not readable here), and the page
says it needs PyPI lookups with the uvx command. A poetry.lock or
pdm.lock that leaves a package's files out gets the same answer:
check() runs wheelgap's own require_offline() first and reports
needs-index, which onResult() handles through needsIndex() and keeps
the Targets section and its Lockfile picker on screen.
@patrickballard

Copy link
Copy Markdown
Contributor

Merged, thanks @bfs2021! Deciding "needs PyPI lookups" with load_file() plus require_offline() instead of matching wheelgap's error text is the robust way to do it, and keeping the Lockfile picker on screen makes the page much less of a dead end. The site redeploys in a few minutes.

If you'd like another in the checker, #186 has no PR yet: letting it check requirements files, pyproject.toml and Pipfile.lock by looking packages up on PyPI from the browser. It's the natural next step after this one.

(Review assisted by Claude.)

patrickballard added a commit to kunalkshah1/tracker that referenced this pull request Nov 20, 2026
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.

Repo checker: a pixi.lock is offered as checkable, then fails with wheelgap's offline=True error

2 participants