boardx / boardx/workspacex

chore(e2e): 常驻 e2e 栈 —— 把启动成本从每轮付一次改成付一次

Open
#557 0 comments 0 reactions 0 assignees View on GitHub
out-of-scope
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## A:常驻 e2e 栈 —— 别重复付启动成本

人类 2026-08-05 选定方案 A + B(A = 常驻栈,B = 独立 e2e 门;明确否决 C = 单测绿即交出)。

### 实测的成本构成(SHA `f38c1b1d`)

| 门 | 墙钟 |
|---|---|
| `pnpm --filter web test`(61 files / 651 tests) | **14 秒** |
| `pnpm --filter @repo/api test`(424 files / 4334 tests) | **139 秒** |
| `verify:base:raw`(39 turbo task,28 缓存命中) | **2 分 15 秒** |
| e2e:docker 栈起来 | **一次性**,可复用 |
| e2e:`next build && next start` | 每次都付(config timeout 120s) |

⇒ **迭代成本的大头是栈的启动,不是 spec 本身。** 而 `with-test-isolation.ts:33` 已经有 `WORKSPACEX_KEEP_TEST_STACK=1`:栈可以留着不拆,只是现在没有任何东西**管理**这条路径 —— 每个 agent 各起各的、各拆各的。

### 范围

1. `pnpm harness e2e-stack up|status|down` —— 起一次留着、查当前栈、显式拆。
- `up` 复用 `ensureReservedTestIsolation` 的端口预留(见 #468 / PR #491),把选中的隔离环境**写到一个可被后续命令读到的地方**,不靠人记 env。
- `status` 三态:栈在跑 / 栈不在 / **问不到**(问不到 ≠ 不在,不许显示成可以起)。
- `down` 必须同时清 docker 栈与派生库 —— `sweep-docker` 抓过的孤儿栈就是漏了这步的产物(ADR-007)。
2. 文档:写进 `testing-standards.md`,说明「写代码每轮只跑单测,切片交付前跑一次 e2e」的分层。

### 验收(含反证)

- 连跑两次 e2e,第二次**不重起** docker 栈;反证:把复用关掉 → 第二次会重起,断言必须红。
- `down` 之后 `sweep-docker` 扫不出孤儿栈;反证:只 `docker compose down` 不清库 → 必须红。
- `status` 在权威不可达时报「问不到」而不是「可以起」;反证:指向一个不存在的 docker host → 不得显示成空闲。

### ⚠ 并发前提

常驻栈会放大端口争用。**依赖 #468(PR #491,端口改为向 OS 预留)先合** —— 在那之前多个常驻栈同时存在会撞端口,而旧实现是**哈希取模、重跑必然算出同一组端口**。

**发现者**:coord-architecture
**标签**:out-of-scope(不占八步工时,除非人类明确插队)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with with-test-isolation.ts:33 and the existing ensureReservedTestIsolation path from #468/PR #491; inspect how the pnpm harness e2e-stack commands can persist and read the selected isolation environment. Use the listed e2e rerun, down/sweep-docker, and unreachable-host cases as acceptance tests, then document the workflow in testing-standards.md.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, next.js, typescript
Domain
cli, devops, documentation, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.