已开启
Optimize ArkTS linter incremental recheck set to eliminate pseudo-incremental builds #874
Optimize ArkTS linter incremental recheck set to eliminate pseudo-incremental builds #874
已开启
zmw1创建于 2 天前
zmw1
2 天前

描述

问题

ArkTS 1.0 linter 增量重查集合沿 referencedMap 反向 BFS 收集变更文件的全部传递依赖者,没有任何声明形状签名门控:修改任一被广泛依赖的文件即触发整个依赖锥重 lint。某 4.3 万文件工程单日实测:304 次增量中 87 次 linter 超过 30s(伪增量),重查 1.1万~1.9万文件,占全部增量 linter 耗时的 95%,理论可挽回约 4.6 小时/天。重查数聚簇在固定档位(~11,550 × 38+ 次),即中心文件的固定依赖锥被反复重查。

另修复隐患:doAllGetDiagnostics 的 affected 迭代会逐项 drain changedFilesSet,1.1 在迭代后才读取该集合做 version/affectsGlobalScope 全量检查,多数情况下读到空集、检查静默失效。

方案

  1. ArkTS 1.0 机制对齐 1.1:collectChangedFilesFromProgramState 改为收集类型检查器实际重查的文件(getTypeChecker().getCheckedSourceFiles() ∪ getLinterTypeChecker().getCheckedSourceFiles()),依赖传播受声明形状签名(d.ts 哈希)门控,非 API 变更不再引发整锥重 lint;
  2. drain 快照修复(1.0/1.1):在 doAllGetDiagnostics 之前快照 changedFilesSet 传入 collect,version/affectsGlobalScope 全量分支恢复稳定生效;
  3. 可观测性(1.0/1.1):重查集合 >1000 时输出 [LINT-CASCADE] 单行 JSON 日志(触发原因 reason / 规模 / 变更根文件清单),用于定位引发大级联的中心文件。

完整设计文档:docs/design/arkts-linter-incremental-optimization.md(背景数据、根因因果链、兼容性分析、测试设计)。

兼容性

  • 不改变 .tsbuildinfo/.tsbuildinfo.linter 缓存格式,升级/回滚均无需清理缓存;
  • 全量构建行为不变;runArkTSLinter 对外签名不变,ets_loader 调用方零改动;
  • lint 语义变化仅一点:1.0 增量中依赖者在其依赖声明形状未变时不再重 lint(与 1.1 生产语义一致,公开 API 未变则 lint 结果不变)。

Issue

Issue: None

自测试用例

一、tsc测试套

1. tsc原生测试

2. ts_extra_test

二、ArkTSLinter测试套

1. 三方库测试

2. Cookbook+issue测试

3. ArkTest测试

三、 编译测试

1. 端到端测试

CheckList

1. 是否影响abc文件

likedislike
合并受阻
openharmony_ciopenharmony_ci成员
2 天前 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
2 天前 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
2 天前 添加了label:dco检查成功
Zzmw1
2 天前 推送  1 个提交:d92ef5f1-Add mermaid diagrams to the linter incremental optimization design doc
openharmony_ci
openharmony_ci成员
2 天前 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
Zzmw1
2 天前 推送  1 个提交:4909b6d4-Add dependency-hub ranking instrumentation (LINT-HUB-RANK)
openharmony_ci
openharmony_ci成员
2 天前 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ci
openharmony_ci成员
2 天前 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike