Skip to content

fix(index): offline-first refresh-on-miss covers version-miss too#161

Merged
Sunrisepeak merged 1 commit into
mainfrom
fix/offline-first-refresh-on-version-miss
Jun 24, 2026
Merged

fix(index): offline-first refresh-on-miss covers version-miss too#161
Sunrisepeak merged 1 commit into
mainfrom
fix/offline-first-refresh-on-version-miss

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Problem

mcpp main's ci-linux failed on the LLVM toolchain step (on a docs-only merge, #160):

[error] package 'xim:llvm@20.1.7' not found
error: install failed: xlings install of 'xim:llvm@20.1.7' failed

This is a resolution failure (the local index doesn't list the version), not a download error.

Root cause

WS3's offline-first gate (ensure_official_package_index_fresh) refreshes only when the package file is missing locally. A stale-but-present llvm.lua that lacks the requested version (20.1.7) slips through → no refresh → "not found". toolchain installresolve_xpkg_path → that gate, so it's hit by any new-version install against a stale cached index.

Fix

In the install-failure path (exitCode != 0), refresh the xim index once before the existing direct-install retry — lazy refresh-on-miss:

  • Steady-state installs (package + version already local) succeed on the first try and never reach this path → stay offline (the Termux hang fix is preserved).
  • An actual miss (package or version) now triggers one refresh + retry.

Honors the "缺包/缺版本就刷新一次" intent at the version level, not just package-file level.

Build: clean self-host. The ci-linux LLVM toolchain step exercises this directly.

…e-miss

WS3's offline-first gate (ensure_official_package_index_fresh) refreshes the
index only when the package *file* is missing locally. A stale-but-present
index file that lacks the requested *version* slipped through: e.g.
`mcpp toolchain install llvm@20.1.7` on a cached sandbox whose llvm.lua
predates 20.1.7 resolved to 'package xim:llvm@20.1.7 not found' and never
refreshed (ci-linux LLVM-toolchain step, post-#155).

Fix: in the install-failure path (exitCode != 0), refresh the xim index ONCE
before the existing direct-install retry. This is lazy refresh-on-miss —
steady-state installs (package+version already local) succeed first try and
never reach here, so they stay offline; an actual miss (package OR version)
now triggers one refresh + retry. Honors the '缺包/缺版本就刷新一次' intent
at the version level too.

Build: clean self-host.
@Sunrisepeak Sunrisepeak merged commit 1c5079a into main Jun 24, 2026
5 checks passed
@Sunrisepeak Sunrisepeak deleted the fix/offline-first-refresh-on-version-miss branch June 24, 2026 01:18
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.

1 participant