feat: add close confirmation dialogs for tabs and windows#16
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add onWindowClosing and sendCloseResponse to the preload bridge and renderer type declarations to support close confirmation dialogs. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…stency, double-close guard Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🔒 门禁检查结果
Rust 测试覆盖率
前端测试覆盖率
✅ 所有检查通过,可以合入
|
…y message loss WebSocket was created immediately in connectPty, but the onOutput callback was registered after the function returned. Messages arriving in this window were silently discarded, causing blank screens for zsh and claude. Defer WebSocket creation until onOutput registers the first listener via ensureWs(). Queue resize messages for when the connection opens. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…setup Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…etection Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…idation Add Playwright E2E tests that verify the terminal renders with a dark theme. The first test checks the terminal container's computed background color is not white. The second captures a full-page screenshot for visual regression with dynamic elements masked. Also switch the Playwright web server from `electron-vite dev --rendererOnly` (which still spawns Electron and exits) to a standalone Vite renderer config. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…gnore Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add maxDiffPixels tolerance and updateSnapshots: "missing" so Playwright doesn't fail when macOS-generated snapshots are compared on Linux CI. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Cross-platform screenshots (macOS vs Linux) differ by hundreds of thousands of pixels due to font rendering — maxDiffPixels: 500 is far too strict. Skip toHaveScreenshot comparison tests on CI while keeping functional tests (dark background, tab count, close dialog). Keep updateSnapshots config as safety net for future screenshot tests. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Fix find_running_daemon_returns_none_when_no_file: use find_running_daemon() (validates PID liveness) instead of read_daemon_info() (reads file regardless). Skip if real daemon is running since the test only covers the no-daemon case. - Add unified-test job to CI running test.sh on Ubuntu - Skip Rust tests on Linux CI (macOS frameworks required) - Update gate-result to include unified-test in pass condition Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Ubuntu's /bin/sh is dash which doesn't support set -o pipefail. The script requires bash (#!/usr/bin/env bash). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
doCloseTab was sending DELETE /sandbox/{id} which the daemon doesn't
serve (returns 404). The error was silently caught, the tab removed
from local state, then the next 3s poll re-created it from the daemon
list — making the tab reappear.
Replace the inline fetch with closeSandbox(id) from api.ts which uses
the correct POST /sandbox/{id}/close endpoint.
Add E2E test that verifies POST /sandbox/{id}/close is called and
DELETE is NOT used.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add open: false to the Vite dev server config used by Playwright's webServer. Without this, Vite may open a browser (VS Code on some systems) when the dev server starts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The "Close All Terminals" button in the window close dialog was using
an inline fetch with DELETE method (404 on daemon), same bug pattern
as the tab close fix. Replaced with closeSandbox() which uses the
correct POST /sandbox/{id}/close endpoint.
Added E2E test verifying the close-all flow calls the correct endpoint.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
问题描述
1. 关闭 Tab/窗口时沙箱进程残留
2. Electron 僵尸进程累积
sandbox start都会 spawn 新的 Electron 进程window-all-closed不触发app.quit())requestSingleInstanceLock后调用app.quit(),产生僵尸进程(状态UE,不可 kill)sandbox start后僵尸进程不断累积3. 回归测试覆盖不足
解决方案
1. 关闭确认对话框
window-closingIPC 与 renderer 通信,5 秒超时兜底POST /sandbox/{id}/close正确关闭沙箱(而非 DELETE)2. Electron 僵尸进程修复
is_electron_running()检查~/.sandbox/electron.json中的 PID 是否存活,存活则跳过 spawncleanupStaleElectron()启动时清理崩溃实例遗留的 electron.json3. 回归测试覆盖
connectPty.test.ts— WebSocket 延迟连接、resize 队列、消息投递(9 个测试)captureToPng.test.ts— buffer fallback 深色背景检测、PNG 生成(10 个测试)tabManagement.test.ts— tab 状态同步、关闭后选中逻辑(8 个测试)tab-creation.spec.ts— Tab 创建、多 Tab 显示、visual regressiontab-screenshot.spec.ts— 终端深色主题验证、背景颜色检测close-dialog.spec.ts— 关闭确认对话框完整流程(5 个测试)Test plan
sandbox start多次后仅 1 个 Electron 主进程,无新僵尸🤖 Generated with Claude Code