Skip to content

feat(wpm): bundle packages via installs: [...] index field (+3 latent include fixes) - #1529

Merged
caomengxuan666 merged 4 commits into
mainfrom
feat/wpm-bundle-and-include-fixes
Nov 7, 2026
Merged

caomengxuan666 merged 4 commits into
mainfrom
feat/wpm-bundle-and-include-fixes

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

What

  1. Bundle support: an index entry with no artifacts and an installs: [...] array now expands at the install entry point. wpm install build-base where build-base = {kind: bundle, installs: [mingw, cmake, ninja, bsdtar]} installs the group in order. Cycle-guarded (chain printed like alias cycles, depth-capped), deduped order-preserving — a member listed twice or already installed downloads at most once, because the existing already_installed receipt skip stays on the per-package path. wpm info gains Bundle of: (and installs[] in --json).

  2. Latent include fixes (needed a full rebuild on the current toolchain to surface): cpio.cpp/logger.cpp use localtime_s/strftime and terminfo_table.h names std::string_view without including <ctime>/<string_view> — they only compiled while stale objects from an older STL sat in the build dir. date.cpp already carries the same explicit include.

Verification

  • Live, in an isolated root: wpm install test-bundle (make+grex) printed the expansion line, skipped installed make without re-download, installed grex, summary requested=2 failed=0; a cycle-a <-> cycle-b pair is refused with the chain in the message.
  • wpm.* ctest: 61 passed / 14 failed — identical on pristine origin/main on this machine (environment-bound), so the diff does not move the suite.

Intended consumer (index side, separate PR in wpm-source)

mingw (winlibs x86_64 GCC 16.2 zip, direct GitHub release URL + sha256) and build-base bundle — turns wpm install build-base + rubash/niubash into a complete no-MSYS configure && make toolchain story (the zlib configure→make→test loop was driven end-to-end under rubash with this shape).

A full rebuild on the current toolchain exposes three TUs that only
compiled while stale objects from an older STL sat in the build
directory: cpio.cpp and logger.cpp call localtime_s/strftime and
terminfo_table.h names std::string_view without including
<ctime>/<string_view>. date.cpp already carries the same explicit
include with the identical rationale.
A bundle is an index entry with no artifacts that names a group of
packages: {"name":"build-base","kind":"bundle","installs":["mingw",
"cmake",...]}. Expansion happens once in install_packages: bundle
names never reach install_package, members recurse with a visiting
chain so bundles cannot loop (depth-capped, chain printed like alias
cycles), and the result dedupes order-preserving so a member listed
twice or already installed downloads at most once — the existing
already_installed skip makes re-runs free.

wpm info gains a 'Bundle of:' line (and installs[] in --json).

Verified live in an isolated root: expansion installs the missing
member and skips the installed one (requested=2 failed=0), and a
cycle-a <-> cycle-b pair is refused with the chain in the message.
The 14 wpm.* ctest failures on this machine reproduce identically on
pristine origin/main (environment-bound), so the diff does not move
them.
The bundle pre-pass loaded its own index snapshot (load_index with no
refresh) and hard-failed every requested name that snapshot could not
see. Any install staged through a configured source - the local cache
is only populated by the refresh install_package performs - died in
the pre-pass with a bundle diagnostic, and a plain unknown name in a
mixed batch took the whole batch down with it and lost the canonical
"package not found after index update" message. 14 wpm ctest cases
failed in CI while main is 3757/3757 green.

Expansion now resolves against the same index view install_package
uses:
- install_packages refreshes once when a requested name is missing
  from the local index (the same first move install_package makes for
  a single name), so a bundle only a fetched source carries resolves.
- Only names the index contains take part in expansion. Plain
  packages, aliases and still-unknown names pass through untouched;
  install_package keeps owning their per-package outcomes and
  diagnostics.
- A bundle is an entry with no artifacts and a well-formed installs
  list (the documented definition); an entry with artifacts installs
  itself and its installs field stays inert metadata.
- A malformed installs list (not a list of names) on an artifact-less
  entry is diagnosed instead of silently dropping members.
- Members still resolve strictly inside the bundle: a missing member
  fails the group with the bundle diagnostic.
Also drops the unused ExpandedBundles struct.
New ctest coverage for the installs-field bundles: members install in
order, repeated members dedupe, already-installed members take the
benign path, nested bundles expand, cycles are refused with the chain
in the message, a missing member installs nothing, a malformed
installs list is rejected, wpm info reports Bundle of:/installs, and
the regression pin - a batch mixing a bundle with an unknown package
installs the members and reports the unknown name through the
canonical install_package diagnostic, never as a bundle member.
@caomengxuan666

Copy link
Copy Markdown
Member Author

Review: the 14 ctest failures are introduced here — fixed on this branch

Captain review of the two original commits, with two fix commits added on top (author commits untouched):

Why CI is red. On main (38c5937) the same job is green: 3757/3757 tests pass. On this PR, exactly 14 fail, all wpm.*, and they fail deterministically (the ctest-gate serial retry confirms all 14). The failing assertions show the mechanism directly — e.g. wpm_rejects_sources_declared_in_cached_index expects the canonical package not found after index update: evil-tool and instead gets the new pre-pass diagnostic wpm: bundle member not found in index: evil-tool.

Root cause: the expansion pre-pass in install_packages loaded its own index snapshot (load_index, no refresh) and hard-failed every requested name that snapshot could not see. Installs staged through a configured source only enter the local cache via the refresh install_package performs, so on a fresh root every such install died in the pre-pass — plain packages included, not just bundles. (The "identical 61/14 on pristine main" local result is real but is a separate machine-local baseline: on CI, main is fully green, so the local red masked this regression at the same count.)

3ebd50e — fix(wpm): expand bundles inside the install index lifecycle

  • install_packages refreshes once when a requested name is missing from the local index — the same first move install_package makes for a single name — so a bundle (or package) only a fetched source carries still resolves.
  • Only names the index contains take part in expansion. Plain packages, aliases and still-unknown names pass through untouched; install_package keeps owning their per-package outcomes and the canonical diagnostics. A mixed batch (wpm install toolkit nosuch) installs the members and fails only nosuch.
  • A bundle is now gated on the documented definition: no artifacts + a well-formed installs list. An entry with artifacts installs itself; its installs field is inert metadata.
  • A malformed installs list on an artifact-less entry is diagnosed instead of silently dropping non-string members. Members still resolve strictly: a missing member fails the group with the bundle diagnostic. Dead ExpandedBundles struct removed.

f93ea7d — test(wpm): pin bundle expansion behaviour

Nine new ctest cases: members install in order, repeated members dedupe, already-installed members take the benign path, nested bundles expand, cycles are refused with the chain printed, a missing member installs nothing, a malformed installs list is rejected, wpm info reports Bundle of: / installs, and the regression pin for the mixed batch above.

Net for the fix commits: wpm.cpp +122/−52, tests +236/−0.

For the record (not addressed here, to keep the fix scoped): the new bundle messages are raw strings without wpm_text i18n keys, unlike the neighbouring alias diagnostics — worth a pass before the next release per the repo's i18n workflow.

@caomengxuan666

Copy link
Copy Markdown
Member Author

队长复核结论:CI 全绿,可合(2026-11-06 22:01 CST)

head f93ea7d6(作者两提交 + 队长修复 3ebd50e + 钉 f93ea7d):

  • CMake Windows Multi-Arch CI(run 42226834530):build-windows (x64, x64, x64, default) 的 ctest 逐行核完——100% tests passed out of 3766(原 3757 + 新钉 9),全日志零 ***Failed。
    • 原红的 14 条 wpm 测试逐条有自己的 Passed 行(install 下载/成功行/传输重试/dry-run/强锁、shim 转发、uninstall、links rebuild、outdated、JSON、缓存源校验,全数在列)。
    • 新增 9 条 bundle 钉逐条 Passed(含回归钉 wpm_install_batch_keeps_plain_names_out_of_bundle_expansion)。
    • 其余腿:arm64 default/full、x64 full、i18n-drift 全 pass。
  • GNU master differential(run 42226834721 重跑代):oracle / compare / baseline 全 pass。(首代 oracle 红是拉 git.savannah.gnu.org 的 gnulib 子模块两次连接超时,纯外网抖动,与本 PR 无关;重跑即绿。)

即:原审结论「不可合」的唯一产品原因(bundle 预展开绕过索引刷新、全批安装被误杀)已修复并钉住,作者本地 61/14 的说法与 CI 主干 3757/3757 的矛盾也已解释清楚(其本机基线红是另一回事)。

遗留(不阻塞合并,已在前一评论记录):bundle 报错文案仍是裸字符串,未走 wpm_text i18n 键,unixwin/winuxcmd-i18n 同步 + VERSION 提升待后续一并处理。

合并与否留待仓主决定。

@caomengxuan666
caomengxuan666 merged commit beff967 into main Nov 7, 2026
16 of 17 checks passed
@caomengxuan666
caomengxuan666 deleted the feat/wpm-bundle-and-include-fixes branch November 18, 2026 05:50
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