|
1 | 1 | # engine/steps/pr/ —— 规范 |
2 | 2 |
|
3 | | -<!-- verified-against: 2026-08-18 --> |
| 3 | +<!-- verified-against: 2026-08-28 --> |
4 | 4 |
|
5 | | -`LOC ~1100(6 个文件) · step 库(PR) · refactor-status: ok` |
| 5 | +`LOC ~1200(6 个文件) · step 库(PR) · refactor-status: ok` |
6 | 6 |
|
7 | 7 | ## 职责 |
8 | 8 | 受守卫的推送、只读的 PR 抓取/门禁、PR rebase、PR debug、受门禁的评审发布。 |
|
15 | 15 | - `rebase.py` —— `pr.checkout_branch`、`pr.rebase_onto_base`、`pr.analyze_diff`、 |
16 | 16 | `agent.verify_module`。 |
17 | 17 | - `debug.py` —— `pr.fetch_ci_failures`(+ `_enrich_ci_logs`)、`pr.group_failures`、 |
18 | | - `agent.debug_group`。 |
| 18 | + `agent.debug_group`、`pr.harvest_debug_knowledge`。 |
19 | 19 | - `publish.py` —— 对外写入(risk=push):`ci.push`、`pr.post_review`。 |
20 | 20 | - `utils.py` —— 纯函数 `extract_signature`(及其正则)。 |
21 | 21 |
|
22 | | -## Steps(11 个) |
| 22 | +## Steps(12 个) |
23 | 23 | `ci.push`(script/push);`pr.fetch_diff`、`pr.gate_check`、`pr.checkout_branch`、 |
24 | 24 | `pr.analyze_diff`、`pr.fetch_ci_failures`、`pr.group_failures`(deterministic/read); |
| 25 | +`pr.harvest_debug_knowledge`(deterministic/knowledge); |
25 | 26 | `pr.rebase_onto_base`、`agent.debug_group`(agent/write_workspace); |
26 | 27 | `agent.verify_module`(validation/read);`pr.post_review`(script/push)。 |
27 | 28 |
|
|
46 | 47 | - `pr.fetch_ci_failures` 经 profile 选定的 CI provider 富化日志,否则记一条 |
47 | 48 | `capability_gap`(**E2**);`pr.group_failures` 按**归一化后**的签名分组。 |
48 | 49 | - `pr.post_review` 是**双闸**的(**C5**)。 |
| 50 | +- `pr.harvest_debug_knowledge` **只在真实推送后落盘**(push 输出存在且非 dry-run, |
| 51 | + 且至少一组修复同时有 root_cause 与 verification —— 与 debug memory 同一门槛), |
| 52 | + 写入 `settings.knowledge_intake_dir`(空 = 关闭,默认)。它是**刻意 fail-open** |
| 53 | + 的:目录未配、dry-run、无已验证修复、写失败(trace |
| 54 | + `knowledge_intake_write_failed` 后吞掉)都返回 ok —— 关闭学习回路 |
| 55 | + **绝不能**让已落地的修复失败。它消费 executor 维护的 `state["outputs"]`, |
| 56 | + 该表在 resume 时由 checkpoint 恢复(见 `test_knowledge_harvest.py` 的 |
| 57 | + crash-then-resume 用例)。设计记录:`doc/RFC-knowledge-intake.md`。 |
49 | 58 |
|
50 | 59 | ## 边界 —— 不属于这里 |
51 | 60 | 不含推送授权逻辑(那是 `push`);不含 CI 日志抓取机制(那是 `ci/providers`); |
|
56 | 65 | `..agent_runtime`。 |
57 | 66 |
|
58 | 67 | ## 测试 |
59 | | -`test_pr_steps.py`、`test_push_and_steps.py`、`test_ci_and_repo_map.py` |
| 68 | +`test_pr_steps.py`、`test_push_and_steps.py`、`test_knowledge_harvest.py`、 |
| 69 | +`test_ci_and_repo_map.py` |
60 | 70 | (注意:`test_ci_and_repo_map` monkeypatch 的是 `pr.debug._gh`, |
61 | 71 | 即 `pr.fetch_ci_failures` 绑定 `gh` 的那个子模块)。 |
62 | 72 |
|
|
0 commit comments