Skip to content

test(ci): 修复 preview 上的格式和跨平台测试失败 - #1723

Merged
xiaoyumuxi merged 1 commit into
previewfrom
fix/preview-ci-repair
Nov 4, 2026
Merged

xiaoyumuxi merged 1 commit into
previewfrom
fix/preview-ci-repair

Conversation

@xiaoyumuxi

Copy link
Copy Markdown
Collaborator

背景

preview 上有 4 类 CI 失败,基于它的 PR 都会被拦。#1720 合并时最后一轮的失败项就是这些:CI tooling tests、Test Windows frontend、Test Windows Rust implementation (shared-1);Swift tests 那一轮被取消,它的失败来自更早一轮的完整 CI。

这个 PR 只改测试和格式,不改产品行为。

改动

rustfmt(CI tooling tests)

Windows Rust

  • rust/lithe-core/src/diagnostics/request_trace.rs:测试 fields_keep_valid_tokens_and_omit_invalid_ones 用的 /tmp/project 在 Windows 上 Path::is_absolute 为 false,字段被丢弃。改成按平台取路径(Windows 用 C:\project)。
  • rust/lithe-core/src/tests/core_request_traces.rs:Windows runner 的临时目录在 home 下,脱敏结果是 <HOME>\...,不是 <PATH>。断言改成两种都接受,后面“序列化结果不包含真实路径”的检查保留。这个失败之前被上一条盖住了,Rust 测试 harness 遇到首个失败就停。

macOS Swift

  • macos/Tests/LitheTests/DiagnosticsWorkflowTests.swift:logWindowMatchesMockup 的窗口改成带标题栏后,AppKit 上屏时会把它压进屏幕范围,CI 的 1024×768 屏幕放不下测试要的尺寸(1340×786 被压成 1024×642)。新增只在测试里用的 ScreenUnconstrainedWindow,重写 constrainFrameRect(_:to:) 保持原尺寸。没有把窗口移出屏幕,也不改 LITHE_TEST_WINDOW_MODE=isolated 的隔离方式。

Windows 前端

  • windows/tauri/src/features/git/utils/lossy-rollback-channel.test.ts:mock 补上 fix(git): 按文件实际归属解析仓库 #1717 新增的 git.resolveFileContext。修复前这个文件 6 个用例全部报 Unexpected command: git.resolveFileContext。

为什么 preview 没拦住

matrix-exempt

矩阵门禁按路径判断,测试和纯格式改动也要求能力记录有实质变更。这个 PR 没有用户可观察的变化,不应该改能力记录,所以用 matrix-exempt(先例:#1333、#1361)。标签由 PR 发起方确认后添加,请 reviewer 复核这一判断。

验证

变基到 f8d1fb8ee 后本地通过:

  • scripts/rust-core/verify-rust-core-static.sh(含 rustfmt)
  • 上面改过的 2 个 Rust 测试
  • lossy-rollback-channel.test.ts 6 个用例
  • --filter 'DiagnosticsWorkflowTests' 整组

变基前本地通过:

  • verify-rust-core.sh 全量(lithe-core 1725 个单元测试及其余 Rust 测试)
  • CI 里 Windows 前端失败步骤和被跳过的后续步骤,以及 bun run typecheck
  • verify-windows-boundaries.sh、verify-test-stability.sh、verify-platform-feature-matrix.sh

本地没有覆盖的部分

  • Windows 虚拟机不可用,Windows Rust 只做了静态核查,前端测试是在 macOS 上跑的,要靠这次 CI 确认。
  • Swift 全量没有在本地跑,本地 Xcode 27.2,CI 是 26.6。

观察到但没有改的问题

这些失败都来自 preview,会拦住所有基于它的 PR:

- rustfmt:格式化 #1717、#1718 留下的 git/mod.rs 和 dispatcher.rs。
- Windows Rust:request_trace 测试用 Windows 下不算绝对路径的
  /tmp/project;core_request_traces 测试的临时目录在 home 下,
  脱敏结果是 <HOME>\...,不是 <PATH>。
- macOS Swift:日志窗口测试改成带标题栏的窗口后,AppKit 会把它压进
  CI 的 1024x768 屏幕;测试窗口改为不受屏幕限制。
- Windows 前端:lossy-rollback-channel 的 mock 补上 #1717 新增的
  git.resolveFileContext。

只改测试和格式,不改产品行为。
@xiaoyumuxi xiaoyumuxi added the matrix-exempt Reviewed non-user-visible refactor; skips platform feature matrix update label Nov 4, 2026
@ghfind-review ghfind-review Bot added the review: high ghfind author score; see https://ghfind.com label Nov 4, 2026
@xiaoyumuxi
xiaoyumuxi marked this pull request as ready for review November 4, 2026 08:30
@xiaoyumuxi
xiaoyumuxi merged commit 1daaeb5 into preview Nov 4, 2026
20 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

matrix-exempt Reviewed non-user-visible refactor; skips platform feature matrix update review: high ghfind author score; see https://ghfind.com

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant