`tsci check` and `tsci check netlist` exit 0 when they report errors

オープン
#5,776 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@aswadi がすでに取り組んでいます。

2026年11月12日 から。

  • #5777 @aswadi による — オープン
  • #5799 @tirumallaharish0200 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
57/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
bun, typescript
領域
cli, testing

調査の方向性

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:

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分
マージ済み PR(30日)
260

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

tscircuit/cli のほかの issue

tscircuit/cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。