Skip to content

packages/client/vitest.integration.config.ts 的 test.poolOptions 在 Vitest 4 已被移除 —— 「集成测试串行跑」这条声明现在不生效(vitest 只打一条 DEPRECATED 警告) #5564

Closed

Description

@baozhoutao

在 #5544 的实施里量到(该单只让 tsc 读集成套件,不改运行通道,故不在其范围内修)。基线:origin/main @ 229d29ea4。

事实

packages/client/vitest.integration.config.ts 写着:

    // Run integration tests sequentially to avoid race conditions
    pool: 'forks',
    poolOptions: {
      forks: {
        singleFork: true
      }
    }

而本仓 @objectstack/client 的 devDependency 是 vitest ^4.1.10。在该套件上跑一次收集就能看到 vitest 自己报:

$ npx vitest list --config vitest.integration.config.ts
 DEPRECATED  `test.poolOptions` was removed in Vitest 4. All previous `poolOptions`
 are now top-level options. Please, refer to the migration guide:
 https://vitest.dev/guide/migration#pool-rework

即:singleFork: true 这条没有被读取。注释声明的「串行执行以避免竞态」是 declared,不是 enforced —— Prime Directive #10 的形状,发生在测试配置层。

poolOptions 在全仓只此一处(grep -rn poolOptions --include=*.ts --include=*.mts --include=*.js,排除 node_modules),所以这是孤例,不是一次批量迁移的遗留。

为什么现在没人踩到

该套件由 pnpm --filter @objectstack/client test:integration 单独跑,且需要一台外部仓库提供的活服务器(tests/integration/README.md 写明),CI 的常规 test 任务用 vitest.config.ts 把 tests/integration/** 排除掉。于是没有任何自动通道跑到它,这条失效的串行声明今天不会让任何人变红——属于观察类(finding),不是当下缺陷。但它是将来有人接上服务器时第一批会咬人的东西:并行跑一组共享同一台服务器、同一份测试数据的用例,正是注释想避免的竞态。

处置

按 Vitest 4 迁移指南把 poolOptions 里的选项提到顶层(pool: 'forks' 保留,singleFork 的等价物按迁移指南定 —— 目测是顶层 fileParallelism: false 或 maxWorkers: 1,需照文档核实而不是照猜)。落点只有这一个文件。

顺带:同目录 README.md 列了 17 个集成测试文件的规划表,而目录里实际只有 01-discovery.test.ts 一个 —— 那是另一件事,不在本单。

关联:#5544(纳入 tsconfig + 修 client.discovery 漂移)、#5449。

Activity

  1. added
    domain:cliRetired 2026-10-22, alias of domain:server (cli surface); in-flight cards keep it until they land
    findingRecorded observation — held, not dispatchable until the findings triage round grades it
    on Aug 5, 2026
  2. added
    pm:queueReady for the PM dispatch loop
    and removed
    findingRecorded observation — held, not dispatchable until the findings triage round grades it
    on Aug 5, 2026
  3. os-zhuang commented on Aug 5, 2026

    @os-zhuang
    Contributor

    发现分诊轮判级:晋级 pm:queue(域维持 domain:cli)。

    理由:缺陷具体、单文件落点(packages/client/vitest.integration.config.ts)、复现即 vitest 自打的 DEPRECATED 警告,修法照 Vitest 4 迁移指南把 poolOptions 提到顶层等价物 —— 立单正文已写明「照文档核实而不是照猜」,验收含警告消失 + 串行声明实际生效。今天虽无自动通道跑到该套件,但它是「将来接上服务器时第一批咬人」的失效声明,修复成本远小于持有的复核成本。过时前提检查(origin/main @ b4cdc58):该文件自立单基线(229d29e)后零变更。给认领方:正文「顺带」段的 README 规划表 17 缺 16 不在本单,勿扩scope。

    本评论来自分诊座位 Routine(#5474 试点),不构成认领。


    Generated by Claude Code

  4. self-assigned this
    on Aug 5, 2026
  5. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    ContributorAuthor

    认领(PM 会话 session_016FNvXhtSdnEGEfLEsMmvxh,cli 车道)

    • 分支:claude/issue-5564-vitest4-pool-options
    • 工作树:../objectstack-5564(os-dev 自建)
    • 文件面:仅 packages/client/vitest.integration.config.ts;照 Vitest 4 迁移文档核实等价写法(不照猜),验收 = DEPRECATED 警告消失 + 串行声明实际生效可证。README 规划表缺口不在本单(分诊已划界)。

    Generated by Claude Code

  6. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    ContributorAuthor

    开工(os-dev,会话 session_016FNvXhtSdnEGEfLEsMmvxh 派发,cli 车道)

    • 分支:claude/issue-5564-vitest4-pool-options
    • 工作树:../objectstack-5564
    • 计划:先在最新 main 上复核前提(npx vitest list --config vitest.integration.config.ts 是否仍打 DEPRECATED),再照 Vitest 4 迁移指南(/guide/migration#pool-rework)核实 singleFork 的顶层等价写法,只改 packages/client/vitest.integration.config.ts(含注释)。README 规划表缺口不在本单。

    Generated by Claude Code

  7. baozhoutao commented on Aug 5, 2026

    @baozhoutao
    ContributorAuthor

    ACCEPT → PR #5578(PM 会话 session_016FNvXhtSdnEGEfLEsMmvxh,cli 车道)

    验收依据:照 v4.1.10 迁移文档核实(非照猜),fileParallelism: false 的串行语义以 resolve 后实际值为证(maxWorkers: 1);isolate: false 那一半刻意不迁的理由成立——旧写法整块从未生效故无行为依赖,关隔离反而引入本声明要防的同类干扰,理由已随 #5564 编号写进文件注释。反向验证两条预判全中,且额外证明旧写法从未串行过(poolOptions 是 vitest 不读的惰性数据)。常规通道 222 绿,4 用例收集不变。

    skip-changeset 已打(config-only,#5546/#5565 同类先例)。转 ready 挂 auto-merge,跟到 MERGED。


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

domain:cliRetired 2026-10-22, alias of domain:server (cli surface); in-flight cards keep it until they landpm:dispatchedDispatched to a dev agent by /pm-dispatchpm:queueReady for the PM dispatch loop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions