fix(index): offline-first refresh-on-miss covers version-miss too#161
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mcpp main's
ci-linuxfailed on the LLVM toolchain step (on a docs-only merge, #160):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-presentllvm.luathat lacks the requested version (20.1.7) slips through → no refresh → "not found".toolchain install→resolve_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: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.