makecindy / makecindy/cindy

CI flake: packages/maker-core contacts/manager.test.ts 在 Windows 分片间歇超时,已多次把无关 PR 判红

Open
#1,606 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 现象

`packages/maker-core/src/contacts/__tests__/manager.test.ts` 在 `client-ci` 的 **Windows unit tests (2/2)** 分片上间歇性**超时**失败(不是断言错),本地无法复现。它直接把整个 `client-ci` 判红(汇总闸 `Windows unit tests` 随分片红),卡住与 contacts 完全无关的 PR。

失败用例(不同轮次命中的子集不同,都在同一个文件):

- `lazy open: 建目录 + 落库文件, 同实例复用`
- `dispose 幂等, dispose 后可重新 getStore`
- `v1 库升级到 v2: 老数据保留 + relations 可用 + FTS 重建`
- `resetAll 透传`
- (另一轮还命中过第 5 个用例)

## 证据与阻塞代价

全部来自 PR #1581(一个 Auto 档权限降级的修复,**diff 不含 `packages/maker-core/src/contacts/` 任何文件**):

| head | run | Windows (2/2) | 失败用例数 |
|---|---|---|---|
| `14aa60ba` | [30839239960](https://github.com/makecindy/cindy/actions/runs/30839239960) | 先 **failure**,重跑后 success | 5(844 项通过) |
| `3065ff83` | [30848921292](https://github.com/makecindy/cindy/actions/runs/30848921292) | success | 0 |
| `b7e99efc` | [30849984186](https://github.com/makecindy/cindy/actions/runs/30849984186) | **failure** | 4(`Test Files 1 failed | 38 passed | 1 skipped`,`packages/maker-core unit` 94.3s) |

- **每次重跑的代价**:`client-ci` 一轮约 10–13 分钟(`verify` 12m34s、Windows 分片 9–12m)。
- **已经吃掉的**:#1581 在这一个 flake 上被判红 2 次,加上重跑总计 ~40 分钟墙钟;同一个 PR 之前还分别被 #1538(`mirrorCacheStore.test.ts`)和 #1599(`device-link client.test.ts`)各判红过一次——**Windows 分片上已经有三个互不相关的 flake 源**。
- 风险:`main` 自身也跑同一套分片,赶发版窗口时这条会直接卡住发版判断。

## 排查方向

- 全部是**超时**而非断言失败,且集中在「建目录 / 落库 / migration / FTS 重建」这类**真实文件系统 + SQLite** 操作上:Windows runner 的磁盘与杀软扫描延迟是首要嫌疑,其次是 `dispose` 后重开同一路径时的句柄释放窗口(Windows 上文件句柄不像 POSIX 那样立刻可复用)。
- 与 #1538 的共性:都在 Windows 分片、都是间歇、本地全绿;但 #1538 是缓存代际/LRU 的**断言**失败,这个是**超时**——加固手段大概率不同(超时阈值 / 用假时钟 vs. 真正的竞态),不要合并成一个 issue 处理。
- 建议先看该文件的 per-test 超时是否用了默认值、以及 migration 用例是否在同一临时目录里串行复用。

## 验收标准

- 该文件在 Windows 分片上连续 20 次 `client-ci` 不再出现超时失败(或改造成不依赖真实 FS/SQLite 计时的形态)。
- 不通过单纯抬高全局超时来"修"——若确认是 runner IO 慢,需要在该文件局部声明并写明理由。
- 修好前,遇到它判红的 PR 按 AGENTS.md「与 diff 无关的失败 = 基线问题」处理:重跑 + 在本 issue 补数据点,不并进业务 PR 修。

Contributor guide

Open the contributing guide

Research direction

Start with packages/maker-core/src/contacts/__tests__/manager.test.ts and inspect its per-test timeout settings and whether migration cases reuse one temporary directory. Run the Windows unit-tests (2/2) shard repeatedly through client-ci, focusing on the listed filesystem, SQLite, dispose, and FTS cases. Done means 20 consecutive runs without timeout failures, without raising the global timeout; any local timeout must explain its reason.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, sqlite, typescript
Domain
ci-cd, databases, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.