Agent 差异检查与 PR 式评审清单
Agent 辅助工程检查
前置要求
第 79 天;第 14-15 天 Git 协作基础;Ticket 24 评审清单(curriculum/engineering/ci_delivery_rollback)。
学习目标
像 pull request 评审者一样逐行检查 Agent 产出的 diff,在任何变更获准进入 CI 之前应用六点检查清单。
操作指引
1. 先不暂存:运行 git diff 与 git status,通读 Agent 产出的每个 hunk。
2. 对每个 hunk 应用 Ticket 24 清单:正确性与规格对齐;测试充分性;无断言篡改;API 与文件格式向后兼容;零机密或危险 shell 调用;干净非破坏的历史。
3. 将每个 hunk 分类为 accept / question / reject 并附一行理由。
4. 可以让 Agent 汇总 hunk、定位可疑行,但判定权在你——Agent 辅助止于决策之前。
5. 出现以下情形立即 reject:测试断言被弱化、越界文件、硬编码凭据、无法解释的重新格式化。
自主演练与记录
产出 review_notes.md:每个 diff hunk 一行(文件、hunk 区间、判定、理由),外加三条最重要的清单发现,每条都引用具体行。
解释不了的 hunk 默认 reject;让 Agent 给出正当理由,再由你亲自核实该理由。
| file | hunk | verdict | reason |
|---|---|---|---|
| agent.py | +write_report word_counts | accept | 符合验收标准 1,不破坏 API |
| test_agent_learning.py | -assertEqual(stats) | reject | 弱化断言以掩盖失败 |
| fixtures.py | +read_note 路径校验 | accept | 在声明范围内 |
发现:(1) 测试断言篡改;(2) 新增未用 import;(3) write_report 文档串漂移。
完成一次结构化代码评审,其中每个 diff hunk 都带有明确且有据的判定。
权威源资源与权利证明
Pro Git, Second Edition
对应章节 / 时间戳: Chapter 3 (Git Branching), Section 7.7 (Reset Demystified), Sections 5.2/6.2 (Contributing to a Project)
验证版本与日期: Second edition (Apress, 2014) (Verified: 2026-10-30)
Freely licensed reference for branching, merging, conflict resolution, and safe recovery vocabulary used through the delivery workflow.
Basic git status/log/diff vocabulary from earlier study days
git help <command> and the Git manual pages ship with Git and cover the same commands offline; every required workflow is stated locally in the lesson.
对比候选资源与选型分析 (2)
Interactive but requires a GitHub account and an external service; disposable local repositories keep the exercise self-contained.
Vendor-owned prose with no permissive license; Pro Git covers the same ground under CC BY-NC-SA.
Continuous Integration
对应章节 / 时间戳: Practices of Continuous Integration: Everyone can see what's happening
验证版本与日期: Second edition web article (May 2006) (Verified: 2026-10-30)
Standard practitioner reference defining the CI contract this block rehearses: every change merges to a mainline verified by an automated build and test run, and failures are fixed before further work proceeds.
Version control basics, automated test suites, and build vocabulary.
The CI gate contract (lint, test, package, verdict) is executed locally by scripts/ci_practice_runner.py with no external dependency.
对比候选资源与选型分析 (2)
Provider-specific workflow syntax; Fowler's article states the vendor-neutral CI discipline the learner must internalize first, while the docs are kept as the pipeline-mechanics source.
Vendor-oriented tutorial; Fowler's original definition keeps the explanation tool-agnostic and historically important.