`tsci check` and `tsci check netlist` exit 0 when they report errors
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 57/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- bun, typescript
调研方向
Start with cli/check/register.ts and cli/check/netlist/register.ts, then compare how cli/check/placement/register.ts sets the exit code. Read tests/cli/check/check-all-diagnostics.test.ts and reproduce with the supplied floating-pin.circuit.tsx commands. Done means both check commands return a non-zero exit code when they report errors, with the test expectations updated to match the intended behavior.
由索引模型根据 Issue 内容生成。
描述
What happens
tsci check netlist and plain tsci check print Errors: 1 and exit with code 0. tsci build on the same file exits 1, and tsci check placement exits 1 when it finds errors, so scripts and CI can't rely on the exit code of these two.
Reproduction
floating-pin.circuit.tsx:
export default () => (
<board width="10mm" height="10mm" routingDisabled>
<chip
name="U1"
footprint="soic8"
pinLabels={{ pin1: "EN", pin4: "GND", pin8: "VCC" }}
pinAttributes={{
EN: { mustBeConnected: true },
VCC: { requiresPower: true },
GND: { requiresGround: true },
}}
connections={{ VCC: "net.VCC", GND: "net.GND" }}
/>
</board>
)
tsci check netlist floating-pin.circuit.tsx; echo "exit=$?"
tsci check floating-pin.circuit.tsx; echo "exit=$?"
tsci build floating-pin.circuit.tsx --disable-parts-engine; echo "exit=$?"
Expected
A non-zero exit code when Errors: is greater than 0.
Actual
$ tsci check netlist floating-pin.circuit.tsx
Errors: 1
Warnings: 0
- source_pin_must_be_connected_error: Port EN on U1 must be connected but is floating
...
exit=0
$ tsci check floating-pin.circuit.tsx
Errors: 1
Warnings: 2
- source_pin_must_be_connected_error: Port EN on U1 must be connected but is floating
...
exit=0
$ tsci build floating-pin.circuit.tsx --disable-parts-engine
Port EN on U1 must be connected but is floating
1 error(s), all written to dist/floating-pin/errors.json:
...
Build exiting with code 1: circuit build errors occurred
exit=1
For comparison, tsci check placement on a board with two overlapping 0402 resistors prints placement summary: 1 pad overlap and exits 1.
Versions
tscircuit 0.0.3161 (@tscircuit/cli 0.1.2454), Bun 1.4.4, Linux.
Cause
The netlist action and the top-level check action only print the output; process.exit(1) is reached only when an exception is thrown:
- https://github.com/tscircuit/cli/blob/575228265fd48b2e29ad4c3287b35408e883fb47/cli/check/netlist/register.ts#L99-L107
- https://github.com/tscircuit/cli/blob/575228265fd48b2e29ad4c3287b35408e883fb47/cli/check/register.ts#L25-L32
placement sets the exit code from its result (added in #4247):
https://github.com/tscircuit/cli/blob/575228265fd48b2e29ad4c3287b35408e883fb47/cli/check/placement/register.ts#L205-L210
pin_specification and source have the same shape as netlist; I haven't found an input that makes them report an error, so I haven't confirmed their exit code.
A test currently pins exit 0 for plain tsci check with Errors: 3 (https://github.com/tscircuit/cli/blob/575228265fd48b2e29ad4c3287b35408e883fb47/tests/cli/check/check-all-diagnostics.test.ts#L28-L34), so this may be intentional. #5155 tried the netlist part together with another change; the review questioned that other change and the PR was closed as stale.
Suggestion
If exit 0 is intended, a --fail-on-error flag or a note in the docs would be enough. Otherwise: return the error count from checkNetlist / check and set process.exitCode = 1 when it is non-zero, as placement does.
AI-assisted: I used Claude Code to read the source, run the reproduction above and draft this report.
- 主要语言
- TypeScript
- 星标
- 19
- 派生
- 115
- 平均合并
- 1 小时 50 分钟
- 30 天内合并 PR
- 260
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tscircuit/cli 的其他 Issue
-
@tscircuit/cli 0.1.2452 bundles brace-expansion 2.0.1 and minimatch 5.1.2 (via make-vfs), both with published advisories可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 1 天内回复
-
tsci dev: ngspice spiceEngine from tscircuit.config.ts fails three ways (package.json, top-level await, blob import)可能已有人在做 @cocvn157 于 11 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 22/100
维护者通常 1 天内回复
-
tsci export -f glb can't load a relative cadModel stepUrl (404); build --glbs can可能已有人在做 @jeffrey-graham 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 25/100
维护者通常 1 天内回复
-
The CLI needs Bun: under Node alone `tsci` fails and the Node entry can't load `.tsx`可能已有人在做 @cocvn157 于 7 天前认领。 未关闭
难度 4/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
-
`tsci check netlist` prints `undefined` after a resistor's value and labels resistor pins anode / cathode可能已有人在做 @cocvn157 于 11 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
software-mansion/argent#1946 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100
podman-desktop/podman-desktop#20216 ·
维护者通常 1 天内回复
-
[Type] Bug
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
omdsh-dev/DSH-better-sidebar#1205 ·
维护者通常 3 天内回复