pre-push blocks pushes on a typecheck error in unmodified src/bus/global.ts
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- bun, git, node.js, typescript
调研方向
从 packages/opencode/src/bus/global.ts 和仓库的 pre-push 配置开始,然后在全新安装的环境中运行 bun typecheck,同时记录解析得到的 TypeScript 和 @types/node 版本。比较受影响的环境和干净环境,以区分 override 失败与安装偏差。完成的标准是:对于使用锁定工具链的贡献者,pre-push typecheck 无需 --no-verify 即可可靠运行。
由索引模型根据 Issue 内容生成。
描述
What happens
git push is blocked by the pre-push hook because bun typecheck fails on code the contributor did not touch — packages/opencode/src/bus/global.ts:14, which is unmodified on origin/main:
Type 'any[]' is not assignable to type '[event: GlobalEvent]'.
Target requires 1 element(s) but source may have fewer.
14 override emit(eventName: "event", event: GlobalEvent): boolean {
~~~~~~~~~
Found 1 error in src/bus/global.ts:14
Failed: @altimateai/altimate-code#typecheck
ERROR run failed: command exited (2)
error: "turbo" exited with code 2
husky - pre-push script failed (code 2)
error: failed to push some refs to 'https://github.com/AltimateAI/altimate-code.git'
The code
class GlobalBusEmitter extends EventEmitter<{
event: [GlobalEvent]
}> {
override emit(eventName: "event", event: GlobalEvent): boolean {
With the generic EventEmitter<T> form, the base declares emit across a set of overloads including (eventName: string | symbol, ...args: any[]). An override has to be assignable to all of them, and this narrow one-event signature is not — hence any[] not assignable to [event: GlobalEvent].
Why it matters
The hook is the only pre-push gate in the repo, and this failure is indistinguishable from a real error introduced by the contributor. The natural workaround is git push --no-verify, which disables the gate entirely for that push. Anyone who hits it once tends to keep using it.
Important caveat: not universally reproducible
I could not reproduce it. On a clean worktree at origin/main:
bun typecheck |
13 tasks successful, 0 errors |
@types/node |
24.12.2 (matches the catalog: pin) |
typescript |
7.29.7 |
@typescript/native-preview |
7.0.0-dev.20251207.1 |
bun |
1.3.14 |
Same pinned @types/node as the catalog specifies, and global.ts typechecks clean. So this is toolchain- or install-dependent, not a straightforward break on main — which also fits main's CI, where the TypeScript job passes.
That makes the version skew itself part of the bug: two contributors on the same commit get different answers from the same command, and the one who gets the error has no way to tell it apart from a real one.
Suggested direction
Two things worth separating:
- Make the override version-robust so it satisfies the base overload set regardless of which
@types/noderesolves — either by widening the override to the generic signature, or by dropping theemitoverride in favour of a named method (e.g.publish(event)) that stamps the id and delegates tosuper.emit("event", event). - Work out why the resolved toolchain differs between machines on the same lockfile, since a non-deterministic typecheck undermines the hook whatever
global.tslooks like.
Reproduction details from an affected machine (resolved @types/node, @typescript/native-preview, and whether node_modules predates the current lockfile) would pin down which of the two is doing the damage.
Unrelated, noticed while looking
There is no .husky/pre-commit. core.hooksPath is .husky/_, whose generated pre-commit shim exits 0 when no .husky/pre-commit exists, so commits currently run no checks at all. Flagging in case that is unintentional — happy to split it out.
- 主要语言
- TypeScript
- 星标
- 813
- 派生
- 134
- 平均合并
- 2 天 3 小时
- 30 天内合并 PR
- 65
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AltimateAI/altimate-code 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
AltimateAI/altimate-code#1359 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
AltimateAI/altimate-code#1323 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
AltimateAI/altimate-code#1288 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
AltimateAI/altimate-code#1285 ·
-
privacy: Altimate Base consent dialog no longer discloses persistent per-installation identifier 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
AltimateAI/altimate-code#1284 ·
查看 AltimateAI/altimate-code 的全部 Issue
相似的 Issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
Crush 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
catppuccin/catppuccin#3125 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/cln-application#167 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Quantco/pnpm-licenses#17 ·
-
难度 2/5 1-3 小时 新手友好度 75/100