81 / 90

第 81 天:受控交付、合併復原與已驗證回滾

讓通過評審的變更走完整 CI 流水線,在一次性倉庫中解決合併衝突,偵測失敗部署,並以可觀測證據完成回滾。

Self-Directed Learning & Python 480 分鐘有效研習(8 小時)
01 120 分鐘

受控交付流水線與發布證據

Agent 輔助工程檢查

前置要求

第 80 天通過的評審包;Ticket 24 的 CI 練習執行器。

學習目標

為通過評審的變更執行乾淨安裝與受控部署流水線階段,擷取機器可驗證的發布證據,而非命令截圖。

操作指引

1. 打包並驗證:python3 scripts/ci_practice_runner.py --stage clean_install --json ——執行器把 projects/text_tools 複製進純淨沙箱、產生輸入資料並端到端執行 CLI。
2. 檢查證據負載:clean_install 階段 success=true、returncode==0、輸出合法 JSON 統計(total_chars、total_tokens、vocab_size)。
3. 理解交付模型:符號連結切換背後是按版本存放的 release 目錄(藍綠式),回滾只是指標變更而非重新建置。
4. 標註授權邊界:該流水線只在本機證明產物;推送到共享遠端、真實部署與任何付費基礎設施仍需明確單獨授權。

自主實作與記錄

把階段輸出存入 release_evidence.json 並加註:產物路徑、退出碼、所用健康檢查命令,以及符號連結式版本發布為何讓回滾變得廉價。

獨立掌握標準

為已批准的變更產出可重複、機器可驗證的發布記錄。

權威來源資源與權利證明

linking CC BY 4.0

GitHub Actions Documentation

作者 / 機構: GitHub, Inc. | 原始出處連結 ↗

對應章節 / 時間戳: N/A

驗證版本與日期: GitHub Docs continuous publication (Verified: 2026-10-30)

入選理由:

Primary reference for pipeline stages, required status checks, and branch protection mechanics that the local CI practice runner mirrors in a disposable environment.

來源前置條件:

YAML familiarity, shell commands, and Git hosting vocabulary.

安全回退方案(離線彈性):

Pipeline stage semantics (lint, test, package, deploy gate) are exercised offline by scripts/ci_practice_runner.py; no GitHub account or push authorization is required for the practice.

對比候選資源與選型分析 (2)
GitLab CI/CD Documentation ↗ compared_alternative [CC BY-SA 4.0]

Equivalent pipeline concepts under a different provider; GitHub Actions matches the hosted-workflow conventions used in this project's delivery story.

Jenkins User Documentation ↗ compared_alternative [CC BY-SA 4.0]

Self-hosted CI server documentation; GitHub Actions better matches the hosted pipeline model the learner will meet first.

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 8: Release Engineering

作者 / 機構: Dinah McNutt (ed. Betsy Beyer, Tim Harvey), in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | 原始出處連結 ↗

對應章節 / 時間戳: Continuous Build and Deployment (Building, Branching, Testing, Packaging, Deployment)

驗證版本與日期: O'Reilly 2016 free web edition (Verified: 2026-10-30)

入選理由:

Widely used industry reference for hermetic builds, release approval gates, and rollback-ready deployment doctrine that anchor Day 81's controlled delivery and verified rollback exercises.

來源前置條件:

Build and deployment vocabulary; version control basics.

安全回退方案(離線彈性):

The controlled delivery and rollback runbook is fully executable offline via the scripts/ci_practice_runner.py deploy stage, which emits recorded evidence payloads.

對比候選資源與選型分析 (2)
Martin Fowler: BlueGreenDeployment ↗ compared_alternative [Copyright Martin Fowler; free public web article]

Focused single-pattern bliki on blue/green cutover; the SRE chapter covers the wider release-engineering lifecycle including build hermeticity and rollback policy.

Continuous Delivery (Humble & Farley) ↗ compared_alternative [All Rights Reserved (paid)]

Foundational paid text on deployment pipelines; the SRE web edition provides equivalent operational doctrine at zero cost with a stable public URL.

02 120 分鐘

一次性倉庫中的合併衝突解決與安全復原

獨立掌握檢查(無 AI 輔助)

前置要求

第 81 天 活動 1。

學習目標

在一次性倉庫中獨立解決真實的合併衝突,保全無關的協作者改動,並練習合併出錯時的非破壞性復原。

操作指引

1. 執行衝突階段:python3 scripts/ci_practice_runner.py --stage conflict --json。它建構一個一次性裸 upstream 倉庫(明確標註模擬——不連網、不推送)與真正分叉的分支。
2. 出現衝突標記時通讀兩側:HEAD 對 incoming。功能改動與無關的協作者修改都要保留——不要盲目刪除任何一方。
3. 按語意而非文字驗證:完成合併前,在解決後的程式碼樹中執行專案測試。
4. 練習逃生通道:git merge --abort 回到合併前狀態;git stash 或備份分支保護未提交工作。絕不對無法重現的工作執行 reset --hard 或 clean -fdx。
5. 確認執行器報告 conflict_resolved=true 與 unrelated_changes_preserved=true。

自主實作與記錄

撰寫 recovery_log.md:衝突檔案、兩個對抗 hunk、你的解決依據、合併後測試輸出,以及你驗證過的 abort 路徑。

獨立掌握標準

獨立解決真實合併衝突,以通過的測試執行驗證,並演練過非破壞性復原路徑。

權威來源資源與權利證明

linking CC BY-NC-SA 3.0 noncommercial share-alike

Pro Git, Second Edition

作者 / 機構: Scott Chacon and Ben Straub | 原始出處連結 ↗

對應章節 / 時間戳: 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)
GitHub Skills interactive courses ↗ compared_alternative [MIT (varies by course)]

Interactive but requires a GitHub account and an external service; disposable local repositories keep the exercise self-contained.

Atlassian Git Tutorials ↗ compared_alternative [All Rights Reserved]

Vendor-owned prose with no permissive license; Pro Git covers the same ground under CC BY-NC-SA.

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 8: Release Engineering

作者 / 機構: Dinah McNutt (ed. Betsy Beyer, Tim Harvey), in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | 原始出處連結 ↗

對應章節 / 時間戳: Continuous Build and Deployment: Branching

驗證版本與日期: O'Reilly 2016 free web edition (Verified: 2026-10-30)

入選理由:

Widely used industry reference for hermetic builds, release approval gates, and rollback-ready deployment doctrine that anchor Day 81's controlled delivery and verified rollback exercises.

來源前置條件:

Build and deployment vocabulary; version control basics.

安全回退方案(離線彈性):

The controlled delivery and rollback runbook is fully executable offline via the scripts/ci_practice_runner.py deploy stage, which emits recorded evidence payloads.

對比候選資源與選型分析 (2)
Martin Fowler: BlueGreenDeployment ↗ compared_alternative [Copyright Martin Fowler; free public web article]

Focused single-pattern bliki on blue/green cutover; the SRE chapter covers the wider release-engineering lifecycle including build hermeticity and rollback policy.

Continuous Delivery (Humble & Farley) ↗ compared_alternative [All Rights Reserved (paid)]

Foundational paid text on deployment pipelines; the SRE web edition provides equivalent operational doctrine at zero cost with a stable public URL.

03 120 分鐘

健康故障偵測與已驗證回滾手冊

Agent 輔助工程檢查

前置要求

第 81 天 活動 2。

學習目標

把通過評審的發布部署到一次性預發環境,透過可觀測健康檢查發現失敗部署,並執行有文件的回滾,可驗證地恢復已知良好版本。

操作指引

1. 執行部署階段:python3 scripts/ci_practice_runner.py --stage deploy --json。它先部署 1.0.0(HEALTHY),再部署帶有模擬 schema 故障的 1.1.0。
2. 透過健康接縫偵測失敗:v1.1.0 CLI 以退出碼 2 報 'FATAL ERROR: Incompatible database schema version 2' ——v2_health=UNHEALTHY。偵測依據是非零退出與非法輸出,而非人的感覺。
3. 執行回滾手冊:把 'current' 符號連結重新指向 releases/1.0.0,重跑健康命令,確認 restored_version=1.0.0 且 restored_health=HEALTHY。
4. 讀 release_evidence.json:history 陣列必須呈現 deploy 1.0.0 HEALTHY → deploy 1.1.0 UNHEALTHY → rollback_restored 1.0.0 HEALTHY。

自主實作與記錄

撰寫 rollback_log.md:逐字記錄失敗的健康檢查輸出、各回滾步驟、回滾後健康輸出,以及 release_evidence.json 的完整 history 陣列。

獨立掌握標準

執行一次以可觀測的恢復後健康證據為證的成功回滾——是已驗證恢復,而非想當然。

權威來源資源與權利證明

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 8: Release Engineering

作者 / 機構: Dinah McNutt (ed. Betsy Beyer, Tim Harvey), in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | 原始出處連結 ↗

對應章節 / 時間戳: Continuous Build and Deployment: Deployment

驗證版本與日期: O'Reilly 2016 free web edition (Verified: 2026-10-30)

入選理由:

Widely used industry reference for hermetic builds, release approval gates, and rollback-ready deployment doctrine that anchor Day 81's controlled delivery and verified rollback exercises.

來源前置條件:

Build and deployment vocabulary; version control basics.

安全回退方案(離線彈性):

The controlled delivery and rollback runbook is fully executable offline via the scripts/ci_practice_runner.py deploy stage, which emits recorded evidence payloads.

對比候選資源與選型分析 (2)
Martin Fowler: BlueGreenDeployment ↗ compared_alternative [Copyright Martin Fowler; free public web article]

Focused single-pattern bliki on blue/green cutover; the SRE chapter covers the wider release-engineering lifecycle including build hermeticity and rollback policy.

Continuous Delivery (Humble & Farley) ↗ compared_alternative [All Rights Reserved (paid)]

Foundational paid text on deployment pipelines; the SRE web edition provides equivalent operational doctrine at zero cost with a stable public URL.

linking All Rights Reserved (martinfowler.com) Article is linked, not copied; pipeline practice uses the repository's own runner

Continuous Integration

作者 / 機構: Martin Fowler | 原始出處連結 ↗

對應章節 / 時間戳: Practices of Continuous Integration: Make the Build Self-Testing; Fix Broken Builds Immediately

驗證版本與日期: 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)
GitHub Actions Documentation ↗ compared_alternative [CC BY 4.0]

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.

Atlassian Continuous Integration Guide ↗ compared_alternative [All Rights Reserved]

Vendor-oriented tutorial; Fowler's original definition keeps the explanation tool-agnostic and historically important.

04 120 分鐘

評量:交付報告、結果說明與限制聲明

獨立掌握檢查(無 AI 輔助)

前置要求

第 81 天 活動 1-3。

學習目標

撰寫完整工程交付報告,把需求→評審→CI→部署→回滾串成一條可稽核的敘事,並明確限制與授權邊界。

操作指引

1. 彙總材料:requirement.md、verdict.md、review_notes.md、review_packet.md、release_evidence.json、recovery_log.md、rollback_log.md。
2. 撰寫結果說明:每條驗收標準引用證明它的產物與命令;每次遭遇的失敗引用觀測輸出與已驗證的恢復。
3. 誠實區分證據類別:獨立掌握(你的測試、你的判定、你的衝突解決)與 Agent 輔助績效(產出的 diff、hunk 摘要)。
4. 聲明限制:deterministic-v1 配接器是治具而非真實模型能力證據;部署目標均為一次性環境;未觸碰共享遠端。
5. 重申授權邊界:未執行共享遠端推送、生產部署、付費執行與破壞性操作——均需專項授權。

自主實作與記錄

產出 delivery_report.md,章節包括:Requirement & Acceptance、Verification Table、CI & Delivery Evidence、Rollback Evidence、Independent vs Agent-Assisted Evidence、Limitations & Authorization Boundary。

獨立掌握標準

交付一份每條主張都可重跑、誠實區分獨立技能與 Agent 輔助產出的可稽核工程報告。

權威來源資源與權利證明

linking CC BY-NC-ND 4.0 noncommercial no-derivatives

Site Reliability Engineering, Chapter 8: Release Engineering

作者 / 機構: Dinah McNutt (ed. Betsy Beyer, Tim Harvey), in Site Reliability Engineering (eds. Betsy Beyer, Chris Jones, Jennifer Petoff, Niall Richard Murphy; Google) | 原始出處連結 ↗

對應章節 / 時間戳: Philosophy: Hermetic Builds; Enforcement of Policies and Procedures

驗證版本與日期: O'Reilly 2016 free web edition (Verified: 2026-10-30)

入選理由:

Widely used industry reference for hermetic builds, release approval gates, and rollback-ready deployment doctrine that anchor Day 81's controlled delivery and verified rollback exercises.

來源前置條件:

Build and deployment vocabulary; version control basics.

安全回退方案(離線彈性):

The controlled delivery and rollback runbook is fully executable offline via the scripts/ci_practice_runner.py deploy stage, which emits recorded evidence payloads.

對比候選資源與選型分析 (2)
Martin Fowler: BlueGreenDeployment ↗ compared_alternative [Copyright Martin Fowler; free public web article]

Focused single-pattern bliki on blue/green cutover; the SRE chapter covers the wider release-engineering lifecycle including build hermeticity and rollback policy.

Continuous Delivery (Humble & Farley) ↗ compared_alternative [All Rights Reserved (paid)]

Foundational paid text on deployment pipelines; the SRE web edition provides equivalent operational doctrine at zero cost with a stable public URL.

linking CC BY 4.0

GitHub Actions Documentation

作者 / 機構: GitHub, Inc. | 原始出處連結 ↗

對應章節 / 時間戳: N/A

驗證版本與日期: GitHub Docs continuous publication (Verified: 2026-10-30)

入選理由:

Primary reference for pipeline stages, required status checks, and branch protection mechanics that the local CI practice runner mirrors in a disposable environment.

來源前置條件:

YAML familiarity, shell commands, and Git hosting vocabulary.

安全回退方案(離線彈性):

Pipeline stage semantics (lint, test, package, deploy gate) are exercised offline by scripts/ci_practice_runner.py; no GitHub account or push authorization is required for the practice.

對比候選資源與選型分析 (2)
GitLab CI/CD Documentation ↗ compared_alternative [CC BY-SA 4.0]

Equivalent pipeline concepts under a different provider; GitHub Actions matches the hosted-workflow conventions used in this project's delivery story.

Jenkins User Documentation ↗ compared_alternative [CC BY-SA 4.0]

Self-hosted CI server documentation; GitHub Actions better matches the hosted pipeline model the learner will meet first.