docs(i18n): RFC tree batch — 146 bilingual pairs via the committed pipeline
implemented(除 4 篇超长文档随后补)、proposed、rejected 全树配对; 同一流水线 + 二遍校验(paraphrase-back + 仓库上下文一致性)产出。 docs/rfc/implemented/AGENTS.md 与其 CLAUDE.md 符号链接列入排除 (agent 指令文件,与根 AGENTS.md 同策略)。
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
2026-06-11-deterministic-and-stress-testing.md: e4ed7043d1880b55dd7d77b3e09a81dd58739a70
|
||||
2026-06-11-deterministic-and-stress-testing.zh.md: d933c1dda329b95573b7a5a3fbe3a61ef94390cb
|
||||
@@ -1,5 +1,7 @@
|
||||
# RFC: Deterministic tests, the replay invariant fixture, and race stress
|
||||
|
||||
English | [中文](2026-06-11-deterministic-and-stress-testing.zh.md)
|
||||
|
||||
Status: proposed
|
||||
|
||||
## Problem
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
# RFC:确定性测试、回放不变式 fixture 与竞态压力测试
|
||||
|
||||
[English](2026-06-11-deterministic-and-stress-testing.md) | 中文
|
||||
|
||||
Status: proposed
|
||||
|
||||
## 问题
|
||||
|
||||
若干 agent loop(智能体循环)测试通过 `setTimeout(30)` 睡眠来同步——这是一笔不稳定性债务,浪费 agent 重试周期,还可能掩盖排序 bug。另一方面,我们的核心架构承诺(任何会话日志回放后都能得到完全相同的派生历史)目前只在两个测试中断言,但在*所有地方*断言的成本很低。此外,inbox 唤醒竞态只被手动验证过一次,没有任何东西持续地重新验证它。
|
||||
|
||||
## 提案
|
||||
|
||||
三项措施:
|
||||
|
||||
1. **测试中禁止挂钟睡眠。** 将 `setTimeout(N)` 等待替换为事件驱动等待(现有的 `waitForIdle` 模式,扩展为 `waitForStatus`、`waitForEvent(n)`),或在需要测试时间本身时使用 vitest fake timers。通过 lint 规则强制:禁止在 `packages/*/tests` 中使用 `setTimeout`,白名单辅助模块除外。
|
||||
2. **通用回放 fixture(测试前置数据)。** 一个共享的测试辅助函数包装 agent loop harness,使得每个测试结束后,agent 的会话日志被回放到一个全新的 Session 中,并自动断言 `deriveMessages()` 相等。这样该不变式在每次 CI 运行中会被检查数百次(覆盖套件产生的所有场景),而非仅两次。
|
||||
3. **夜间竞态压力测试。** 一个 CI job 以 `vitest --repeat=200`(加 `--shuffle`)运行 agent-loop 和 inbox 套件,以暴露调度依赖的失败;发现的任何不稳定测试都作为 bug 修复,绝不靠重试掩盖。
|
||||
|
||||
## 计划
|
||||
|
||||
措施 1 和 2 一起落地(它们改动相同的辅助模块);在套件消除所有睡眠之后再添加夜间 job,使重复运行足够快。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- `packages/*/tests` 中不再有 `setTimeout`(白名单辅助模块除外),由 lint 规则强制。
|
||||
- 共享 harness 对每个测试的会话日志进行回放,将其注入全新的 `Session` 并自动断言 `deriveMessages()` 相等,覆盖整个套件。
|
||||
- 夜间 job 以 `--repeat` 和 `--shuffle` 运行 agent-loop 和 inbox 套件;发现的不稳定测试作为 bug 分诊处理,绝不靠重试掩盖。
|
||||
|
||||
## 风险
|
||||
|
||||
Fake timers 与 agent loop 中的 Promise 调度存在微妙交互——优先使用事件驱动等待;仅在测试 timer 服务行为本身时才使用 fake timers。
|
||||
|
||||
<!-- rfc-format: alternatives-not-recorded (pre-format RFC) -->
|
||||
@@ -0,0 +1,6 @@
|
||||
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
||||
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
||||
# after editing either side, bring the other along and re-record with:
|
||||
# pnpm run verify-translation-pairing --write
|
||||
2026-06-11-mutation-testing.md: 344263d1c91a5e6c83320f367bf76ed6f7ef5a49
|
||||
2026-06-11-mutation-testing.zh.md: aa89b3335a143b6f34858bdc2f3344a6a7d758d9
|
||||
@@ -1,5 +1,7 @@
|
||||
# RFC: Mutation testing as the coverage counterweight
|
||||
|
||||
English | [中文](2026-06-11-mutation-testing.zh.md)
|
||||
|
||||
Status: proposed
|
||||
|
||||
## Problem
|
||||
|
||||
36
docs/rfc/proposed/testing/2026-06-11-mutation-testing.zh.md
Normal file
36
docs/rfc/proposed/testing/2026-06-11-mutation-testing.zh.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# RFC:变异测试作为覆盖率的制衡
|
||||
|
||||
[English](2026-06-11-mutation-testing.md) | 中文
|
||||
|
||||
Status: proposed
|
||||
|
||||
## 问题
|
||||
|
||||
逐文件 100% 覆盖率门禁(见[质量门禁决策](../../implemented/process/2026-06-11-quality-gates.md))证明的是每一行都在测试中*被执行*了,而非任何断言会在该行出错时有所察觉。在 agent 编写测试的场景下,覆盖率压力可能催生「执行但无断言」的测试。变异测试衡量的正是覆盖率无法衡量的:测试套件是否能*杀死*被刻意注入的缺陷。
|
||||
|
||||
## 提案
|
||||
|
||||
在 `packages/*/src` 上运行 Stryker(`@stryker-mutator/vitest-runner`):
|
||||
|
||||
- **PR 粒度的增量运行**(仅变更文件),作为 CI job:调优后足够快,可以作为合并门禁。
|
||||
- **每夜全量运行**,跟踪变异分数;先记录基线,再将阈值设为观测到的基线值并只升不降(与覆盖率策略一致:阈值只收紧)。
|
||||
- 存活的变异体是待办工作项:agent 选取一个存活体、编写杀死它的测试、循环往复——一个形态良好的自主循环。
|
||||
- 等价变异体(可证明不改变行为的)加带理由的排除注解,与 `/* v8 ignore */` 策略对称。
|
||||
|
||||
## 计划
|
||||
|
||||
1. 添加 Stryker 配置,范围限定在一个包(llm:最小、最具算法性),测量运行时间。
|
||||
2. 扩展到所有包;在配置中记录基线分数。
|
||||
3. 接入每夜 job;当运行时间可接受后,添加 PR 粒度的增量 job。
|
||||
|
||||
## 验收标准
|
||||
|
||||
- Stryker 配置在 `packages/*/src` 上以 vitest runner 运行;每夜 job 记录变异分数,且当分数低于记录的基线时,运行失败(阈值只升不降)。
|
||||
- PR 粒度的增量运行在运行时间可接受后作为合并门禁;或者明确保持仅每夜运行,并将该结论记录于此。
|
||||
- 等价变异体带有附理由的排除注解,与 `/* v8 ignore */` 策略对称。
|
||||
|
||||
## 风险
|
||||
|
||||
运行时间:变异测试开销大;逐文件 100% 覆盖率有所帮助(每个变异体至少会被执行到)。如果 PR 粒度的运行始终太慢,则保持仅每夜运行,依赖分数只升不降的机制。
|
||||
|
||||
<!-- rfc-format: alternatives-not-recorded (pre-format RFC) -->
|
||||
Reference in New Issue
Block a user