Skip to content

feat(core): #1662 第三轮 提交图布局与测试历史合并(GIT-18/19、RUN-10) - #1770

Merged
1lck merged 6 commits into
previewfrom
feat/issue-1662-r3
Nov 6, 2026
Merged

1lck merged 6 commits into
previewfrom
feat/issue-1662-r3

Conversation

@1lck

@1lck 1lck commented Nov 6, 2026

Copy link
Copy Markdown
Owner

#1662 第三轮:提交图布局(GIT-18/19)、测试历史覆盖合并(RUN-10)下沉到 Core,并修复一个 preview 上失效的架构检查脚本。

GIT-18/19 提交图布局、lane、颜色和过滤后的拓扑

  • 新增 Core 命令 git.graphProjection
    • 由 Core 负责的部分:IntelliJ 兼容的 permanent layout、head 排序、定色、过滤后的虚线拓扑、隐藏祖先、missing parents、print element、推荐宽度,以及当前分支的祖先集合。
    • 请求字段:commits、remoteNames、repositoryCommits、visibleHashes、displayMode(compact 或 expanded)、currentBranch。
    • 返回内容:整数 lane、稳定的 colorId、layoutIndex、parentEdges、printElements、labels,另有 laneCount、recommendedLaneCount、hasMissingParents、currentBranchHashes。
    • 平台只负责像素和主题色板。
  • 翻页和刷新:每次对整个已加载窗口重新计算,只调用一次 Core。不传入上一页的 lane 状态,因为 lane 依赖所有已加载的边和 head 排序,增量续算会让前面的行受调用历史影响。有名分支的颜色由主引用名的哈希决定,翻页或刷新后不会变。
  • 删除没有调用方的旧 project_graph。
  • fixture
    • 新增 shared/fixtures/git/graph-projection-v1.json,覆盖线性历史、分叉合并、多 head 排序、octopus、跨页、过滤后的虚线、missing parents、颜色稳定。
    • IntelliJ 对拍 fixture 迁到 shared/fixtures/git/graph-idea,由 Rust 测试逐项复核。
    • Rust 侧另有一个 5000 提交的确定性规模测试。
  • Windows
    • 删除 git-graph-layout.ts 里的 DFS、head 排序、定色,以及 git-graph-filter-projection.ts。
    • 改为 git-graph-projection-api 加 useGitGraphLayout。
    • 测试替身 git-graph-projection-stub 回放 fixture,原有提交图测试改成断言 fixture 中的具体结果。
  • macOS
    • 删除 GitGraphProjection、GitGraphHeadOrdering、GitGraphMissingParents,GitGraphLayoutService 改为一次调用 Core。
    • 测试通过 GitGraphCoreTestSupport 调用真实 Core。
    • 删除 LitheGitGraphVerifier 和 CoreVerifier 里的图布局检查,这部分已由 Rust 测试覆盖;性能 verifier 改为链接 Rust Core;verify-git-graph.sh 只保留仓库夹具检查。
  • 行为变化
    • macOS:布局不变,算法是原样搬进 Core 的。
    • Windows:分支名自然序和 macOS 对齐,- 与 _ 不再视为同序;当前分支祖先的高亮改由 Core 提供。

RUN-10 测试历史覆盖合并

  • 新增 Core 命令 build.mergeTestOutcomes
    • 宿主传入历史结果的 ID、本次结果的 ID,以及本次覆盖范围(精确 ID 和 ID 前缀)。
    • Core 只做字符串比较,返回顺序稳定的合并条目,宿主按下标取回各条结果的内容。
    • 合并规则:
      • 被覆盖的历史结果删除,未覆盖的保留;
      • 本次结果只收覆盖范围内的;
      • ID 重复时后者生效;
      • 覆盖范围为空时不覆盖任何结果;
      • 空前缀视为非法请求。
    • fixture:shared/fixtures/build/test-outcome-merge-v1.json。
  • macOS LanguageTestService
    • 删除自有的合并算法。
    • 后端 coverage(project / suite / case)先转成长度前缀 ID 的前缀,再调用 Core。
    • BuildTestResults.Coverage 遇到“有 case、无 suite”的组合时直接解码失败。契约和 Core 的 build/outputs.rs 本来就禁止这种组合,生产方不会产出。
  • Windows maven.store
    • 删除自有的合并算法。
    • Java 的 Outer$Inner 嵌套类规则留在 Maven 适配层,转成 Outer# 和 Outer$ 两个前缀后再调用 Core;Core 里没有 Java 或 Maven 相关判断。
    • 合并改成了异步,写回前会再次核对 revision 和 root。
  • 行为变化
    • Windows:按类运行时,不再把覆盖范围外的 case 追加进历史。
    • macOS:其他 coverage 的替换范围和原来一致。
  • 与 feat(windows): #1495 阶段 D 的 Windows Build、Provider Run 与服务 Debug(从 #1558 拆出) #1722 的重叠:feat(windows): #1495 阶段 D 的 Windows Build、Provider Run 与服务 Debug(从 #1558 拆出) #1722 也改了 LanguageTestService.swift。本 PR 只改了 runUsingBackend 里的合并块,并新增了 coveragePrefix;后合并的一方需要解决这一处的文本冲突。

架构检查脚本修复

  • WS-16(feat(core): #1662 第二轮 快捷键与终端(WS-08/16/17) #1768)已把终端文件链接解析下沉到 Core,macOS 删除了 TerminalLinkResolver,但 verify-module-boundaries.sh 仍要求 LitheTerminalModule 里有这个类型,导致这个脚本在 preview 上失败。
  • 本 PR 去掉这一项,保留“旧文件不得回到可执行 target”的检查。

本地验证

macOS 本机(a5c86ae71)

  • Rust:
    • cargo test -p lithe-core 2150 个测试通过;
    • lithe-agent-host 270 个测试通过;
    • cargo fmt --check 通过;
    • cargo check --bin lithe-windows 只有 2 个既有的 std::os::windows 错误。
  • 脚本:verify-core、shared-contracts、service-boundaries、module-boundaries、windows-boundaries、platform-feature-matrix、verify-git-graph、runtime-bundle-immutability、rust-core-comments、两个 i18n 检查,全部通过。
  • macOS:test-macos.sh --filter 覆盖提交图、Git 模块、测试执行和 LanguageTest 相关测试,498 个测试、26 个 suite 全部通过。
  • Windows 前端(在 Mac 上用 bun 跑):
    • bun run typecheck 通过;
    • 218 个测试文件中 216 个通过;
    • 失败的 2 个(git-status-display-order、maven.store 的 HTML comment 解析)在 preview 8f2c7ac 上同样失败,在 Windows 上都能通过。

Windows 真机(lithe-dev)

  • windows/tauri/src-tauri 构建通过;
  • cargo test -p lithe-core git::graph 24 个、test_outcome 3 个,全部通过;
  • bun run typecheck 通过;
  • git、maven、run、test-utils、tests 目录逐文件跑,217 个文件全部通过。

验证通过后用 --admin squash 合并,没有触发云端 macOS/Windows CI。

🤖 Generated with Claude Code

1lck and others added 6 commits November 5, 2026 18:28
新增 Core 命令 git.graphProjection:把 macOS 的 IntelliJ 提交图算法(permanent layout、head 排序、
定色、过滤后的虚线拓扑、隐藏祖先、missing parents、print element、推荐宽度)搬进 git::graph,
返回整数 lane、稳定的 color ID、路由和标签。删除没有调用方的旧 project_graph。
共享 fixture graph-projection-v1.json、IntelliJ 对拍 fixture 迁到 shared/fixtures/git/graph-idea,
Rust 测试覆盖 fixture、真实历史对拍和 5000 提交规模。

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
提交图布局、定色、过滤后的虚线拓扑和 missing parents 改为整窗口一次调用 git.graphProjection,
删除 TS 的 DFS/permanent layout/head 排序/按名称哈希定色和 git-graph-filter-projection。
当前分支祖先高亮改用 Core 返回的 currentBranchHashes。颜色 ID 到具体颜色的映射留在 git-graph-colors。
测试替身新增 git-graph-projection-stub(回放共享 fixture),布局/行/主题/表格测试改为断言 fixture 的具体结果。

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
提交图布局、定色、过滤后的虚线拓扑和 missing parents 改为整窗口一次调用 git.graphProjection,
删除 Swift 的 GitGraphProjection / GitGraphHeadOrdering / GitGraphMissingParents;
当前分支祖先高亮改用 Core 返回的 currentBranchHashes。
测试通过 GitGraphCoreTestSupport 调用真实链接的 Core;删除 LitheGitGraphVerifier 与 CoreVerifier 里的图布局检查,
性能 verifier 链接 Rust Core;同步功能矩阵、Agent Note 与语言特定词基线。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- 新增 build.mergeTestOutcomes:宿主给出历史/本次结果 ID 与覆盖范围(精确 ID + ID 前缀),Core 只比较字符串,输出稳定顺序的合并条目;空范围不覆盖任何结果,空前缀拒绝。
- 新增共享 fixture test-outcome-merge-v1.json。
- macOS LanguageTestService 删除自有合并算法,coverage 转长度前缀 ID 前缀后调用 Core。
- Windows maven.store 删除自有合并算法,Java 嵌套类(Outer$Inner)在 Maven 适配层转成前缀后调用 Core;测试替身补齐新命令。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
契约与 Core 解码已禁止只有 case、没有 suite 的 coverage,生产方不会产出。macOS 解码层同样拒绝这种组合,覆盖前缀不再把它降级成 project 前缀,避免删多历史结果;补解码拒绝测试。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WS-16(#1768)已把终端文件链接解析下沉到 Core(terminal.parseLinkTarget),
macOS 删除了 TerminalLinkResolver,但 verify-module-boundaries.sh 仍要求
LitheTerminalModule 里有这个类型,导致脚本在 preview 上失败。去掉这一项,
保留旧文件不得回到可执行 target 的检查。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 6, 2026
@1lck
1lck marked this pull request as ready for review November 6, 2026 03:12
@1lck
1lck merged commit a1c1d41 into preview Nov 6, 2026
17 of 19 checks passed
frankxii added a commit to frankxii/Lithe-IDEA that referenced this pull request Nov 7, 2026
preview 的 1lck#1770(GIT-18/19)把提交图布局从 Windows TS 下沉到 Rust Core 的 git.graphProjection,删除本 PR 修改的 git-graph-layout.ts 及其测试。

- 接受删除:布局规则改由 Core 与共享 fixture 提供;本仓库不再保留 TS 布局实现。
- 不改共享契约:Core 对未加载父提交仍返回 targetHash=null,macOS 消费同一字段。Windows 在 attachGitGraphCommits 里按 print element id 关联整个窗口的 parentEdges[].parentHash,补齐箭头定位目标;必须跨行关联,因为 Core 把 missing 箭头画在源行的下一行。
- 保留本 PR 的箭头定位、5 页有界补齐、失败提示与 3 个 i18n 词条;导航测试改为基于 installGitGraphProjectionStub,并新增 missingParents 投影替身供分页交互测试使用(只造边形状,不承担布局规则)。
- navigation 测试的 beforeEach 合并两侧初始化(Core stub + IntersectionObserver)。
- 重新生成 i18n、更新 2026-11-04 箭头定位 Agent Note 的适用范围与验证命令、同步平台矩阵记录。

验证:定向测试 54 pass,Git log/hook/runtime 148 pass;tsc --noEmit、lint(0 error)、i18n 生成与 --check、app-language 文案校验、216 篇 Agent Note、250 项平台矩阵门禁均通过。
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