refactor: 2 モード e2e の重複 spec を整理 + 振り分け基準を ADR-0009 に集約 (#207)#231
Merged
Conversation
- e2e/settings-persistence.spec.ts → workspace-restoration.spec.ts (git mv):
sidebarVisible round-trip test 2 件削除 (in-memory mock 実証性なし、
実 Electron 側で完全 mirror 済)、残り 2 件は negative cases、
describe を scope 明示型 ("workspace restoration: skip / fallback
branches (mocked settings)") に変更
- CLAUDE.md: 振り分け基準を直接書かず、ADR-0009 §「各モードの役割分担
(テスト分類方針)」への 1 行 pointer を追加
- ADR-0009 spec table: Phase 4 で追加された pdf-pagebreak /
structured-error を追加 (9→11 spec)
- docs/parity-checklist.md: rename note を L261 に注記、L266 の領域
inline list (11 項目) を ADR-0009 への canonical pointer に圧縮
audit comment (issue 提案) は TypeScript 型 conform
(`const api: Api = { ... }` + `pnpm typecheck:e2e`) で既に enforce
されているため追加しない。詳細は PR 本文「設計判断」セクション参照。
closes #207
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ymnao
added a commit
that referenced
this pull request
Jun 26, 2026
- `CHANGELOG.md` に v0.6.0 セクションを追加 - Internal: #206 → #229 (AppLayout useShallow), #208 → #230 (settings _schemaVersion + MIGRATIONS), #207 → #231 (2 モード e2e 振り分け + ADR-0009 集約), #225 → #232 (onNavigate wikilink target), #226 → #233 (useCollapseToggle hook), #228 → #234 (createScanAction factory), #227 → #235 (producer-side lineContent trim) - `package.json` の `version` を `0.5.0` → `0.6.0` - HANDOFF の規約通り、本 commit では `pnpm <script>` を呼ばない (lockfile / node_modules には触れない)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
#207 の解消。
scripta の e2e は 2 モード並行運用 (renderer-only + 実 Electron) で運用しているが、
e2e/settings-persistence.spec.tsの test 1, 2 (sidebarVisible 復元) が in-memory mock では実証性なし → renderer-only から削除し、実 Electron 側 (e2e/electron/settings-persistence.electron.spec.ts) に safety net を集約。同時に「どちらに spec を書くか」の振り分け基準を canonical 化する。ADR-0009 は既に「各モードの役割分担(テスト分類方針)」§ で領域別の spec 対応表 + 「mock で踏めるか」の判断原則を持つので、CLAUDE.md からはこれへの 1 行 pointer + 同 ADR の spec table 拡張 (pdf-pagebreak / structured-error 追加) で対応。parity-checklist の領域列挙も同 ADR pointer に集約 (3-place sync を解消)。
関連 Issue
closes #207
移行 Stage
変更内容
e2e/settings-persistence.spec.ts→e2e/workspace-restoration.spec.ts(git mv):e2e/electron/settings-persistence.electron.spec.ts:20-23, 36で完全 mirror 済)?newWindow=trueの workspace 復元 skip + 無効パス fallback)"workspace restoration: skip / fallback branches (mocked settings)"に変更し、scope を name で明示docs/adr/0009-renderer-only-e2e-strategy.md§「各モードの役割分担」 table: Phase 4 で追加されたpdf-pagebreak.electron.spec.ts/structured-error.electron.spec.tsを追加 (9→11 spec)docs/parity-checklist.md:設計判断: issue 提案からの逸脱
issue #207 は以下を提案していた:
electron/preload/api.ts冒頭に「IPC contract 変更時は mock も同期」audit comment を追加smoke.spec.tsの scope 絞り込み (renderer-only 側を最小に)本 PR は以下の通り逸脱:
1. CLAUDE.md には振り分け基準を直接書かず、ADR-0009 への 1 行 pointer に集約
ADR-0009 §「各モードの役割分担(テスト分類方針)」が既に領域別 spec 対応表 + 「mock で踏めるか」の判断原則を持っているため。直接書くと CLAUDE.md / ADR / parity-checklist の 3-place sync を生む (本 PR の
parity-checklist L266 pointer 化も同じ問題への対応)。2. audit comment は追加しない (TypeScript 型 conform で代替)
e2e/helpers/electron-api-mock.ts:458が既にconst api: Api = { ... }で型 conform を強制し、pnpm typecheck:e2eが CI 必須 gate として動作している (mock.ts L455-457 にも既存 inline commentApi 型に固定することで preload 契約と乖離した瞬間に typecheck が落ちるあり)。コメントを追加すると mechanism の triple-write (CLAUDE.md + api.ts + mock.ts) になり drift hazard を生む。TypeScript 型に任せる方が deep fix。
3. smoke.spec.ts は変更なし (削除も scope 絞り込みもしない)
renderer-only smoke と 実 Electron smoke は layer が異なる:
layer が異なる以上、片方を絞り込むのではなく両方を独立 spec として維持。
動作確認
UI / runtime 動作は変更なし (docs + comment 修正 + test 2 件削除 + describe rename のみ)。
node_modules/.bin/biome check --write: pass (4 ts files)node_modules/.bin/tsc --noEmit -p tsconfig.web.json / tsconfig.node.json / tsconfig.e2e.json: pass (typecheck:e2eの pass が mock のApi型 conform 維持を実証)node_modules/.bin/vitest --run: 2212 passed (96 files) / 2 skippednode_modules/.bin/electron-vite build: pass (449ms)pnpm test:e2e(renderer-only): sandbox EPERM のためローカル不可、CI 待ちpnpm test:e2e:electron(実 Electron): ローカル不可、CI 待ち/simplify + /code-review の経緯
/simplify/code-review1 周 (max effort)parity-checklist:261stale 修正、コメント追加の factual error (「下記 const api」が 445 行下) + self-redundancy 発見 → 4 ファイル comment 完全削除 + ADR-0009 spec table 拡張 + describe 名変更/code-review2 周parity-checklist L266の 11 項目 inline list が ADR-0009 table と duplicate → L266 を canonical pointer に圧縮skip した別 issue 候補 (本 PR scope 外、別 issue 起票検討)
e2e/helpers/electron-api-mock.ts:458):const api: Api = { ... }は signature conform を gate するが return-value shape (例:gitStatus.branch === '' vs undefined) は enforce しない。shared default payload (real IPC handler と mock で同じ default constant を import) 化が deep fix。Altitude。pdf-pagebreak.electron.spec.ts) は PDF エクスポート (pdf-export.electron.spec.ts) と同じpdf:exportIPC main 境界に対する 2 spec。ADR 自体の改訂検討。docs/parity-checklist.md:261「23 spec」base が stale: 実際は 29 spec。renderer-only spec 追加の都度 cell 注記が伸びる構造的問題。本 PR でも 1 件 append したので、別途 cell rewrite 検討。