Skip to content

fix(scripts): 删除旧 macOS/Windows 客户端遗留的脚本分支和资源 - #2500

Merged
xiaoyumuxi merged 1 commit into
mainfrom
chore/remove-legacy-client-script-paths
Nov 28, 2026
Merged

xiaoyumuxi merged 1 commit into
mainfrom
chore/remove-legacy-client-script-paths

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Collaborator

关联 Issue / Linked issue

PR 类型 / Type

  • feat:新功能或用户可见的改进
  • fix:缺陷修复
  • docs:文档、Agent Note、Skill 等规则文件
  • release:稳定版发布准备

改动说明 / What changes

背景 / Why

旧 Swift macOS 客户端和 Tauri Windows 客户端已在 #1799 删除,但多个脚本仍保留只在 macos/Sources、macos/Resources、windows/tauri 存在时才运行的分支。目录不在时这些分支直接跳过,既不检查也不生成任何东西,却会让人以为 Swift/Tauri 文案和发行目录仍在被校验。仓库里还剩一个没有调用方的 macOS 打包脚本、两份只给原生字符串表用的 fixture,以及 6 条指向已删除路径的 .gitattributes 规则。

顺带修一处 main 上的红灯:#2498 往 verify-runtime-bundle-immutability.sh 的工作流清单加了 file_type_mappings_test.go,但 test-runtime-bundle-immutability.mjs 里的镜像列表没跟着改,Desktop CI 的这条测试在 main 上 5 个用例失败 3 个。

所有 CI 工作流(10 个)和 .github/actions/* 都仍在使用,本 PR 没有删除任何工作流。

改动 / Changes

i18n 生成器 scripts/i18n/generate-i18n.mjs

  • 删除 Windows shared.generated.ts、Swift AppLanguage.generated.swift、各语言 Localizable.strings 的生成分支,以及它们用到的 nativeTemplate、stringsEntry、swiftQuote、quote 和生成区域标记常量。
  • 删除旧 Windows 手写 key 检查(windowsKeys / legacyDirectory)和 --macos-locales 参数;用法变为 [--check|--coverage]。
  • 只生成 desktop/internal/i18n/shared.generated.go;清单与词条的校验规则(含仍存在的 macos / windows 字段)不变,生成结果字节不变(--check 通过)。

i18n 源码检查 scripts/i18n/verify-app-language-localization.mjs

  • 删除 macos/Sources 的 Swift 扫描和 zh-Hans.lproj/Localizable.strings 读取(原第 11–188 行);desktop/internal 的 Go 检查原样保留,报错文案改为指向 i18n.Shared / i18n.SharedFormat。

i18n 测试 scripts/i18n/test-i18n.mjs

  • 删除只针对 Swift、Windows TS、Localizable.strings、macOS 打包和原生 ABI 的用例;fixture 只创建 desktop/internal/i18n。
  • 原“检测过期产物”“新增语言”两项改为针对 Go 生成物的等价用例,非法输入用例的目标文件改为 shared.generated.go;Swift case 和 macos 别名的校验用例保留(校验仍存在)。57/57 通过。

发行目录只读检查

  • verify-runtime-bundle-immutability.sh:删除 macos/Sources 与 windows/tauri/src-tauri/src 的写入检查,结束语只描述共享桌面源码。
  • test-runtime-bundle-immutability.mjs:删除对应的旧客户端用例;镜像列表补上 feat(desktop): support built-in and custom file type mappings #2498 新增的 file_type_mappings_test.go,去掉末尾重复的 remote_devcontainer_form_test.go,顺序与脚本一致。

功能矩阵变更门禁

  • verify-platform-feature-matrix-change.mjs 的平台实现路径只剩 desktop;测试改用 desktop/internal/fixture.go 触发门禁。

删除的文件

  • scripts/macos/package/package-macos-localizations.sh(全仓库没有调用方,scripts/macos/ 随之为空)。
  • shared/i18n/fixtures/format-v1.json、native-abi-v1.json(只服务原生字符串表,桌面测试从未读取)。

.gitattributes

  • 删除 6 条指向已删除路径的规则:macos/Resources/*.lproj/Localizable.strings、AppLanguage.generated.swift、windows/tauri/src/i18n/shared.generated.ts、Plugins/mac/Official/JavaSupport/templates/**、macos/Sources/LitheModuleAPI/Logging/*.swift、rust/crates/diagnostics/src/catalog_generated.rs(Core 已在独立仓库)。shared.generated.go 的 LF 规则保留。

文档与 Agent Note

  • shared/i18n/README.md 整体改写为只描述 Go 字典:读取接口、检查器实际拒绝的写法、新增语言要同时改 desktop/internal/i18n/i18n.go;旧客户端字段标明“仍校验、不再生成,见 [Feature] 统一 Viva 桌面文案的共享 i18n 来源与校验 #1807”。
  • .agents/skills/develop-lithe/references/scripts.md:scripts/macos/ 一行去掉“现有 package/”。
  • 2026-10-23-shared-i18n-generation.md:更正“新增语言只需改清单”“桌面测试消费 format-v1”等已不成立的说法,适用范围去掉 fixture。
  • 2026-11-14-core-app-contracts-single-source.md:fixture 的位置改为“已随生成路径删除”,删除对应验证行和适用范围。

不在本 PR 范围内 / Out of scope

以下与 #1807 同因,已补充到 #1807,不在本 PR 处理:

  • shared/i18n 中只服务旧客户端的数据:8,622 条只标记 macos / windows 的词条、4,930 个 macos.key 和 302 个 windows.key 别名、18 条 overrides.macos / overrides.windows、清单的 macos / swiftCase / platformDefaults 及对应校验。其中 macos 值(en / zh-Hans)正是桌面端保存语言设置用的代码,删除前要先迁走这层对应关系。
  • 桌面端语言列表写死在 i18n.go,不由清单驱动。
  • AGENTS.md“界面文案必须走统一 i18n 接口”和 develop-lithe i18n 一节里的 macOS(SwiftUI、L10n.string、Localizable.strings)规则已过时。
  • shared/platform-feature-matrix/features/shared-i18n.json 的 legacy 证据固定在旧 revision,按矩阵规则保留原样;归档 Note 不改。

类型专属:fix

复现与根因

  • 复现步骤、实际结果、期望结果:在 origin/main(12f76af95)运行 node --test scripts/desktop/verify/test-runtime-bundle-immutability.mjs,5 个用例中 3 个失败(checks both desktop platforms…、ignores test-only executable lookups…、requires each listed workflow…),原因是 fixture 没有写 file_type_mappings_test.go,脚本报 must keep TestFileTypeMappingsStayOutsideInstalledPackage;期望全部通过。其余改动无用户可观察缺陷,动机是删除只在已删除目录存在时才运行的死代码。
  • 根因:6e31700c1(feat(desktop): support built-in and custom file type mappings #2498)只改了 verify-runtime-bundle-immutability.sh 的工作流清单,没有同步测试的镜像列表;旧客户端分支是 Epic(0.7.0): 基于 Viva 框架的跨平台方案的迁移(#1794) #1799 删除 macos/、windows/ 时遗留的。
  • 影响平台:仓库脚本,与平台无关(Desktop CI 在 Linux 上运行该测试)。

检查项

  • 已先写回归测试,确认它在修复前失败、修复后通过;测试路径与修复前的失败输出:现有测试 scripts/desktop/verify/test-runtime-bundle-immutability.mjs 本身就是回归,main 上 pass 2 / fail 3,本 PR 后 pass 4 / fail 0(删掉的 1 个是旧客户端用例)
  • [N/A] 无法自动化时,已写明手动复现与验证步骤:已自动化
  • 已搜索被修改函数、类型、契约字段的全部调用方(含另一平台、插件、SDK、脚本和按字符串分发的调用):rg 确认 package-macos-localizations、fixtures/format-v1、native-abi-v1、--macos-locales、scripts/macos 在工作流、脚本、Makefile 中没有引用;nativeTemplate 只有测试导入且已同步删除
  • 已检查另一平台是否有同类缺陷(有则本 PR 一并修复,或已提交 Issue):Windows 旧分支在同一 PR 删除
  • 只改了修复所需的代码,没有夹带重构;修复过程中发现的其他问题已提交 Issue:已补充到 [Feature] 统一 Viva 桌面文案的共享 i18n 来源与校验 #1807
  • [N/A] 修复改变了行为约束或容易复发,已在 .agents/notes/implemented/bug-fix/ 记录:只删死代码和补测试清单,没有新的行为约束;受影响的两篇 Note 已原地更新

范围检查 / Scope checks

功能矩阵 / Feature matrix

  • [N/A] 已更新 shared/platform-feature-matrix/features/<id>.json:没有用户可观察变化
  • 已运行 ./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh;改了平台实现路径的,还运行了 ./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD
  • 没有提交 .artifacts/ 下生成的矩阵视图
  • 没有更新矩阵的,理由:只删除不会执行的脚本分支、未被引用的文件和失效的换行规则,桌面端行为与生成物字节都不变

插件归属 / Plugin ownership

  • 已在仓库根目录运行 develop-lithe 第三节“插件归属与宿主零依赖”的自查命令,结果为空
  • 新增或修改的测试只使用测试内联的合成插件、Core 契约 fixture 或插件市场索引快照;没有读取具体插件的插件包、仓库检出、构建产物或清单,没有使用真实插件 ID,没有“缺少插件时跳过”的测试
  • 没有为具体插件提供的能力新建或更新宿主功能矩阵条目
  • 插件文案没有写进 shared/i18n/;插件的构建步骤、资源路径和补丁没有写进 docs/ci-builds.md、Agent Note 或 Skill
  • [N/A] 修改了通用扩展点、可能影响已发布插件的:没有修改扩展点

UI 验证 / UI evidence

N/A:没有界面变化。

统一日志系统 / Structured logging

N/A:没有改动日志相关路径。

界面文案 / i18n

  • 宿主文案都走共享 i18n:没有新增或修改词条,生成结果不变
  • [N/A] 插件提供的文字:不涉及
  • 已运行 node scripts/i18n/verify-app-language-localization.mjs 和 node scripts/i18n/generate-i18n.mjs --check,没有放宽脚本或扩大豁免名单(Go 检查规则原样保留,只删除旧 Swift 扫描)

逻辑归属 / Logic placement

N/A:只改仓库脚本,没有业务逻辑。

性能与内存 / Performance and memory

N/A:不涉及运行时。

设置 / Settings

N/A:不涉及设置。

插件契约 / Plugin contract

N/A:不涉及插件契约。

发行包与资源 / Bundle and resources

  • 运行时不向已安装的 app bundle 或 Windows 安装目录写入;已运行 ./scripts/desktop/verify/verify-runtime-bundle-immutability.sh(12 个工作流保留安装包测试)
  • [N/A] 新增或修改宿主自身的下载、解压、生成或缓存资源:没有新增资源;docs/ci-builds.md 的 i18n 说明本来就只写 Go 生成物,无需修改

无用代码与重构 / Dead code and refactoring


验证 / Verification

命令或操作 平台 结果
node --test --test-timeout=60000 scripts/i18n/test-i18n.mjs macOS arm64 57/57 通过
node scripts/i18n/verify-app-language-localization.mjs macOS arm64 通过
node scripts/i18n/generate-i18n.mjs --check / --coverage macOS arm64 通过,en-US / zh-CN 各 13076/13076
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh macOS arm64 通过(12 个工作流)
node --test scripts/desktop/verify/test-runtime-bundle-immutability.mjs macOS arm64 4/4 通过(main 版本 2/5)
node --test scripts/platform-feature-matrix/test-platform-feature-matrix.mjs macOS arm64 5/5 通过
./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh macOS arm64 229 项通过
./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD macOS arm64 通过(没有改平台实现路径)
./scripts/agent-notes/verify-agent-notes.sh macOS arm64 221 篇通过
./.agents/skills/write-stable-tests/scripts/verify-test-stability.sh macOS arm64 N/A:扫描器只覆盖 Rust 与 desktop/**/*_test.go,本 PR 只改 JS 测试;JS 用例均带单项超时,子进程 spawnSync 上限 5 秒
插件归属自查 rg 命令 macOS arm64 无命中
git diff --check macOS arm64 无空白错误

未能执行的检查和原因: 没有在 Windows 上运行;改动只涉及 Node/zsh 仓库脚本,Desktop CI 在 Linux 上运行同一组 i18n 与发行目录测试。没有改 Go 代码,所以没有运行 desktop-go.sh test。

提交前确认 / Final checks

  • 分支从最新的 main 创建;目标分支:main(已 rebase 到 12f76af)
  • 以 Draft 提交,本地验证通过后才标记 ready
  • 没有无关改动,没有提交 .build/、target/、dist/、.artifacts/ 等产物,没有凭据、个人路径和未脱敏的日志或截图
  • 本次构建、测试或预览启动的 Lithe 应用和子进程已全部关闭,没有进程残留(没有启动 Lithe 应用)

旧 Swift 与 Tauri 客户端已在 #1799 删除,下列代码只在已不存在的目录存在时才运行,
现在不再检查或生成任何东西:

- generate-i18n.mjs:删掉 Swift 枚举、Localizable.strings、Windows 字典的生成分支,
  旧手写 key 检查和 --macos-locales 参数;只生成桌面端 Go 字典,校验规则不变。
- verify-app-language-localization.mjs:删掉 macos/Sources 的 Swift 扫描和
  zh-Hans.lproj 读取,只保留 desktop/internal 的 Go 检查。
- verify-runtime-bundle-immutability.sh:删掉 macos/Sources 与 windows/tauri 的写入检查。
- verify-platform-feature-matrix-change.mjs:平台实现路径只剩 desktop。
- 删除 scripts/macos/package/package-macos-localizations.sh(没有任何调用方)和
  只给原生字符串表用的 shared/i18n/fixtures/。
- .gitattributes:删掉 6 条指向已删除路径的换行规则。
- 测试改为针对 Go 生成物;同时修复 test-runtime-bundle-immutability.mjs 中
  #2498 漏改的工作流镜像列表(main 上 3/4 失败)。
- 同步 shared/i18n/README.md、scripts.md 目录表和两篇 Agent Note;
  仍被校验的旧客户端词条数据留在 #1807 清理。

Refs #1807
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 28, 2026
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 28, 2026 15:39
@xiaoyumuxi
xiaoyumuxi merged commit 7cd9b4e into main Nov 28, 2026
9 of 14 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 3 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@xiaoyumuxi xiaoyumuxi mentioned this pull request Nov 29, 2026
10 of 13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant