Repository navigation
feat: stamp the build's git commit into every version display - #2345
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2511-pr.2345.78f00a8This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2345.tgz
npm install -g packageInstall instructions are refreshed on each push. |
--version now renders "<semver> (<commit>)"; the update-flip assertion keeps its intent by matching the first token instead of the whole line.
…dles Bundle-relative path resolution assumed a flat dist layout: entries at dist/agent/*.js (and dist/kimi/*, dist/zcode/*) look one level up and miss both package.json (VERSION degraded to the 'dev' fallback in every subdirectory bundle, e.g. dsh-native log tags) and dist/build-info.json (BUILD_COMMIT fell back to a git spawn at import time, 'unknown' outside checkouts). Check two levels for both. Verified out-of-repo: dsh-native persistClientEvent now logs [v=0.1.187] instead of [v=dev]; top-level behavior byte-identical.
assert.match is search-semantics; the unanchored ^unknown alternative accepted any output merely starting with 'unknown'. Match the anchored ^$ form already used by the other assertions in this file.
[bot] 🏷 #2345 review 完成。方向正确、兼容面审过无回归;review 中发现同一根因的两个小问题已直接修在 PR 分支上(两个标注 commit,fast-forward,未动原三个提交): 结构化七问
行为变更披露(旧→新+原因)
验证证据(本地定向,非全量):typecheck clean;build OK(stamp 判定:可合并(等 CI 绿)。合并动作留给人工:#2345 |
…-build-identity) The semver alone cannot distinguish a locally-installed test build from the npm release with the same version number (exactly the situation while trialing an unmerged fix). Add BUILD_COMMIT and render it wherever a human reads a version: - bili --version → "0.1.187 (8f9faf9)" (first token stays bare semver; all in-repo consumers match by regex, none compare equality) - /acp panel host line → billion-context 0.1.187 (8f9faf9) - web UI header + overview row → v0.1.187 (8f9faf9) / "0.1.187 (8f9faf9)" - /__bili/health and /__bili/overview → additive "commit" field Resolution: bundled code reads dist/build-info.json stamped by scripts/write-build-info.mjs at build time ("-dirty" suffix when the worktree has uncommitted changes); dev (tsx) asks git directly; "unknown" otherwise. The updater, advisory watcher and MCP serverInfo keep comparing/announcing bare package.json semver — display-only, zero update-path impact.
--version now renders "<semver> (<commit>)"; the update-flip assertion keeps its intent by matching the first token instead of the whole line.
…t PiSubagentChildSignal - ci.yml runs npm test BEFORE npm run build; the two end-to-end build-info tests now skip when dist/index.js is absent (3 unit tests still run everywhere). Verified both modes locally (5/5 and 3 pass + 2 skipped). - src/server/pi-subagent-channel.ts: drop the unused export flagged by unused-exports (pre-existing from #2268; same one-line fix the sibling branches carry).
…dles Bundle-relative path resolution assumed a flat dist layout: entries at dist/agent/*.js (and dist/kimi/*, dist/zcode/*) look one level up and miss both package.json (VERSION degraded to the 'dev' fallback in every subdirectory bundle, e.g. dsh-native log tags) and dist/build-info.json (BUILD_COMMIT fell back to a git spawn at import time, 'unknown' outside checkouts). Check two levels for both. Verified out-of-repo: dsh-native persistClientEvent now logs [v=0.1.187] instead of [v=dev]; top-level behavior byte-identical.
assert.match is search-semantics; the unanchored ^unknown alternative accepted any output merely starting with 'unknown'. Match the anchored ^$ form already used by the other assertions in this file.
e705677 to
b79a8ab
Compare
Why
While trialing a locally-installed build (
npm install -g <worktree>) the semver alone cannot distinguish it from the npm release carrying the same version number —bili --versionshows0.1.187either way. Add the build's git commit wherever a human reads a version.What
scripts/write-build-info.mjsstampsdist/build-info.jsonat build time (git rev-parse --short+-dirtysuffix when the worktree is dirty;unknownoutside a git repo; never fails the build).BUILD_COMMITinsrc/version.ts: bundled code readsdist/build-info.json; dev (tsx) asks git directly.bili --version→0.1.187 (8f9faf9e)/acppanel host line →host=billion-context 0.1.187 (8f9faf9e)v0.1.187 (8f9faf9e)/__bili/health,/__bili/status,/__bili/overview→ additivecommitfieldCompatibility audit (why this is safe)
assert.match), index-entry guard, acp-status panel test. All keep passing unchanged.--versionfirst token stays the bare semver, so shell users and scripts that take the first word keep working.serverInfo, plugin manifest, logger[v=…]tags all keep bare package.json semver — zero update-path impact.commitfield on health/status/overview is additive JSON.Tests
tests/build-info.test.ts(5): BUILD_COMMIT format; versionWithCommit; real--versionsubprocess (regex-friendly, starts with semver); live proxy boot (pre-probed free port —--port 0is rejected by loadOptions) asserting health + overview commit. Plus existing acp-status / acp-panel / update-notes / web-config-form suites (38/38) and typecheck.Fixes nothing on its own — observability for local trial builds (e.g. the #2337 lean trial).