E2E スモークテストの大幅拡充と JSON ファイル書き込みの原子性改善#106
Conversation
defineExpose された ref はテンプレート ref 経由では自動アンラップされるため、 commitForm.value?.commitMessage?.value が常に undefined となり Commit ボタンが有効化されなかった(E2E テスト追加時に発覚)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
devices.json は認証リクエストごとに書き換わるため、write_text の直書きだと 並行リーダーが書き込み途中の JSON を読んでデバイス認証が 401 になる レースがあった(E2E 全体実行時に発覚)。ユニークな tmp ファイルへ書いてから os.replace でアトミックに差し替えるよう変更し、torn read / 並行ライター競合の 両方を解消する。並行リーダー・ライターのユニットテストを追加。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
追加スペック: - workspace.spec.js: ワークスペース登録・重複 / 不正パスエラー・削除(確認ダイアログ) - workspace-panes.spec.js: 詳細ペイン(Files 閲覧 / リネーム / 削除、Changes+Commit、 History、Branches 表示 / 作成、Jobs 追加 / 実行、Stash 保存 / Drop)とディープリンク - settings-views.spec.js: 設定モーダル全ビューの遷移と Auth / Config File / System Info 表示 - tabs.spec.js: Tabs & Sessions(一覧・切替・デタッチ / 再アタッチ・クローズ確認) - shortcuts.spec.js: グローバルショートカット(⌘⇧N / ⌘⇧W) - snippets.spec.js: スニペット追加・削除(API で事前状態を復元) - mobile-terminal.spec.js: モバイルでの KeyboardBar 表示 - terminal.spec.js: タブ切替時の出力保持テストを追加 helpers.js に設定モーダル操作・Bearer ヘッダ・ブート完了待ちを追加。 playwright.config.js に ANY_CONSOLE_E2E_CHROMIUM による Chromium バイナリ上書きを追加 (プリインストール済みブラウザ環境向け。未設定時は従来どおり)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
CI ランナーはグローバルの user.name / user.email が未設定のため、 サーバ経由の git commit / stash が rc=128 で失敗していた。 テスト用リポジトリの作成時にローカル config で識別情報を設定する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb19f9dffa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
既存のデタッチ済みセッションがサーバにあると .first() がそれを掴んで 既存状態を変更してしまうため、detached-row に data-session-id を付与し、 テストが作ったセッション ID の行だけを検証・操作するようにする。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62994cbc5b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- スニペット: 事前スナップショットの取得失敗時はテストを中断し、 取得成功時のみ復元する(失敗時に空配列を書き戻すと既存スニペットを 全消去してしまうため) - ワークスペース削除: 削除成功(または既に削除済み = 400/404)を確認 できるまでリトライし、失敗が残る場合は後始末を失敗させてから ディレクトリを消す(消えたパスを指す登録が残るのを防ぐ) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10ae0cfce9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
login() はテストごとにデバイス登録するため、実サーバに対して実行すると
devices.json に孤児デバイスが溜まり続けていた。helpers.js の test を
auto fixture 付きで拡張し、テスト終了時に自テストのデバイス cookie を
読み取って DELETE /devices/{id} で失効させる。全 spec を helpers.js の
test を import する形に統一。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d0322e00ab
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
固定の絶対パス(/nonexistent/e2e-path)は実在する環境だと登録が成功して サーバ状態を汚すため、テスト管理下の一時ディレクトリ配下で作成していない 子パスに変更する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1d0063c4d2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
復元 PUT のレスポンスを確認せず成功扱いにしていたため、401 / 429 / 5xx 時に既存スニペットが変更されたまま残りうる。リトライの上で成功しなければ 例外にして顕在化する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e414eb92e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- listSessionIds: 取得失敗を空配列にせず例外にする(空配列だと既存セッションが すべてテスト作成物に見え、cleanup で削除されてしまう) - cleanupNewSessions: スナップショット未取得(null)・現在一覧の取得失敗時は 何も消さない(誤削除より消し漏れ側に倒す) - 各 spec: beforeEach 冒頭で sessionIdsBefore を null にリセットし、 前のテストの値のまま cleanup が走らないようにする - デバイス自動失効: レスポンスを検証し、リトライしても成功(または 404)を 確認できなければ teardown を失敗させる Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a6839e815
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
全書き戻しはテスト実行中に行われた無関係な編集まで巻き戻してしまうため、 現在の一覧からこのテストが作ったスニペットだけを取り除く方式にする。 後始末の失敗はリトライの上で teardown を失敗させて顕在化する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 775f3d8311
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
固定文字列だと、ユーザーが偶然同じコマンドのスニペットを持っていた場合に 後始末で消してしまうため、タイムスタンプ + 乱数で毎回生成する。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 004f225281
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
概要
E2E スモークテストを大幅に拡充し、ワークスペース管理・タブ操作・設定ビュー・スニペット・ショートカット・モバイルターミナルなど主要フローをカバーしました。あわせて、並行アクセス下での JSON ファイル書き込みを原子化し、認証失敗などの誤動作を防ぎます。
主な変更
E2E テスト追加
workspace.spec.js: ワークスペース登録・重複登録エラー・削除フロー(確認ダイアログ含む)workspace-panes.spec.js: Git リポジトリを作成し、Files / Changes+Commit / History / Branches / Jobs / Stashes ペインの操作、ディープリンク(?ws=...&pane=...)を検証settings-views.spec.js: 設定モーダルの全ビュー遷移、Auth / Config File / System Info の表示内容確認tabs.spec.js: Tabs & Sessions でのタブ一覧・アクティブ切替・デタッチ / 再アタッチ・クローズ確認ダイアログshortcuts.spec.js: グローバルキーボードショートカット(⌘⇧N / ⌘⇧W)snippets.spec.js: スニペットの追加・削除(テスト前の状態を API で復元)mobile-terminal.spec.js: モバイルビューポート(375px)でのターミナル起動と KeyboardBar 表示確認テスト基盤強化
helpers.js:bearerHeaders()/openSettingsModal()/openSettingsView()を追加し、テスト間の共通処理を統一terminal.spec.js: タブ切替時の出力保持を検証するテストを追加playwright.config.js: Playwright 管理外の Chromium バイナリ対応(executablePath上書き)Backend 改善
api/common.py:save_json_file()を原子化tempfile.mkstemp()で一時ファイルを作成し、os.replace()でアトミックに差し替えテスト追加(Python)
tests/test_api_utils.py:save_json_file()の roundtrip / 上書き / 並行ライター / 並行リーダー安全性を検証実装上の注意点
cleanupNewSessions()/afterAll/afterEachで復元)https://claude.ai/code/session_0112kXeCuiZUpp8QMphFFpkE