Skip to content

[Bug] scripts/i18n/test-i18n.mjs 在 preview 上卡住不退出:测试仍引用已删除的 macos/、windows/tauri 路径 #1908

Closed

Description

@1lck

Platform / 平台

macOS

Area / 模块

Other / 其他

Lithe version / Lithe 版本

preview 7c036b3(源码检出,仓库脚本测试;与发行版无关)

Priority / 优先级

P2 / 后续考虑:目前不着急,可安排到后续版本

OS and architecture / 操作系统与架构

macOS 26.6.2, arm64(Apple M4)

Environment / 环境信息

  • Node.js v24.14.0(fnm)
  • 命令:node --test --test-timeout=60000 scripts/i18n/test-i18n.mjs,这是 develop-lithe Skill 规定的“用户可见文案”最低验证之一
  • 已确认:在干净的 preview 7c036b3b8 临时检出上同样复现,与本地改动无关
  • generate-i18n.mjs --check 和 verify-app-language-localization.mjs 本身正常通过,只是这个测试文件卡住
  • 未采集:Windows、Linux 上是否同样卡住

Steps to reproduce / 复现步骤

  1. 检出 preview 7c036b3b8
  2. 运行 node --test --test-timeout=60000 --test-reporter=spec scripts/i18n/test-i18n.mjs

Expected behavior / 预期行为

所有用例在几十秒内跑完,单条超时时以失败结束,而不是一直挂着。

Actual behavior / 实际行为

前面若干用例通过后不再输出、不退出,等 13 分钟仍在运行;--test-timeout=60000 和用例自带的 { timeout: 15000 } 都没有让它结束,只能外部杀掉。两次运行停下的位置不同(一次在 “duplicate JSON keys include escaped spellings and nested overrides” 之后,一次在 “rejects invalid override parameter before writing any output” 之后)。

推测(待确认):测试仍然按旧客户端布局准备 fixture,文件里有 15 处引用已删除的 macos/ 和 windows/tauri/ 路径(例如 “generation rejects manual native translations and detects stale outputs” 读写 macos/Resources/en.lproj/Localizable.strings 和 windows/tauri/src/i18n/shared.generated.ts)。Viva 迁移删掉这些目录后,某个子进程或文件等待可能不再结束。需要把测试改成 Viva 的生成目标(desktop/internal/i18n/shared.generated.go),并确认超时能真正终止子进程。

Logs or diagnostic output / 日志或诊断输出

✔ locale titles remain literal in generated Swift source (212.330833ms)
✔ checked-in generation is current and checking never changes bytes (155.0225ms)
✔ Git Windows checkout preserves generated bytes with autocrlf enabled (integration) (341.7825ms)
✔ duplicate JSON keys include escaped spellings and nested overrides (0.630666ms)
(此后无输出,进程不退出)

Screenshots or recordings / 截图或录屏

无:命令行测试,日志已贴出。

Checklist / 提交前检查

  • I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复报告。
  • I removed secrets and personal data from the report. / 我已从报告中移除敏感信息和个人数据。

Activity

  1. 1lck commented on Nov 14, 2026

    @1lck
    OwnerAuthor

    本轮定位已确认本单在最新 preview b582e20 中已有修复,按维护者前述清理授权关闭。

    根因在旧生成器的 spawnSync("gofmt", [], {input: source, ...}):约 450 KB 的词条源码通过标准输入送给 gofmt,macOS 上偶发无法结束输入;同步调用同时阻塞 Node 事件循环,因此测试的 JavaScript 超时不能及时中断。旧客户端路径是兼容分支测试夹具,并不是本次挂起的根因。

    修复已经随 #1911 合入,提交为 6196a39。该提交记录了原问题的重复实验;现在改为私有临时文件、异步 execFile、10 秒进程超时和 finally 清理,保持生成字节不变。

    本轮在最新 preview 的隔离工作树实际执行完整 node --test --test-timeout=15000 --test-reporter=spec scripts/i18n/test-i18n.mjs:41/41 通过,约 17.37 秒;整个测试进程另有独立的外部截止时间及进程组清理保护,正常退出,未触发外部终止。

    verify-app-language-localization.mjs、generate-i18n.mjs --check、发行目录只读检查和功能矩阵校验也通过。本次没有为已存在的修复重复修改生成器。

    证据:修复提交、当前 gofmt 调用与清理。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions