Repository navigation
fix(file-associations): 修复批量默认应用设置与系统状态回读 - #2401
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 24, 2026 14:44
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 / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
勾选多个文本格式并应用时,macOS 的旧实现可能在首个格式上立即返回 -10814,导致整批提前停止。仅注册为“打开方式”候选也不足以让访达双击使用 Lithe。此次改为等待系统默认应用请求完成,并明确显示候选与默认状态;生效后沿用已有的单文件模式打开入口。
一次点击可以提交全部勾选格式,但公开系统接口不保证整组只确认一次。macOS 可能逐内容类型确认,Windows 的最终默认应用选择仍由系统设置完成。
改动 / Changes
NSWorkspace.setDefaultApplication异步完成回调,再核对真实默认应用;查询使用同系列内容类型接口。删除“同步调用成功后立即回读,否则合成 -10814”的判断。不在本 PR 范围内 / Out of scope
pending,本 PR 保持 Draft。类型专属:fix
复现与根因
c086a0b1b/ feat(settings): 按内置高亮格式管理系统文件关联 #2361 的lithe_association_default在同步接口返回成功后立即比较默认值,尚未观察到新值时由宿主合成kLSApplicationNotFoundErr;applyNative随首错返回。关联修订还混入启发式应用路径。Windows 同样遇首项注册写入失败就停止,设置窗口缺少重新激活时的回读。检查项
file_associations_visual_test.go通过真实config.OnActivate触发;临时移除接线时失败于settings has no activation refresh callback,恢复后四种场景通过。原生批量写入不宣称已完成自动回归。.java/.jav别名,接受/拒绝单项、核对后续继续与失败后缀;超时后完成或关闭系统弹窗,再返回核对;验证 Finder 冷暖启动双击进入独立会话。Windows 核对整批 HKCU 注册、一次打开默认页、确认后返回回读、右键和卸载。执行结果仍待补齐。Apply、原生读写、状态字段、设置激活和系统文档入口的调用方;共享 Core 目录和冲突计划沿用既有契约,未修改插件/SDK。.agents/notes/implemented/bug-fix/2026-11-24-file-association-consent-completion.md记录防回归约束,并更新原功能 Note。范围检查 / Scope checks
功能矩阵 / Feature matrix
system-file-associations.json;macOS、Windows 实现为implemented,原生验收为pending,证据与验收动作区分组件测试和系统流程。verify-platform-feature-matrix-change.sh origin/main HEAD通过。.artifacts/生成矩阵视图。插件归属 / Plugin ownership
UI 验证 / UI evidence
9e7ce0642df634b1074d571fed6970d2631c2a55,macOS arm64,vivahead lithevisual,1120×820 点;中文/英文、明暗四种组合。覆盖真实只读默认值、虚拟列表、全选/清空、滚轮到底、激活回读、选择保留及 ⓘ 悬停说明。统一日志系统 / Structured logging
AssociationAction/AssociationError生产接线与目录事件,原生原因返回设置处理边界记录;未新增自由文本日志或事件 ID。Windows 沿用现有日志路径。context.Canceled时豁免,不再吞掉与取消合并的真实失败;不逐格式输出 INFO。界面文案 / i18n
shared/i18n/features/file-associations.json,生成并提交统一字典,视图通过共享 i18n 接口读取。--check通过,没有放宽脚本或豁免。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
插件契约 / Plugin contract
N/A:未修改插件 API、宿主方法、通知、契约或能力版本。Core pin 的变化仅来自同步最新 main;本修复没有独立 Core 改动。
发行包与资源 / Bundle and resources
.artifacts/,不进入安装包,不跨工作树复用。无用代码与重构 / Dead code and refactoring
验证 / Verification
desktop-go.sh test -json -race -tags 'vivahead lithevisual' -p=1 -parallel=1 ./internal/fileassociations ./internal/core ./internal/settingswindow -run '^Test(FileAssociations|VisualFileAssociations$)' -count=1 -timeout=60s,通过逐项计时入口执行9e7ce0642desktop-go.sh test -json -tags vivahead -p=1 -parallel=1 ./internal/workbench -run '^Test(SystemDocumentsPreserveProjectAndReuseIsolatedSession|StandaloneEditsWithBundledSyntaxWithoutProjectServices)$' -count=1 -timeout=60sdesktop-go.sh build -o ../.artifacts/desktop/bin/lithe-file-associations ./cmd/lithe.java当前已生效的同一默认应用重复提交TestEveryLoggedEventIsAcceptedByTheKernelnode scripts/i18n/verify-app-language-localization.mjs/node scripts/i18n/generate-i18n.mjs --checkverify-agent-notes.sh/verify-platform-feature-matrix.sh/verify-platform-feature-matrix-change.sh origin/main HEADverify-runtime-bundle-immutability.shgit diff --check/ gofmt未能执行的检查和原因:
提交前确认 / Final checks
origin/main(67956bcf5);目标为main。pr-assets分支,不进入产品 PR。