Skip to content

[PR] ci: Thin-install smoke lane — actually run once after bare tarball install (#3617 C) | ci: 薄安装冒烟 lane——tarball 裸装后真跑一遍(#3617 C) - #3628

Merged
ranxianglei merged 2 commits into
masterfrom
2026-10-18_thin-install-smoke-ci
Oct 18, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-10-18_thin-install-smoke-ci

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

(ai: vllm-qwen/qwen3.8-27b)

Part of #3617 item C(薄安装冒烟进 CI)。无产品行为变更。

背景

#3511(zod 静态进 dist 却没声明,P0)漏出的原因:PR CI 从不把 tarball 装进裸目录。#3519 补的 check-dist-external-zod 是静态分析、只认 zod 这一个已知冒犯者。本 PR 补通用版:任何「dist 依赖了没声明的包」都在 CI 当场红。

改动

  1. scripts/check-dist-thin-install.mjs(新):npm pack → 只装这个 tarball 到 scratch 目录(不带仓库 node_modules)→ 证明产物能跑:
    • node dist/index.js --version 退出码 0;
    • 逐个在独立进程里 import 每个 Node 消费的 dist/agent/*.js(真实宿主一次只加载一个 bundle,独立进程忠实还原消费形态);
    • dsh-native-client.js 是浏览器 bundle(tsup platform:"browser"、cjs、window.__ModuleLoader__ 格式),Node 里无法 import——改为 parse-check,坏构建照样红。
  2. .github/workflows/ci.yml:static-gates job 的 npm run build 之后加一步跑它。纯增量 step——不动 matrix、不改任何 leg 名,branch protection 不受影响;ubuntu/windows 两条 static leg 都会跑。
  3. package.json:npm run check:dist-thin 别名供手动使用。

刻意不进本地 build 链、也不进 prepare gate:它需要 registry 访问(拉声明过的依赖),不能拖慢消费者安装。

验证

  • 本地正例:node scripts/check-dist-thin-install.mjs → OK(cli 0.1.199;imported 8 agent bundles;parse-checked dsh-native-client.js);
  • 本地反例:往构建好的 bundle 里注入一个假未声明 import → 脚本以 ERR_MODULE_NOT_FOUND FAIL(exit 1)——正是 197-master 发版最后 #3511 类失败的形状;
  • workflow YAML 解析通过;全量回归以 CI 为准。

Closes 无——本 PR 是 #3617 六项之一,issue 待六项全部合入后关闭。

…all (#3617-C)

New scripts/check-dist-thin-install.mjs, wired into the static-gates job after
> billion-context@0.1.199 build
> npm --prefix kernel run build && npm --prefix pi-subagents run build && tsup && node scripts/write-build-info.mjs && node scripts/check-dist-import-annotations.mjs && node scripts/check-dist-external-zod.mjs

> acp-kernel@0.0.130 build
> npm run clean && tsup && tsc --emitDeclarationOnly

> acp-kernel@0.0.130 clean
> node -e "require('fs').rmSync('dist',{recursive:true,force:true})"

�[34mCLI�[39m Building entry: src/index.ts, src/panel/index.ts, src/persist/index.ts, src/wire/index.ts
�[34mCLI�[39m Using tsconfig: tsconfig.json
�[34mCLI�[39m tsup v8.5.1
�[34mCLI�[39m Using tsup config: /var/lib/ework-daemon/share/opencode-workdir/ranxianglei--billion-context/3617/ework-daemon/kernel/tsup.config.ts
�[34mCLI�[39m Target: es2022
�[34mESM�[39m Build start
�[32mESM�[39m �[1mdist/persist/index.js      �[22m�[32m19.83 KB�[39m
�[32mESM�[39m �[1mdist/wire/index.js         �[22m�[32m58.33 KB�[39m
�[32mESM�[39m �[1mdist/index.js              �[22m�[32m314.09 KB�[39m
�[32mESM�[39m �[1mdist/chunk-KJXO6XX7.js     �[22m�[32m29.34 KB�[39m
�[32mESM�[39m �[1mdist/chunk-6ECDTFU5.js     �[22m�[32m2.02 KB�[39m
�[32mESM�[39m �[1mdist/panel/index.js        �[22m�[32m6.96 KB�[39m
�[32mESM�[39m �[1mdist/persist/index.js.map  �[22m�[32m46.16 KB�[39m
�[32mESM�[39m �[1mdist/wire/index.js.map     �[22m�[32m154.06 KB�[39m
�[32mESM�[39m �[1mdist/chunk-KJXO6XX7.js.map �[22m�[32m53.58 KB�[39m
�[32mESM�[39m �[1mdist/chunk-6ECDTFU5.js.map �[22m�[32m4.38 KB�[39m
�[32mESM�[39m �[1mdist/panel/index.js.map    �[22m�[32m17.58 KB�[39m
�[32mESM�[39m �[1mdist/index.js.map          �[22m�[32m752.42 KB�[39m
�[32mESM�[39m ⚡️ Build success in 92ms

> billion-context-pi-subagents@0.2.0 build
> tsup && tsc --emitDeclarationOnly

�[34mCLI�[39m Building entry: src/index.ts
�[34mCLI�[39m Using tsconfig: tsconfig.json
�[34mCLI�[39m tsup v8.5.1
�[34mCLI�[39m Using tsup config: /var/lib/ework-daemon/share/opencode-workdir/ranxianglei--billion-context/3617/ework-daemon/pi-subagents/tsup.config.ts
�[34mCLI�[39m Target: es2022
�[34mCLI�[39m Cleaning output folder
�[34mESM�[39m Build start
�[32mESM�[39m �[1mdist/index.js     �[22m�[32m464.23 KB�[39m
�[32mESM�[39m �[1mdist/index.js.map �[22m�[32m1.31 MB�[39m
�[32mESM�[39m ⚡️ Build success in 266ms
�[34mCLI�[39m Building entry: {"agent/dsh-native-client":"src/agent/dsh-native-client.ts"}
�[34mCLI�[39m Using tsconfig: tsconfig.json
�[34mCLI�[39m tsup v8.5.1
�[34mCLI�[39m Using tsup config: /var/lib/ework-daemon/share/opencode-workdir/ranxianglei--billion-context/3617/ework-daemon/tsup.config.ts
�[34mCLI�[39m Building entry: src/claude-native-bootstrap.ts, src/index.ts, src/mcp.ts, src/agent/dsh-acp.ts, src/agent/dsh-native.ts, src/agent/omp-native.ts, src/agent/omp.ts, src/agent/opencode-native.ts, src/agent/opencode.ts, src/agent/pi-native.ts, src/agent/pi.ts, src/kimi/bootstrap-hook.ts, src/kimi/native-mcp.ts, src/zcode/bootstrap-hook.ts, src/zcode/mcp-entry.ts
�[34mCLI�[39m Using tsconfig: tsconfig.json
�[34mCLI�[39m tsup v8.5.1
�[34mCLI�[39m Using tsup config: /var/lib/ework-daemon/share/opencode-workdir/ranxianglei--billion-context/3617/ework-daemon/tsup.config.ts
�[34mCLI�[39m Target: es2020
�[34mCJS�[39m Build start
�[34mCLI�[39m Target: node20
�[34mCLI�[39m Cleaning output folder
�[34mESM�[39m Build start
�[32mCJS�[39m �[1mdist/agent/dsh-native-client.js �[22m�[32m14.08 KB�[39m
�[32mCJS�[39m ⚡️ Build success in 36ms
�[32mESM�[39m �[1mdist/agent/dsh-acp.js               �[22m�[32m5.77 KB�[39m
�[32mESM�[39m �[1mdist/mcp.js                         �[22m�[32m731.30 KB�[39m
�[32mESM�[39m �[1mdist/agent/omp.js                   �[22m�[32m1.27 MB�[39m
�[32mESM�[39m �[1mdist/agent/pi.js                    �[22m�[32m1.27 MB�[39m
�[32mESM�[39m �[1mdist/claude-native-bootstrap.js     �[22m�[32m2.13 MB�[39m
�[32mESM�[39m �[1mdist/agent/opencode-native.js       �[22m�[32m2.30 MB�[39m
�[32mESM�[39m �[1mdist/agent/opencode.js              �[22m�[32m2.27 MB�[39m
�[32mESM�[39m �[1mdist/kimi/bootstrap-hook.js         �[22m�[32m2.10 MB�[39m
�[32mESM�[39m �[1mdist/kimi/native-mcp.js             �[22m�[32m2.14 MB�[39m
�[32mESM�[39m �[1mdist/zcode/bootstrap-hook.js        �[22m�[32m2.11 MB�[39m
�[32mESM�[39m �[1mdist/zcode/mcp-entry.js             �[22m�[32m2.16 MB�[39m
�[32mESM�[39m �[1mdist/agent/dsh-native.js            �[22m�[32m2.22 MB�[39m
�[32mESM�[39m �[1mdist/agent/dsh-acp.js.map           �[22m�[32m49.41 KB�[39m
�[32mESM�[39m �[1mdist/agent/omp-native.js            �[22m�[32m2.60 MB�[39m
�[32mESM�[39m �[1mdist/index.js                       �[22m�[32m4.64 MB�[39m
�[32mESM�[39m �[1mdist/agent/pi-native.js             �[22m�[32m4.69 MB�[39m
�[32mESM�[39m �[1mdist/mcp.js.map                     �[22m�[32m2.05 MB�[39m
�[32mESM�[39m �[1mdist/agent/omp.js.map               �[22m�[32m5.32 MB�[39m
�[32mESM�[39m �[1mdist/agent/pi.js.map                �[22m�[32m5.32 MB�[39m
�[32mESM�[39m �[1mdist/claude-native-bootstrap.js.map �[22m�[32m6.92 MB�[39m
�[32mESM�[39m �[1mdist/kimi/native-mcp.js.map         �[22m�[32m6.94 MB�[39m
�[32mESM�[39m �[1mdist/zcode/mcp-entry.js.map         �[22m�[32m6.95 MB�[39m
�[32mESM�[39m �[1mdist/agent/opencode.js.map          �[22m�[32m8.07 MB�[39m
�[32mESM�[39m �[1mdist/agent/opencode-native.js.map   �[22m�[32m8.16 MB�[39m
�[32mESM�[39m �[1mdist/zcode/bootstrap-hook.js.map    �[22m�[32m6.91 MB�[39m
�[32mESM�[39m �[1mdist/agent/dsh-native.js.map        �[22m�[32m7.50 MB�[39m
�[32mESM�[39m �[1mdist/kimi/bootstrap-hook.js.map     �[22m�[32m6.91 MB�[39m
�[32mESM�[39m �[1mdist/agent/omp-native.js.map        �[22m�[32m8.85 MB�[39m
�[32mESM�[39m �[1mdist/index.js.map                   �[22m�[32m13.03 MB�[39m
�[32mESM�[39m �[1mdist/agent/pi-native.js.map         �[22m�[32m14.22 MB�[39m
�[32mESM�[39m ⚡️ Build success in 3342ms
build-info: commit=fd3232fae-dirty
dist-import-annotations: OK
dist-external-zod: OK (additive step; no matrix/leg-name changes, branch protection untouched). It packs the current tree, installs ONLY the tarball into a scratch dir with no repo node_modules, then proves the artifact runs: 0.1.199 (fd3232f-dirty) exits 0, and every Node-consumed dist/agent/*.js entry imports in its own process. dsh-native-client.js is a browser bundle by design (tsup platform:browser, window.__ModuleLoader__ format) — parse-checked instead of imported.\n\nWhy: #3511 (zod statically in dist while undeclared) shipped because PR CI never installed the tarball into a bare dir — #3519's check-dist-external-zod gate is static analysis for ONE known offender and CI ran it only inside the build chain. This smoke catches ANY undeclared runtime dependency at import time, in the same shape a real consumer hits it. Verified negative: injecting a fake undeclared import into a built bundle fails the script with ERR_MODULE_NOT_FOUND.\n\nDeliberately NOT added to the local build chain or the prepare gate: it needs registry access for declared deps and must not slow consumer installs. Also exposed as
> billion-context@0.1.199 check:dist-thin
> node scripts/check-dist-thin-install.mjs

dist-thin-install: OK — cli 0.1.199; imported 8 agent bundle(s) [dsh-acp.js, dsh-native.js, omp-native.js, omp.js, opencode-native.js, opencode.js, pi-native.js, pi.js]; parse-checked browser bundle(s) [dsh-native-client.js] for manual use. No behavior change to the product.
@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-18_thin-install-smoke-ci (479832b)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.4302-pr.3628.300dfad

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr3628.tgz
npm install -g package

Install instructions are refreshed on each push.

…>=22 EINVAL without it (#3617-C)

Windows static-gates failed with EINVAL spawnSync npm.cmd: spawning a
.cmd requires shell:true since the CVE-2024-27980 hardening in Node
18.20/20.12/22. The npmCmd line was copied from run-ci-tests.mjs but
the matching shell option was missed. Add it at both call sites
(pack, install); Linux behavior unchanged (shell:false).
@ranxianglei

Copy link
Copy Markdown
Owner Author

ai: zhipuai-lb/glm-5.3

Windows static-gates 红的根因与修复:脚本把 run-ci-tests.mjs 的 npmCmd = win32 ? "npm.cmd" : "npm" 抄过来但漏了配套的 shell 选项——Node ≥ 18.20/22(CVE-2024-27980 加固)直接 spawn .cmd 会 EINVAL(spawnSync npm.cmd,errno -4071)。已在 pack/install 两个调用点补 shell: process.platform === "win32"(与 run-ci-tests.mjs:141 同款),Linux 行为不变(shell:false)。Linux 本地全流程实测过一遍:pack→裸装→cli --version→8 个 agent bundle 导入,exit 0。

@ranxianglei
ranxianglei merged commit 8396c43 into master Oct 18, 2026
31 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.556-master.8396c43 (rolling master tag).

npm install -g billion-context@0.0.556-master.8396c43  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

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