[Feature] 工作台 Git 测试夹具等待全部后台任务,重构等待边界并补本地截止时间
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- git, go
- Área
- developer-experience, testing
Línea de trabajo
Start with desktop/internal/workbench/app_test.go and tasks.go, then trace how settle and settleChain call App.wait and how the Git fixtures create their repositories. Add locally bounded waits with useful diagnostics and cleanup, and use observable events or state for assertions where possible. Done means the workbench tests retain real local Git coverage, report unfinished work clearly, clean up after failures, and avoid waiting on unrelated background tasks.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem to solve / 要解决的问题
重构工作台 Git 集成测试的 fixture 和等待边界,减少断言对整个 App 后台任务的耦合,并为每个等待设置本地截止时间。
desktop/internal/workbench/app_test.go的 settle/settleChain 经App.wait等待本 App 全部后台任务,而非只等被测行为。轮数上限不能限制单轮 wait;全包期限可以先于有用的断言诊断触发。tasks.go的 wait 本身没有测试本地截止时间;底层个别 Core 请求的 30 秒 context 并不是 fixture 全生命周期的期限。- Git 分支用例的 syncFixture 每次执行 10 次串行真实 Git,建立仓库、本地 bare origin 和另一工作区,再打开完整 App。后续 settle/click 也会等待仓库发现、rebase、operation state、watch/debounce 等任务。
在相同依赖、相同顺序、相同 -test.count=1 -test.v -test.timeout=180s 下,对 main b6eab0b364 与功能分支 e0244463a 分别运行全工作台测试,两侧均达到累计 180 秒期限:
| 对照 | main | 当前分支 |
|---|---|---|
| 已完成顶层用例 | 25 | 26 |
| 共同 25 项的已报告耗时合计 | 160.84 s | 153.17 s |
| 新建公共分支 | 62.59 s | 57.02 s |
| 部分失败回滚 | 32.82 s | 33.44 s |
| 列出阻塞修改 | 29.94 s | 27.77 s |
| 公共分支切换 | 25.80 s | 23.94 s |
main 到期时首个远程分支删除用例仅运行 19 秒;当前分支通过该用例(18.88 秒),在下一用例运行 8 秒时到期。不能将超时栈的最后一个用例判作挂死根因,也不宣称全量通过。
Trace2 记录 main/当前分别 796/849 个根 Git 进程,嵌套 Git 另计 32/40。当前多跑了一项,不能直接把总量增加视为回归;上述四个共同慢用例的命令类别次数逐项相同。根命令中位耗时 86.2/73.1 ms,最长约 1.052/0.700 s,没有单条 Git 接近 30 秒。
去重合并 Git 进程运行区间,仅覆盖全轮约 62.0/58.5 秒;约 118/122 秒处于已记录 Git 区间之外。该差额只能归为进程启动、等待、调度、清理等,现有 trace 无法确定各部分比例,不能将其全算作某一个后台任务。
Proposed solution / 建议方案
- 将 fixture 等待改为有明确本地截止时间、能报告仍在等待的操作/任务的同步边界;assertion 失败时也必须取消并回收任务和子进程。
- 用可控事件或明确可观察状态等待被测操作完成,避免只为绘制、点击或菜单断言等待全部仓库后台任务;必须覆盖真实 Git 边界的集成用例继续保留真实本地 Git。
- 区分最小状态夹具与完整项目生命周期集成,避免为每个断言重复搭建完整双工作区和无关后台链路;不要依赖具体插件或真实网络服务。
- 逐项计时并记录最长用例、未完成任务和清理结果;按变化范围保留集成覆盖与竞态检查。
- 正式调整前先确认 watch 初装和状态发布所需刷新语义。生产侧重复读取能观察到,但本次数据不足以将全部超时归因给它们,不在本测试重构中顺手改变 Git 行为。
Target platform / 目标平台
Cross-platform / 跨平台
Area / 模块
Test / 测试
Priority / 优先级
P2 / 后续考虑:目前不着急,可安排到后续版本
Alternatives considered / 已考虑的替代方案
- 增加全包 180 秒上限:不能替代等待边界、夹具成本与清理规则的修复;本次没有上调预算掩盖超时。
- 删除慢测试或将它们直接跳过:不接受,会丢失多仓库失败回滚和删除分支覆盖。
- 所有 Git 测试都换成假数据:不接受,真实本地 Git 的集成行为仍需验证。
- 在彩虹功能 #2420 中顺手重写测试基础设施:这部分 fixture 和 Git 调度相对 main 未改变,作为既有债单独处理。
Additional context / 补充信息
- 来源:#2420 全量工作台测试超时归因。相同依赖、相同命令重现 main 和当前分支,当前对照未显示共同用例变慢。
- 环境:物理 Windows 11 Pro,build 26300,amd64,Intel Core Ultra 5 125H,32 GiB;Go 1.27.4、Git 2.56.1.windows.1、GNU Rust 1.100.0。合成临时仓库、本地 bare origin,无公网 Git 访问、无用户仓库内容。
- 本地链接 Core
4f4cc06c、Viva448b0553faf8加选色器修复;两侧完全相同。Core 功能 PR 未修改 Git、git-host、request-context 或 protocol 路径。 -v的单测耗时含 t.Cleanup;并发 Git 耗时按区间合并,未简单相加。外部诊断脚本的清理时间未计入上表。- 两侧全量仍未通过;该结果也不替代 macOS/Windows CI 和完整原生流程。共享 Go 测试基础设施为跨平台目标,运行证据目前仅 Windows。
- 查重已搜索 workbench/测试/超时、settleChain、Git/测试/夹具;既有 #2379 是保存文档投递超时,#2368 是 hosted debug 初始化时序,均不是本项 fixture 全局任务等待问题。
Checklist / 提交前检查
- I searched existing issues for duplicates. / 我已搜索现有 Issue,确认没有重复建议。
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.8k
- Forks
- 151
- Merge medio
- 3 h 48 min
- PR fusionados (30 d)
- 571
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de 1lck/Lithe-IDEA
-
review: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
1lck/Lithe-IDEA#2432 ·
Los mantenedores suelen responder en 1 día
-
review: medium
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
1lck/Lithe-IDEA#2431 ·
Los mantenedores suelen responder en 1 día
-
refactor review: high
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
1lck/Lithe-IDEA#2376 ·
Los mantenedores suelen responder en 1 día
-
area:ui enhancement P2 platform:cross-platform refactor review: high
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
1lck/Lithe-IDEA#2365 ·
Los mantenedores suelen responder en 1 día
-
review: medium
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
1lck/Lithe-IDEA#2434 ·
Los mantenedores suelen responder en 1 día
Todos los issues de 1lck/Lithe-IDEA
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
posit-dev/positron-sas-extension#196 ·
Los mantenedores suelen responder en 1 día
-
bug composer
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
inmanta/web-console#8037 ·
Los mantenedores suelen responder en 1 día
-
Add: AlFajer Palestine FHDAbiertocheck:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
Los mantenedores suelen responder en 1 día
-
bug: v5 dist/types/components.d.ts imports @stencil/core/runtime instead of ./stencil-public-runtimeAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día