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.