Uh oh!
There was an error while loading. Please reload this page.
fix(create-objectstack): startup banner reads its own version - #11030
Conversation
`npm create objectstack@latest` greeted a newcomer with a hardcoded `◆ Create ObjectStack v6.x` — eleven majors stale, on the first line of output anyone ever sees. `readCliVersion()` already resolves the real, published version from package.json (`.version()` on the commander program already uses it); the banner just never called it. The naive fix — dropping the real version into the old literal string — would have reintroduced the exact defect class this card exists to close: the box's right border is a fixed run of `═` computed for the 4-character `v6.x`, and a longer real version (`v17.1.0` is 7 characters) pushes the border out of alignment without recomputing the trailing pad (the sibling bug fixed one function away in the same file). `renderVersionBanner()` (new banner.ts, split out so it is unit-testable without importing index.ts, which calls `program.parse()` at module scope) derives the box width from the version string's PLAIN length and widens the frame — never truncates — for a version long enough to need more room; ordinary versions still render at the historical 39-column box size. Pinned two properties separately so neither can go vacuous: the banner names the version package.json actually declares (read at test time, not a literal), and the three box lines still render to equal display width with aligned borders, computed from ANSI-stripped plain text. Fixes#10325
📓 Docs Drift Check5 anchor(s) derived from 1 changed package(s); no hand-written page names any of them. ✅ What this run could not see
Coarse fallback — 8 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin a3fd008a601a40f6bbb4e02aafcb631cbfd0a3a8 && git checkout a3fd008a601a40f6bbb4e02aafcb631cbfd0a3a8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8d21f7a76912df531c144f17bc3f5bedd07f79c5 bfcb8d378ae6cc9b124d9ff23302da18dd418a9c && git checkout -B drift-repro 8d21f7a76912df531c144f17bc3f5bedd07f79c5 && git merge --no-ff bfcb8d378ae6cc9b124d9ff23302da18dd418a9c
node scripts/docs-audit/affected-docs.mjs --json 8d21f7a76912df531c144f17bc3f5bedd07f79c5 |
Uh oh!
There was an error while loading. Please reload this page.
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 32567862060 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Fixes#10325
npm create objectstack@latestgreeted a newcomer with a hardcoded◆ Create ObjectStack v6.x— eleven majors stale, on the first line ofoutput anyone ever sees.
readCliVersion()already resolves the real,published version from
package.json(.version()on the commanderprogram already uses it); the banner just never called it.
The trap this card names
The naive fix — dropping the real version into the old literal string —
would have reintroduced the exact defect this card exists to close: the
box's right border is a fixed run of
═computed for the 4-characterv6.x, and a longer real version (v17.1.0is 7 characters) pushes theborder out of alignment without recomputing the trailing pad (the sibling
bug fixed in #10322, one function away in the same file).
renderVersionBanner()(newbanner.ts, split out so it is unit-testablewithout importing
index.ts, which callsprogram.parse()at modulescope) derives the box width from the version string's PLAIN length and
widens the frame — never truncates — for a version long enough to need
more room. Ordinary versions still render at the historical 39-column box
size.
Rendered output (real build, real run)
Normal version (
packages/create-objectstack/package.jsondeclares17.1.0):Deliberately long version (
18.0.0-beta.1+build.20260822, 29 chars — toexercise the widening path):
Both captured from the actual built
dist/index.jsrun as a subprocess(
node dist/index.js <name> --template blank --skip-install --skip-skills),not from the unit tests.
Tests
packages/create-objectstack/src/banner-version.test.ts, following thescaffold-description.test.ts/scaffold-next-steps-pm.test.tssubprocessconvention (
index.tscallsprogram.parse()at import time, so it isexercised via
tsxrather than imported). Two properties, pinnedseparately so neither can go vacuous:
package.jsonactually declares — read attest time, never a copy-pasted literal.
borders, computed from ANSI-stripped plain text (chalk color is forced
on for this specific assertion via
FORCE_COLOR, since the padding mathmust never be done on a chalk-wrapped, escape-code-laden string).
Reverse-verified both halves (see dev report for the transcripts): restoring
the hardcoded
v6.xliteral turns the "names the declared version"assertion red; hardcoding the old fixed 7-space trailing pad turns all
three alignment assertions red. Both restored to green.
Scope
Touches only the banner and its test — no changes under
packages/create-objectstack/src/templates/**(PR #11024 and #11022/#10990own that tree) and nothing under
content/docs/releases/.Generated by Claude Code