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.