Repository navigation
fix(package,shell): 修复隔离桌面下开发版自动安装窗口检测报 invalid argument (#84) - #87
Merged
Merged
Conversation
…op EnumWindows (#84) Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:独立审查完成(head 审查结论可合并(高风险 PR,待用户审阅合并)
已审查范围与核对项已逐文件审阅本 PR 全部 9 个改动文件及周边调用链(
未覆盖部分(
|
This was referenced Nov 25, 2026
chialecode
added a commit
that referenced
this pull request
Nov 25, 2026
Closes #86 ## 做了什么 在「任务 › 内容冲突」卡片上新增「对比差异」入口与**并列对比弹窗**,让用户在处理内容冲突前可以直观看到本地已缓存版本与远端最新版本之间的文字、图片与视频区别: - **服务层实时差异查询与文字 Diff(`internal/service/cache_conflicts_types.go`、`internal/service/cache_conflicts_diff.go`)** - 在 `ConflictService` 接口新增 `InspectCacheConflictDiff(ctx, id)`,按需实时对比本地缓存项与远端最新版本(覆盖哔哩哔哩视频/动态、抖音视频/图文、微博正文/视频、X 帖子/长帖/线程四站),仅在内存中生成临时对比视图,**不将瞬时签名媒体 URL 持久化写入 `cache-conflicts.json`**。 - 实现 `DiffTextSideBySide`:支持中英文与换行感知分词及有界 LCS(超长文本自动回退按行比对),严格保持左右重构后与原文本一致。 - 按 `CID` / `MediaID` / 去参数 URL / 顺序对齐图片与视频,标记 `same` / `changed` / `local_only` / `remote_only` / `upgradeable` 状态;远端降级、未登录或拉取失败时优雅降级并保留完整本地预览与说明。 - **界面层并列对比弹窗(`internal/ui/tasks_conflicts_diff_modal.go`、`internal/ui/tasks_conflicts_view.go`、`internal/ui/app.go`)** - 每条冲突卡片新增「对比差异」按钮,点击弹出并列对比弹窗(置于图片查看器与播放器浮层之下,点击左右侧图片/视频可直接打开大图查看器或播放器细看)。 - 标题与正文差异采用左右并列高亮(左侧红底标出旧版删改、右侧绿底标出新版新增)。 - 图片与视频采用左右并行卡片展示(标注分辨率/码率/状态徽标),弹窗底部可直接执行「保留两版(推荐)」「仅保留当前版本」及带行内确认的「用新版替换」。 - **测试、截图断言与文档(`internal/service/cache_conflicts_diff_test.go`、`internal/ui/tasks_conflicts_diff_test.go`、`tools/uishots/*`、`docs/ui.md`、`docs/dev-rules/engineering.md`)** - 新增服务层与 UI 层单测(含文本无损重构、四站媒体对齐、远端失败回退、零瞬时 URL 持久化、720px 窄窗无溢出断言)。 - 新增 `tools/uishots` 场景 `tasks-conflicts-diff`(现共 102 个场景、306 张 PNG)并同步文档。 ## 验证 - [ ] `go run ./tools/check`(本机隔离沙盒桌面环境受既有 #84 问题影响,仅 `tools/internal/build/TestWindowOpenWithoutWindows` 失败,其余全部包与门禁项均通过;待 CI `repository-quality` 验证完整门禁) - `gofmt -l`:通过(488ms) - `go vet ./...`:通过(22.295s) - `go test ./...`:除 `tools/internal/build`(`TestWindowOpenWithoutWindows`:`WindowOpen(build.test.exe) = false, invalid argument`,即隔离桌面已知问题 #84,已由 PR #87 单独修复)外,全部其余包均通过(含 `internal/service` 92.198s、`internal/ui` 98.524s、`internal/download` 101.944s、`tools/uishots` 39.131s、`tools/actcheck` 53.464s、`tools/smoke` 1.922s) - `go run ./tools/deps`:通过 - `go run ./tools/checkdocs`:通过(`checkdocs: OK`) - `CGO_ENABLED=0 GOOS=linux GOARCH=amd64|arm64 go build ./cmd/trace-server`:通过 - `CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go vet ./...`:通过 - `git diff --check origin/main...HEAD`:通过 - [x] `go run ./tools/uishots -out artifacts/uishots`:通过(102 场景 / 306 张 PNG,含新增 `tasks-conflicts-diff` 1280/1000/720 三档宽度渲染与布局断言) - 注:因本分支在独立 `git worktree` 中提交,按 `LESSONS.md` 规范在本地跑完门禁后使用 `git push --no-verify` 推送,避免 `.githooks/pre-push` 干扰 worktree 引用。 - `not-run`:未在真实站点实机点击对比弹窗(仅通过合成 HTTP 服务与 `uishots` 验证),待合入并重装开发版后由用户实机体验。 ## 风险 - [x] 低风险(仅新增只读差异计算、冲突对比弹窗 UI、对应单测/截图场景与文档;不改变 `cache-conflicts.json` 持久化结构、数据库模式、凭证隔离、打包安装、远端服务或 CI 工作流) - [ ] 高风险(已加 `risk:high`,等用户合并) 每个提交都带 `Signed-off-by`(`git commit -s`)。 --------- Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
2 of 3 tasks
…flicts Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:已完成对 PR #87 新合并提交
|
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.
Closes #84
根因与修复
exebox-*)中,Win32EnumWindows返回r1 = 0且GetLastError() == 0(ERROR_SUCCESS);golang.org/x/sys/windows.EnumWindows会把e1 = 0包装为syscall.EINVAL(invalid argument),且隔离桌面上的EnumWindows本身看不到用户交互桌面上的窗口。internal/appdirs/runtime_window.go与internal/shell/shell.go:桌面应用在运行期向数据目录原子写入临时的runtime-window.json(pid、windowOpen、updatedAt,退出时按本进程 PID 清理,不改任何数据结构版本)。tools/internal/build/window_windows.go与tools/package/install_windows.go:新增WindowOpenForDataDir(exe, dataDir),优先核对运行中 PID 写入的runtime-window.json准确判断窗口是否打开(跨桌面也遵守“窗口开着推迟安装”);对未写标记的旧版开发版兜底调用原始EnumWindows,直接检查e1(不再把空桌面的(r1=0, e1=0)误报为invalid argument)。docs/design/data-and-cache.md与LESSONS.md,补齐internal/appdirs/runtime_window_test.go与tools/internal/build/window_windows_test.go。验证
go run ./tools/check0,2m44.475s)gofmt、go vet、go test ./...(含新增TestRuntimeWindowStateLifecycle、TestInterpretEnumWindowsResult、TestWindowOpenForDataDirUsesLiveMarkerAndSurvivesEmptyDesktop)、依赖方向、Linuxtrace-server构建、tools/checkdocs、git diff --check HEAD全部通过git push --no-verifygit worktree中推送(规避pre-push钩子向tools/release测试注入GIT_DIR,见LESSONS.md),推送前已在同一 HEAD 上完整跑通go run ./tools/checkgo test -racenot-runnot-run风险
tools/internal/build与tools/package(开发版自动安装链路),按workflow.md#high-risk标为risk:high,留给用户合并。