bos upgrade re-clobbers child-restored root package.json scripts — default test script also silently exits 1 on repos without plugins/

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

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

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
github, typescript

調査の方向性

Start by tracing the bos upgrade reconciliation source that writes the root package.json scripts, then compare its test and typecheck loops and the v2.0.0-rc.27 template. Reproduce with a child repo that has no plugins/ directory and custom packages/* scripts. Done means upgrades preserve or clearly report child edits, and the default test script succeeds without plugins while retaining package coverage.

索引モデルが issue の本文から書いたものです。

説明

bos upgrade resets child-restored root package.json scripts — and its reconcile source's default test script silently exits 1 on repos without plugins/

Child evidence (activity.nearbuilders.org, v2.0.0-rc.27)

Two separate defects, both observed on the managed v1→v2 upgrade branch (#82, merged as NEARBuilders/activity.nearbuilders.org#82 / #89):

1. Upgrade reconcile overwrites child customizations in root scripts

C1 restored packages/* coverage in the root scripts (the child publishes @nearbuilders/activity-client from packages/client):

test:      … pnpm --dir ui … run test && for dir in packages/*; do if [ -f "$dir/package.json" ]; then pnpm --dir "$dir" --if-present run test || exit 1; fi; done
typecheck: … pnpm --dir ui … && pnpm --dir api … && for dir in packages/*; do if [ -f "$dir/package.json" ]; then pnpm --dir "$dir" --if-present run typecheck || exit 1; fi; done

A later bos upgrade (rc.24 → rc.27, commit ac3ff53) reset both scripts to the framework reconcile versions:

test:      … && for d in plugins/*; do [ -f "$d/package.json" ] && pnpm --dir "$d" --if-present run test; done
typecheck: … if [ -d plugins ]; then for dir in plugins/*; do …; fi; fi
  • packages/* coverage was silently dropped from both the test and typecheck gates.
  • The test reset made CI go red: the repo has no plugins/ directory, the glob stays literal, [ -f "plugins/*/package.json" ] returns false → the unguarded && chain is the last command → the script exits 1 with zero output (the Test job failed 56 ms after the UI suite passed, no failing test to find).

.bos/sync-backup/2026-10-29T04-17-…/package.json did capture the pre-upgrade copy (good), but nothing surfaced that the child's customizations were being reset — the red CI was how we found out. The child re-restored the scripts in NEARBuilders/activity.nearbuilders.org#89's parent commit (909c2b2) and this has now happened twice in the same migration (restored, re-clobbered, re-restored).

2. The reconcile source's default test script fails for plugin-less children

The reset version differs from the upstream template (v2.0.0-rc.27 template root test is pnpm run test:ui && test:api && test:e2e && test:framework), so the plugins/* loop comes from the upgrade's reconcile source — and it has a robustness bug the typecheck sibling doesn't share: typecheck guards with if [ -d plugins ], the test loop is unguarded. Any child without plugins/ would get a silently red test script from the framework's own machinery.

Expected behavior

  • bos upgrade reconciliation should patch rather than reset child-modified sections of files it reconciles (or, minimally, report exactly which child customizations were dropped, not just create a .bos/sync-backup copy). Related but distinct: #650 (v1→v1 one-shot drops) and #659 (stale overrides shadowing the catalog — that one's the same upgrade run pointing the #546 skew gate at the wrong fix).
  • The framework's default root test script should be exit-0-safe for repos without plugins/ (same guard as typecheck), and ideally include a packages/* loop (or generate one from workspace globs) so published children keep their test/typecheck coverage after upgrades.

Repro

  1. Child repo: everything-dev v2 app, restore packages/* loops in root test/typecheck (or any repo with no plugins/ dir).
  2. Run bos upgrade to a newer rc.
  3. Root scripts are reset to the plugins/* variants; pnpm run test now exits 1 silently after the ui suite finishes (see NEARBuilders/activity.nearbuilders.org CI run 40817136914, CI / Test: api 155 ✓, ui 109 ✓, then ELIFECYCLE Test failed).

Child fix commits for reference: 909c2b2 (re-restore) and 96c3be5/44b40a5 (#89, overrides realignment also surfaced by the same upgrade run).

主要言語
TypeScript
スター
5
フォーク
4
平均マージ
9時間 33分
マージ済み PR(30日)
213

環境構築

はじめの一歩

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

NEARBuilders/everything-dev のほかの issue

NEARBuilders/everything-dev の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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