Skip to content
95 changes: 95 additions & 0 deletions docs/DEV_PIPELINE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# 开发流水线:从 agent-ready issue 到可合并 PR

Related #3393.

本文写「一条 issue 实际怎么走」,以及每一步的产出、失败怎么处置。目录归属与各侧自检命令在
[UI_SURFACES.md](UI_SURFACES.md);QA 出证格式在 [qa-evidence-template.md](qa-evidence-template.md)。

## 0. 今天由机器强制什么(不是计划,是现状)

| 事项 | 谁强制 | 现状 |
|---|---|---|
| `tests.yml` 的 7 个 suite job + 汇总门 `FlyBot required checks` | GitHub required check | 唯一 required,名字不得改 |
| `risk-tier`(按 diff 出 T0–T3) | workflow | report-only;未设 required。T3 的 PR 在它这里也绿 |
| `silent-revert`(PR 上查静默回退) | workflow | report-only,finding 恒绿(exit 0),只有脚本自身故障才红 |
| `audit-merges`(main 上查未走队列的提交) | workflow | 只在默认分支按 `schedule` 跑,PR 里不出现 check |
| 同一 (对象, 标记) 只留一条评论 | `comment-guard.mjs` | 脚本在,人工/脚本调用;没有 CI 门 |
| 认领标记 | 约定 | 没有机器校验 |
| 合并决定 | FlyBot Lead | 由 Lead 明示并记录 head 与理由;Tier 只作提示,不是否决项 |

结论:**只有 `FlyBot required checks` 会替你挡住合并**。其余全部是证据与提醒,靠人看。
文档里任何「会拦住」的说法,只有这一条成立。

## 1. 状态机

按顺序执行;每步产出落在 GitHub 上(issue 标签/评论、PR、check),不落私人笔记。

1. **Triage.** 只挑带 `agent-ready` 的 open issue。`hold` 不碰;`needs-human` 停下来汇报等人决定。
开工前确认没有人既在认领它(有没有 `agent-working`、有没有 open PR 指向它)。
2. **拆切片.** 一个 issue 拆成一个可评审切片:输入、产出、验收标准、涉及目录、跑哪条自检。
一个 PR 只装一个切片;要两个切片就开两个分支两个 PR。
3. **认领.** 打 `agent-working`;评论写明分支名。分支从 `main` 拉,
命名 `dev/<issue号>-<短描述>`。
4. **开发.** 按 `UI_SURFACES.md` 的目录边界分派。改完先按那张表的「本地跑什么」自检,再推。
5. **QA 出证.** 由 QA 按 exact head 核(不是作者的工作副本),格式见 `qa-evidence-template.md`。
新提交即作废旧证据。
6. **评审.** 看四件事:`Related #N`/`Refs #N` 且无 `Fixes`/`Closes`/`Resolves`;结论绑 head SHA;
一个切片;本地绿与 CI 绿分开报。评审意见落 PR 评论。
7. **风险标注.** `risk-gate.mjs` 的 tier 由脚本输出后以 `risk:T*` 标签落到 PR(不手打)。
Tier 只作提示,不构成合并闸口:T3 也照常往下走,没有人工批准这一步(2026-11-26 起)。
8. **合.** 由 FlyBot Lead 决定并执行合并:`FlyBot required checks` 全绿、上述证据都在 PR 上,
合并时写明 head 与理由。Tier 是提示,不是否决项。
不声称 parity,不声称验收通过。

任一步发现记录与实际不一致(注释说 A、代码做 B),打回重做——这一类是本流水线最常见的打回理由。

## 2. 目录 → 谁做

| 目录 | 成员 | 备注 |
|---|---|---|
| `flybot_workspace/**`(含 `static/**`) | UI Dev(页面)/ Runtime Dev(Python 服务端) | 两侧不独立,见 UI_SURFACES §4 |
| `runtime/flybot-workspace-web/**` | UI Dev | `npm test` |
| `runtime/flybot/**`、`.github/scripts/**`、`.github/workflows/**` | Runtime Dev | 动 workflow 前先核对门名 |
| `services/**`、`deploy/**`、`manager/**` | Services Dev | |
| `tests/**`、出证 | QA Engineer | |
| `docs/DEV_PIPELINE.md`、评审、开 PR | FlyBot Lead | 写操作只由 Lead 或带 token 的脚本执行 |

`runtime/ds-bot-upstream/**` 是 vendor 树,永不手改(`scripts/ds-bot-upstream.mjs check` 会失败);
要修就落到补丁层 `runtime/flybot/patches/**`。

## 3. 模板

### 3.1 切片(Lead 派活时写)

```
Issue: #<n> 标题:<…>
切片:<一句话,一个可评审的改动>
输入:<要读的现状/缺陷,附代码位置>
产出:<新增/修改哪些文件;分支名 dev/<n>-<短描述>>
验收标准:<可核验条目,逐条>
自检:<命令 + 期望输出>
不做:<明确排除的同源问题,留给下一个切片>
```

### 3.2 认领评论

```
认领 #<n>:<一句话范围>
分支 `dev/<n>-<短描述>`,从 main `<main40>` 拉。
自检计划:<命令>。
```

### 3.3 QA 证据

用 `docs/qa-evidence-template.md`,五节全填,`{{…}}` 不许留。第 5 节「本证据不构成验收通过」不得删。

### 3.4 评审意见

```
评审 <head40>(PR #<n>)
Related/Refs:<有 / 无 Fixes|Closes|Resolves>
切片:<单一切片 / 混了 X>
绑定:结论绑 head <head40>;本地绿 <命令与数字>;CI 绿 <截至 UTC,哪些 success,哪些未跑完>
风险:脚本输出 <T*>,与标签 <risk:T*> 一致(Tier 只作提示,不否决)
打回/放行:<缺什么,需要谁补>
```
24 changes: 24 additions & 0 deletions docs/UI_SURFACES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# UI surfaces: which side owns what

Related: #3393. The process is `docs/DEV_PIPELINE.md`; this page answers only "which side owns this
change". Measured on `34a80ca5a1`.

- Page → feature map: [UI_SURFACES_MAP.md](UI_SURFACES_MAP.md)
- Change → what to run, and which CI check judges it: [UI_SURFACES_DISPATCH.md](UI_SURFACES_DISPATCH.md)
- Cross-side couplings, screenshot duty, what is runnable here: [UI_SURFACES_OPS.md](UI_SURFACES_OPS.md)

## 1. Boundary

**Python side (pages):** `flybot_workspace/static/**` (26 page dirs, `shell/*.mjs`),
`flybot_workspace/*_page.py`, `server.py` (handlers, route allowlists, headers).
**Plugin side:** `runtime/flybot-workspace-web/{index.js,src/,lib/,featurekit/}` (host, API wiring),
`features/*/index.js` (routes/API/tools, no markup), `test/**` (62 files).
Repo level: the screenshot harness (`scripts/ci_ui_screenshots.*`, `scripts/ci-native-ui*.mjs`,
`ui-screenshots.yml`). Vendor `runtime/ds-bot-upstream/**` is never edited.

Pages have one source: `flybot_workspace/static/**`. `index.js:30` is
`pagesDir = config.pagesDir ?? join(HERE, 'pages')` and `pages/` is not in this repo
(`PAGES_NOT_BUNDLED.md`); an image built without
`--build-context flybot-workspace-static=flybot_workspace/static` 404s every page. So
`pages: [...]` in `features/*/index.js` is documentation (`src/features.js:11`), not a route table,
and page markup does not belong under `features/`.
13 changes: 13 additions & 0 deletions docs/UI_SURFACES_DISPATCH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# UI surfaces: what to run per change

Related: #3393. Part of [UI_SURFACES.md](UI_SURFACES.md). Measured on `34a80ca5a1`.

- `flybot_workspace/static/**` → `node --test tests/*.test.mjs` → CI `Web and compose planner`;
screenshot if the change is visible.
- `static/shell/system-locale*.mjs` → `node --test tests/system_locale*.test.mjs` → same check.
- `flybot_workspace/**/*.py` → `unittest discover -s tests -v` and `compileall -q` under `python -m`;
CI `Management API · 3.11` / `3.13`; screenshot only if page output changes.
- `runtime/flybot-workspace-web/**` → `npm test` in that directory → CI `runtime-image / Image recipe
contract tests`; no screenshot, fixtures are Python side.
- `ci-native-ui*`, `ci_ui_screenshots.*`, `ui-screenshots.yml` → `node --check` → CI `browser /
screenshots`.
10 changes: 10 additions & 0 deletions docs/UI_SURFACES_MAP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# UI surfaces: page → feature map

Related: #3393. Part of [UI_SURFACES.md](UI_SURFACES.md). Measured on `34a80ca5a1`.

`node docs/ui-surfaces-map.mjs` → `15 features; 26 dirs`, then per static dir the owning feature(s)
or `(python only)`: 9 shared, 13 python-only, 4 aliased (`contacts→social`, `look→settings`,
`onboarding→settings`, `settings→connectors,model-api,settings`). `messenger` declares
`pages: ['messenger']` while `static/messenger` does not exist — stale doc, not a route.

What to run per change: [UI_SURFACES_DISPATCH.md](UI_SURFACES_DISPATCH.md).
41 changes: 41 additions & 0 deletions docs/UI_SURFACES_OPS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# UI surfaces: couplings, screenshots, what runs here

Related: #3393. Continues [UI_SURFACES.md](UI_SURFACES.md); the page map is
[UI_SURFACES_MAP.md](UI_SURFACES_MAP.md), what to run per change is
[UI_SURFACES_DISPATCH.md](UI_SURFACES_DISPATCH.md). Measured on `34a80ca5a1`.

## 4. The sides are not independent

- `tests/system_locale.test.mjs:7`, `tests/system_locale_chat.test.mjs:5` import
`runtime/flybot-workspace-web/src/pages.js` — editing it reds `Web and compose planner`.
- `tests/test_dsh_architecture.py:16-17,55` asserts the plugin's `features/` and `lib/c/` — a plugin
restructure reds `Management API`.
- `flybot_workspace/dsbot_bundle.py` depends on the bytes of `src/features/importer.js`.
- Settings pages come from `SettingsPage.ASSETS` (`settings_page.py`): a new page needs the Python
entry plus its static dir. `/settings/message-folding` is still listed though it folded into the hub.

## 5. Screenshot duty

- Visible UI change: attach screenshots. No UI surface: write "no UI surface / 无 UI 面".
- Both harnesses drive the Python-served pages, never the plugin: `ci_ui_screenshots.mjs` →
`ci_ui_screenshots.py --serve`; `ci-native-ui-screenshots.mjs` → `ci-native-ui.mjs`, which boots
`flybot_workspace.app`. Both need `python3`.

## 6. What actually runs on this machine

No `python3`, no `python` (`command -v`, rc=1), no Playwright. Green here:

- `node --test tests/settings_page.test.mjs tests/guide_page.test.mjs tests/onboarding_step2.test.mjs`
→ `tests 62 / pass 62 / fail 0`; `node --check flybot_workspace/static/guide/app.mjs` → clean.
- Plugin `node --test test/features.test.js` → `tests 6 / pass 6 / fail 0`.

Not runnable here — environment, not product:

- Full `node --test tests/*.test.mjs` aborts after 656 passing subtests (`uv_thread_create`
assertion, no exit line).
- Full plugin `npm test`: CA certificates off thread, then `Personal agent bootstrap target
mismatch` (`test/b4-settings.test.js test/chat.test.js`).
- Every Python command in the dispatch page: no interpreter.

Both full suites are judged on CI: `34a80ca5a1` has 33/33 check-runs success. A local harness crash
is neither evidence of red nor licence to call it green.
51 changes: 51 additions & 0 deletions docs/qa-evidence-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## QA 证据(exact head)

**Head** `{{head40}}` · 分支 `{{branch}}` · PR #{{pr}} · base `main {{main40}}`
**出证时间** {{UTC}} · **状态**:本地 {{通过 / 不通过}} | CI {{全绿 / 部分未跑完 / 有红 / 无 run}}
**本证据只对上面这个 40 位 head 有效。分支再推任何提交,本证据立即作废,需按新 head 重出。**

### 1. 绑定:我测的字节就是这个 head(不是作者的工作副本)
```
$ git ls-remote origin refs/pull/{{pr}}/head
{{head40}} refs/pull/{{pr}}/head
$ curl -sSLo head.tar.gz https://codeload.github.com/{{owner}}/{{repo}}/tar.gz/refs/pull/{{pr}}/head
$ mkdir head && tar xzf head.tar.gz -C head --strip-components=1 && cd head
$ git init -q . && git add -A -f . && git write-tree
{{tree40}}
$ sha256sum .github/workflows/tests.yml
{{tests_sha256}}
```
`{{tree40}}` 等于 `/commits/{{head40}}` 的 `commit.tree.sha` → 整棵树一致,不是抽样;`tests.yml` 与 main `{{main_sha256}}` {{相同 / 不同}}。
改动面:{{n}} 文件 {{+a / −d}};`tests.yml` 在 diff 里 {{0 项 / 有改动}};vendor `runtime/ds-bot-upstream/**` {{0 文件}}。

### 2. 本地结果(数字来自本机,不是 CI)
| 命令 | 结果 |
|---|---|
| `node --test '{{glob}}'` | tests {{N}} / pass {{N}} / fail 0 / skipped 0 |
| `grep -rn '{{pattern}}' {{path}}` | {{grep_result}} |
| `{{dry_run_cmd}}` | exit {{code}},{{dry_run_line}} |

逐文件:{{per_file}}

```
{{stdout_tail}}
```

### 3. CI 结果(截至 {{UTC}},拉的是 `/commits/{{head40}}/check-runs`)
| check | 当时的结论 | run |
|---|---|---|
| {{name1}} | {{conclusion1}} | {{url1}} |
| {{name2}} | {{conclusion2}} | {{url2}} |
| {{name3}} | {{conclusion3}} | {{url3}} |

合计 {{total}} 个 check:{{x}} success / {{y}} 未跑完 / {{z}} 不存在。

### 4. 没做到 / 没覆盖到的
- {{gap1}}
- {{gap2}}
- {{gap3}}

### 5. 本证据不构成验收通过
这是我核到的「这个 head 上发生了什么」,不是「这个 PR 可以合并」:没有做产品验收,没有声明与 0.3.0 parity;合并由 Lead 决定。合并后若 rebase 或补提交,本证据作废。

Related #{{issue}}
18 changes: 18 additions & 0 deletions docs/ui-surfaces-map.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Related #3393. Prints the page → plugin-feature map referenced by docs/UI_SURFACES.md §2.
// Usage, from the repository root: node docs/ui-surfaces-map.mjs
import {readdirSync as rd, readFileSync as rf, statSync as st} from "node:fs";
import {join as j} from "node:path";

const F = j(process.cwd(), "runtime/flybot-workspace-web/features");
const S = j(process.cwd(), "flybot_workspace/static");
const by = new Map();
for (const n of rd(F)) {
let t = "";
try { t = rf(j(F, n, "index.js"), "utf8"); } catch { continue; }
const m = t.match(/pages:\s*\[([^\]]*)\]/);
if (m) by.set(n, [...m[1].matchAll(/\x27([^\x27]+)\x27/g)].map((i) => i[1]));
}
const dirs = rd(S).filter((n) => st(j(S, n)).isDirectory()), served = new Map();
for (const [f, ps] of by) for (const p of ps) served.set(p, [...(served.get(p) ?? []), f]);
console.log(`${by.size} features; ${dirs.length} dirs`);
for (const p of dirs) console.log(` ${p.padEnd(12)} ${(served.get(p) ?? []).join(",") || "(python only)"}`);
Loading