v1.4.3 - #92
Merged
Merged
Conversation
…89) ### Issue for this PR Closes # ### Type of change - [ ] Bug fix - [x] New feature - [ ] Refactor / code improvement - [ ] Documentation ### What does this PR do? Adds local filesystem operations and a git timeline to the desktop file tree, plus a system tray and power management so the app can stay resident. **File-tree context menu** (`packages/app/src/components/file-tree-*`, `packages/desktop/src/main/file-ops.ts`): right-click any node to copy / cut / paste / delete / rename / compress to ZIP / extract ZIP. Ops run in the main process over IPC; every positional path is checked with `assertWithinRoot` so the bridge can't touch files outside the workspace. `movePath` falls back to copy+remove on `EXDEV` (cross-device). `renamePath` rejects Windows-illegal chars up front. **Git file timeline** (`git-timeline-dialog.tsx`, `git.ts`): lists commit history for a single file via `git log --follow`. Degrades to an empty state when `git` is missing or the path is outside a repo. **System tray + close-to-tray** (`tray.ts`, `close-to-tray.ts`, `windows.ts`): closing the window hides to tray only when a tray was created. On Linux GNOME (no StatusNotifierItem host) tray creation fails silently and close-to-tray stays disabled, so a window is never stranded. `before-quit` / tray Quit / Cmd+Q set `isQuitting` to bypass hide; macOS `activate` re-shows a hidden window. **Power**: `powerSaveBlocker("prevent-app-suspension")` keeps the app running while active, letting the display sleep. **Server Edition gating** (`desktop-api.ts`, `context/file.tsx`): local fs + git ops require the desktop bridge AND a loopback sidecar — a remote Server Edition connection never touches the local filesystem. **CI** (`.github/workflows/test.yml`, `turbo.json`): adds `macos-14` to the unit matrix; wires `@deepagent-code/desktop#test` / `test:ci` into turbo with JUnit output. ### How did you verify your code works? - `bun typecheck` passes across `@deepagent-code/app` and `@deepagent-code/desktop` (15-package turbo run). - 62 new unit tests pass, zero mocks — real `fs`, real `git` binary, real `zip.js`: - `file-ops.test.ts` (29): all ops, path-traversal defense, the rename cwd≠root edge case, and a real EXDEV cross-device move via `/dev/shm`. - `git.test.ts` (6): isTracked/fileLog/rename-follow against a throwaway repo. - `close-to-tray.test.ts` (4): the full boolean table incl. the GNOME no-tray fallback. - `desktop-api.test.ts` (8) + `file-tree-menu.test.ts` (15): the degradation rules. ### Screenshots / recordings _UI change — TODO: attach a screenshot of the file-tree context menu and the git timeline dialog._ ### Checklist - [x] I have tested my changes locally - [x] I have not included unrelated changes in this PR
### Issue for this PR Closes # (no tracking issue — this fixes the `unit (macos)` CI failure seen on #89) ### Type of change - [x] Bug fix - [ ] New feature - [ ] Refactor / code improvement - [ ] Documentation ### What does this PR do? `c0b79979` ("perf(core): 修复启动慢根因 — sessions.json 防抖") changed `session-state.ts` `saveToDisk()` from a synchronous write to a debounced `setImmediate(flushToDisk)`. The I33-1 plan-store test (`packages/core/test/deepagent/plan-store.test.ts`) predates that change and still assumed synchronous persistence: ```ts SessionState.setPlan("s3", p) // only schedules setImmediate(flushToDisk), nothing on disk yet const raw = readFileSync(path.join(stateDir, "sessions.json"), "utf8") // ENOENT ``` The test body is fully synchronous, so whether the file exists at read time depends on event-loop timing — on the macOS runner it consistently fails with ENOENT, which is what failed unit (macos) (@deepagent-code/core#test:ci exit 1) on #89. The linux/windows jobs in that run were cancelled (fail-fast) before executing, so this is not actually macOS-specific. Fix: make the test async and yield one event-loop turn (await new Promise((resolve) => setImmediate(resolve))) after setPlan, so the debounced flushToDisk lands sessions.json before the assertion reads it. No production code changes. I also replaced the inline require("node:fs").readFileSync with the top-level readFileSync import. I verified the root cause by checking out c0b7997^ in a worktree: the test passes there and fails at dev HEAD, so the debounce commit is what broke it. ### How did you verify your code works? - cd packages/core && bun test test/deepagent/plan-store.test.ts → 8 pass / 0 fail (previously 7 pass / 1 fail with ENOENT) - Full package suite bun test (2236 tests / 225 files): this test was the only failure before the fix - bun run typecheck in packages/core passes ### Screenshots / recordings If this is a UI change, please include a screenshot or recording. N/A — test-only change. ### Checklist - [x] I have tested my changes locally - [x] I have not included unrelated changes in this PR Signed-off-by: thomas-yanga <odie_majere@outlook.com>
### Issue for this PR Closes # ### Type of change - [ ] Bug fix - [ ] New feature - [ ] Refactor / code improvement - [ ] Documentation ### What does this PR do? Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR. **If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!** ### How did you verify your code works? ### Screenshots / recordings _If this is a UI change, please include a screenshot or recording._ ### Checklist - [ ] I have tested my changes locally - [ ] I have not included unrelated changes in this PR _If you do not follow this template your PR will be automatically rejected._ --------- Co-authored-by: Claude Opus 4.8 (1M context) <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.
Issue for this PR
Closes #
Type of change
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.