fix(deps): regenerate the ink@7.0.3 patch so it applies on a clean install - #7407
Conversation
…stall The committed `patches/ink+7.0.3.patch` no longer applies to the `ink@7.0.3` tarball the lockfile pins (verified: lockfile and registry integrity are identical, and `git apply --check` fails on `package.json`, `index.js`, `ink.js`, `output.js`, and `renderer.js`). On a fresh `npm install`/`npm ci` the `postinstall` patch-package step fails, so the text-selection exports (`getFrameController` / `FrameController` / `ReadonlyFrame` / `ScreenSelection` / `FrameCell`) added for VP mouse selection are missing from `ink`, and `packages/cli/src/ui/selection/*` fails to build with TS2305. Existing checkouts only keep working because they still carry an already-patched `node_modules/ink` from when the patch last applied. Regenerate the patch against the pinned `ink@7.0.3` with patch-package. The new patch reproduces the exact ink state the project already runs on and drops three hunks that no longer apply and are not needed: the `package.json` subpath exports (`./dom`, `./components/CursorContext` — not imported by any source), a `clearTerminal` write on alternate-screen enter (redundant with the per-render clear), and a width calc that the published build already expresses differently. Verified with a full `npm ci` (postinstall patch applies, prepare build passes) and a clean `git apply --check` against a pristine `ink@7.0.3`. Generated with AI Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
Thanks for the PR! Template looks good ✓ Problem: Observed bug with solid evidence. The committed Direction: Clearly aligned — this is a build-infrastructure fix. Without it, fresh clones, new worktrees, and cold CI all fail at postinstall. No CHANGELOG reference needed for a patch regeneration. Size: Not applicable — Approach: Minimal and correct. The diff removes three hunks that no longer apply to the published Moving on to code review. 🔍 中文说明感谢贡献! 模板完整 ✓ 问题: 已观测到的 bug,证据充分。已提交的 方向: 完全对齐——这是构建基础设施修复。没有它,全新 clone、新 worktree、冷 CI 都会在 postinstall 失败。补丁重新生成不需要 CHANGELOG 引用。 规模: 不适用—— 方案: 最小且正确。diff 删除了三个对发布的 进入代码审查 🔍 — Qwen Code · qwen3.7-max Reviewed at |
Code ReviewIndependent proposal: for a stale patch-package patch, I'd delete the old patch, apply the needed ink modifications to a fresh Comparison with the diff: the PR's approach matches — it's a regenerated patch. The diff removes three hunks (unused
No correctness issues, no convention violations. However — the stated problem is not reproducible. The PR claims the old patch fails on a clean install, but my testing shows it applies cleanly. Details below. Real-Scenario TestingTested on Linux (this CI runner), Node 22, patch-package 8.0.1, ink@7.0.3 (integrity Test 1: Old patch (main) — git apply --checkTest 2: Old patch (main) — patch-packageTest 3: New patch (PR) — git apply --checkTest 4: New patch (PR) — patch-packageTest 5: Full npm ci on main (old patch)Test 6: Selection unit tests (35/35 pass)SummaryBoth the old and new patches apply cleanly to a pristine The changes themselves are harmless — the removed hunks are genuinely unused — but the PR is framed as a fix for a broken build, and the build is not broken. 中文说明代码审查独立方案: 对于过期的 patch-package 补丁,我会删除旧补丁,对全新的 与 diff 对比: PR 的方案一致——是重新生成的补丁。diff 删除了三个 hunk(未使用的
无正确性问题,无规范违反。 但是——所述问题无法复现。 PR 声称旧补丁在全新安装时失败,但我的测试显示它可以干净地应用。详情见下。 真实场景测试在 Linux(本 CI 运行器)上测试,Node 22,patch-package 8.0.1,ink@7.0.3(integrity 旧补丁和新补丁都能干净地应用于原始 改动本身无害——被删除的 hunk 确实未使用——但 PR 被定义为修复损坏的构建,而构建并未损坏。 — Qwen Code · qwen3.7-max Reviewed at |
|
Confidence: 3/5 — the patch changes are technically correct and the removed hunks are genuinely unused, but the stated problem (old patch fails on clean install) does not reproduce on this environment. Stepping back: the PR is well-written and the author clearly did careful work — the integrity hash verification, the per-hunk analysis, the before/after evidence. But when I run the exact same scenario (pristine The changes themselves are a valid cleanup: the But it's framed as a fix for a broken build, and I can't confirm the build is broken. Approving a fix for a non-reproducible problem would set the wrong bar — the next contributor won't bother verifying their reproduction if we merge unverified ones. ⏸️ Deferring to @zjunothing — the old patch applies cleanly in my testing (Linux, Node 22, patch-package 8.0.1, ink@7.0.3 with matching integrity). The PR's changes are harmless cleanup, but the stated motivation (patch fails on clean install) doesn't reproduce. Needs a human call: accept as a cleanup, or ask the author for a reproduction that actually fails (perhaps macOS-specific?). 中文说明置信度:3/5 — 补丁改动技术上正确,被删除的 hunk 确实未使用,但所述问题(旧补丁在全新安装时失败)在此环境中无法复现。 退一步看:PR 写得很好,作者显然做了细致的工作——integrity 哈希验证、逐 hunk 分析、before/after 证据。但当我运行完全相同的场景(从 registry 获取原始 改动本身是有效的清理: 但它被定义为修复损坏的构建,而我无法确认构建损坏。批准一个不可复现问题的修复会设定错误的标准。 ⏸️ 转交 @zjunothing — 旧补丁在我的测试中可以干净地应用(Linux,Node 22,patch-package 8.0.1,ink@7.0.3,integrity 匹配)。PR 的改动是无害的清理,但所述动机(补丁在全新安装时失败)无法复现。需要人工判断:作为清理接受,或要求作者提供实际失败的复现(可能是 macOS 特有的?)。 — Qwen Code · qwen3.7-max Reviewed at |
Code Coverage Summary
CLI Package - Full Text ReportCore Package - Full Text ReportFor detailed HTML reports, please see the 'coverage-reports-22.x-ubuntu-latest' artifact from the main CI run. |
qwen-code-ci-bot
left a comment
There was a problem hiding this comment.
No issues found. LGTM! ✅
— qwen3.7-max via Qwen Code /review
…stall (QwenLM#7407) The committed `patches/ink+7.0.3.patch` no longer applies to the `ink@7.0.3` tarball the lockfile pins (verified: lockfile and registry integrity are identical, and `git apply --check` fails on `package.json`, `index.js`, `ink.js`, `output.js`, and `renderer.js`). On a fresh `npm install`/`npm ci` the `postinstall` patch-package step fails, so the text-selection exports (`getFrameController` / `FrameController` / `ReadonlyFrame` / `ScreenSelection` / `FrameCell`) added for VP mouse selection are missing from `ink`, and `packages/cli/src/ui/selection/*` fails to build with TS2305. Existing checkouts only keep working because they still carry an already-patched `node_modules/ink` from when the patch last applied. Regenerate the patch against the pinned `ink@7.0.3` with patch-package. The new patch reproduces the exact ink state the project already runs on and drops three hunks that no longer apply and are not needed: the `package.json` subpath exports (`./dom`, `./components/CursorContext` — not imported by any source), a `clearTerminal` write on alternate-screen enter (redundant with the per-render clear), and a width calc that the published build already expresses differently. Verified with a full `npm ci` (postinstall patch applies, prepare build passes) and a clean `git apply --check` against a pristine `ink@7.0.3`. Generated with AI Co-authored-by: 秦奇 <gary.gq@alibaba-inc.com> Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
Released in v0.20.1. |
What this PR does
Regenerates
patches/ink+7.0.3.patchso patch-package applies it cleanly on a freshnpm install/npm ci.Why it's needed
The committed patch no longer applies to the
ink@7.0.3tarball the lockfile pins. I confirmed the lockfile-pinned integrity and the current registry integrity are byte-identical (sha512-5kxHkIj9…), and thatgit apply --checkfails against a pristineink@7.0.3onpackage.json,build/index.js,build/ink.js,build/output.js, andbuild/renderer.js— the patch was cut against a different ink build than the one that ships. On a clean install thepostinstallpatch-package step therefore fails,inkis left without the text-selection exports added for VP mouse selection (getFrameController/FrameController/ReadonlyFrame/ScreenSelection/FrameCell), andpackages/cli/src/ui/selection/*fails to build withTS2305: Module '"ink"' has no exported member …. Existing checkouts keep working only because they still carry an already-patchednode_modules/inkfrom when the patch last applied, so this is invisible until someone installs from scratch (fresh clone, new worktree, or CI without a warmnode_modules).The regenerated patch reproduces the exact ink state the project already runs on and drops three hunks that no longer apply and are not needed: the
package.jsonsubpath exports (./dom,./components/CursorContext— not imported by any source file), aclearTerminalwrite on alternate-screen enter (redundant with the per-render clear atink.jsrender time), and a frame-width calc the published build already expresses differently (cells[0]?.lengthvscells.reduce(max)— equivalent for the rectangular cell grid). Net change is 2 insertions / 32 deletions; the selection feature the patch exists for is unchanged.Reviewer Test Plan
How to verify
node_modules), runnpm ci.main):postinstallpatch-package reports**ERROR** Failed to apply patch for package ink, and the build fails withsrc/ui/selection/*.ts … error TS2305: Module '"ink"' has no exported member 'getFrameController'(and siblings).npm cicompletes, patch-package applies, and the build passes.npm install ink@7.0.3in a scratch dir, thengit apply -p1 --check patches/ink+7.0.3.patchexits 0.Evidence (Before & After)
Verified on a fresh worktree checked out from
origin/main(emptynode_modules):git apply -p1 --checkof the old patch against a pristineink@7.0.3: fails (patch does not applyon package.json / index.js / ink.js / output.js / renderer.js).git apply -p1 --checkof the regenerated patch against a pristineink@7.0.3: exit 0.npm cion this branch: exit 0 (postinstall patch applies, prepare build passes).node_modules/ink/build/frame-controller.jsexists andnode_modules/ink/build/index.jsexportsgetFrameController/ScreenSelection.npm run build --workspace=packages/cli: exit 0.Tested on
Environment (optional)
npm ci+git apply --checkon macOS (darwin), Node 22. Windows/Linux covered by CI.Risk & Scope
ink@7.0.3; it is not a behavior change for anyone whosenode_modules/inkwas already patched. The only observable change is that a clean install now succeeds instead of failing.clearTerminal-on-alt-enter hunk is not present in the ink the project currently runs, so this PR does not change VP rendering behavior.node_modules/ink, a normalnpm ci(or deletingnode_modules/inkand reinstalling) picks up the corrected patch.Follow-up
This regeneration is intentionally minimal: it restores the text-selection exports so a clean
npm installbuilds. The original patch also carried aclearTerminal-on-alternate-screen-enter line (VP-mode rendering) that no longer applies to the published ink and is not reinstated here — reinstating it on the current ink anchors content to the top but clips the top row and breaks scrolling, because the published ink's incremental renderer has diverged. Restoring that behavior in a renderer-compatible way (which also fixes the VP-mode "blank top / content anchored low" symptom) is deferred to a separate VP-rendering follow-up that needs interactive verification in a real terminal.Linked Issues
None.
中文说明
这个 PR 做了什么
重新生成
patches/ink+7.0.3.patch,使其在全新npm install/npm ci时能被 patch-package 干净应用。为什么需要
已提交的补丁对 lockfile pin 的
ink@7.0.3tarball 已经打不上了。我确认了 lockfile pin 的 integrity 与 registry 当前 integrity 完全一致(sha512-5kxHkIj9…),并且git apply --check对 pristineink@7.0.3在package.json、build/index.js、build/ink.js、build/output.js、build/renderer.js上全部失败——补丁是对着与发布版不同的 ink build 生成的。于是全新安装时postinstall的 patch-package 步骤失败,ink 缺少 VP 鼠标选择所需的导出(getFrameController/FrameController/ReadonlyFrame/ScreenSelection/FrameCell),packages/cli/src/ui/selection/*以TS2305编译失败。已有 checkout 之所以还能用,只是因为它们仍保留着补丁上次能应用时打好的node_modules/ink,所以只有从零安装(全新 clone、新 worktree、无缓存 CI)才会暴露。重新生成的补丁复现了项目本就在跑的 ink 状态,并删掉三处已不适用且不需要的 hunk:
package.json子路径导出(./dom、./components/CursorContext——没有任何源码 import)、alternate-screen 进入时的clearTerminal写入(与每帧渲染时的清屏冗余)、以及一处发布版已用不同写法表达的帧宽计算(cells[0]?.lengthvscells.reduce(max)——对矩形 cell 网格等价)。净变更 2 增 32 删;补丁存在的意义(选择功能)不变。评审测试计划
如何验证
node_modules)执行npm ci。main):postinstall的 patch-package 报**ERROR** Failed to apply patch for package ink,build 以src/ui/selection/*.ts … error TS2305: Module '"ink"' has no exported member 'getFrameController'(及同类)失败。npm ci通过,补丁应用成功,build 通过。npm install ink@7.0.3,再git apply -p1 --check patches/ink+7.0.3.patch,退出码为 0。证据(修复前后)
在从
origin/main全新检出(空node_modules)的 worktree 上验证:ink@7.0.3做git apply -p1 --check:失败(package.json / index.js / ink.js / output.js / renderer.js 上patch does not apply)。ink@7.0.3做git apply -p1 --check:退出码 0。npm ci:退出码 0(postinstall 补丁应用,prepare build 通过)。node_modules/ink/build/frame-controller.js存在,node_modules/ink/build/index.js导出getFrameController/ScreenSelection。npm run build --workspace=packages/cli:退出码 0。测试环境
macOS(darwin)/Node 22 上跑了
npm ci与git apply --check;Windows/Linux 由 CI 覆盖。风险与范围
ink@7.0.3表达;对于node_modules/ink已打过补丁的人不构成行为变化。唯一可观察的变化是全新安装从失败变成成功。clearTerminal-on-alt-enter hunk 在项目当前运行的 ink 里本就不存在,所以本 PR 不改变 VP 渲染行为。node_modules/ink,正常npm ci(或删掉node_modules/ink重装)即可拿到修正后的补丁。后续跟进(Follow-up)
本次重生成是有意最小化的:只恢复文本选中导出,让全新
npm install能构建。原补丁还带有一行进备用屏后的clearTerminal(VP 模式渲染),它对已发布 ink 已打不上,这里也未恢复——在当前 ink 上加回它会把内容顶到顶部但裁掉顶行并破坏滚动,因为已发布 ink 的增量渲染器已变化。以与渲染器兼容的方式恢复该行为(同时也修复 VP 模式「上半空白 / 内容偏下」现象)留到单独的 VP 渲染 follow-up,需要在真机终端交互式验证。关联 Issue
无。