Publint test subprocesses inherit the execution lane deadline
Publint 测试子进程继承执行通道期限
The publint script tests have a five-second synchronous subprocess deadline below the Windows coverage lane's existing 90-second test and hook budgets. Captured Windows failures report null status in both the valid and invalid JavaScript/CSS cases; the valid case takes 5028 ms. Those logs omit the subprocess error and signal, so they do not establish ETIMEDOUT. The deadline mismatch is a shared test defect, not evide
English
Problem
The publint script tests have a five-second synchronous subprocess deadline below the Windows coverage lane's existing 90-second test and hook budgets. Captured Windows failures report null status in both the valid and invalid JavaScript/CSS cases; the valid case takes 5028 ms. Those logs omit the subprocess error and signal, so they do not establish ETIMEDOUT. The deadline mismatch is a shared test defect, not evidence that a product change caused the failures.
Decision
The publint spec uses the existing Execa dependency with Vitest's test-context signal. There is no independent subprocess timeout. The workflow and coverage argument owner remain responsible for budgets. This applies the same lane-ownership rule as the subagent teardown tests without changing their cleanup.
Each direct Node child is registered immediately, cancellation requests SIGKILL, and teardown awaits every owned child's result and close event before removing private package roots. Process errors, cancellation, timeout flags, signals, and captured streams are diagnosed before expected exit codes. An ordinary exit code of one remains valid for negative publint cases. All five cases invoke the real script with isolated publication fixtures.
Alternatives considered
- Increase the five-second constant: another local constant would still override the execution lane's budget.
- Preload or replace publint: neither exercises cold script imports and the real publication checks.
- Return after kill: process and pipe closure must precede fixture removal.
Consequences
A readiness-gated deadline regression cancels two live children and checks both closure events, dead PIDs, and informative diagnostics. A missing working directory verifies spawn-error diagnostics. Independent concurrent spec processes exercise temporary-directory isolation and subprocess scheduling. Native Windows CI remains the owner of Windows termination and filesystem evidence; macOS results do not establish those guarantees. Product code, workflow budgets, and snapshot output remain unchanged.
中文
问题
publint 脚本测试自设五秒同步子进程期限,低于 Windows 覆盖率通道现有的 90 秒测试与钩子预算。已捕获的 Windows 失败在有效和无效 JavaScript/CSS 用例中都报告空退出状态;有效用例耗时 5028 毫秒。这些日志没有记录子进程错误和信号,因此不能证明 ETIMEDOUT。期限不匹配是共享测试缺陷,不是产品改动导致失败的证据。
决策
publint 测试 使用现有 Execa 依赖和 Vitest 测试上下文信号,不设独立子进程超时。工作流 和覆盖率参数所有者 继续负责预算。这与子代理清理测试 采用相同的通道所有权规则,但不改变其清理逻辑。
每个直接 Node 子进程创建后立即登记,取消请求发送 SIGKILL;清理先等待所有已登记子进程的结果与 close 事件,再删除私有包根目录。预期退出码断言之前先诊断进程错误、取消、超时标记、信号及捕获的输出流。正常退出码一仍是 publint 负例的有效结果。五个用例均通过隔离的发布夹具调用真实脚本。
曾考虑的替代方案
- 增大五秒常量:另一个局部常量仍会覆盖执行通道预算。
- 预加载或替换 publint:两者都不能验证冷启动脚本导入与真实发布检查。
- 发送终止信号后立即返回:进程与管道关闭必须先于夹具删除。
后果
以就绪状态为前提的期限回归测试取消两个存活子进程,并检查两个关闭事件、PID 已不存在及有用的诊断信息。缺失工作目录验证启动错误诊断。独立并发测试进程验证临时目录隔离和子进程调度。Windows 终止与文件系统证据仍由原生 Windows CI 负责;macOS 结果不能证明这些保证。产品代码、工作流预算和快照输出均不变。