docs(version): 修订历史说明 merge 与 rename 统计
build / build (push) Successful in 1m30s

0.1.207/0.1.35 按真实第一父 diff 重写范围与功能摘要。
0.1.340 修正为 +2485/-336 并补 rename 测试文件变更。
0.1.28 正文保留,仅补目标提交;新增合并说明回归断言。
This commit is contained in:
姚章浩
2026-11-04 16:34:21 +08:00
parent e735ae603d
commit 600cca02e5
2 changed files with 58 additions and 7 deletions
@@ -52,3 +52,31 @@ func TestAllHistoricalDevelopmentNotesBindExactCommit(t *testing.T) {
t.Fatalf("0.1.35 leaked notes for another commit: %q", notes)
}
}
func TestMergeNotesUseFirstParentFactsAndRenameStats(t *testing.T) {
body, err := os.ReadFile("../../CHANGELOG.md")
if err != nil {
t.Fatal(err)
}
changelog := string(body)
for _, tc := range []struct {
version string
sha string
wants []string
minLen int
}{
{"0.1.207", "034c0b3a1c0b9fc5884750cc0d9929c0df4ac314", []string{"第一父", "108 个文件", "+10643/-548", "cmd/worker/library_baseline.go"}, 500},
{"0.1.35", "330fd12b3f30376c3aee757ba2a9f4ba3f8bcf27", []string{"第一父", "121 个文件", "+9065/-376", "qa_mirror.go"}, 400},
{"0.1.340", "5e1482e349e23728f8f2f1aeb770422eba2e5b5f", []string{"统计:47 个文件,+2485/-336", "canary_test.go"}, 500},
} {
notes := governance.ExtractDevelopmentNotesForCommit(changelog, tc.version, tc.sha)
if len(notes) < tc.minLen {
t.Fatalf("%s notes too shallow: %d chars", tc.version, len(notes))
}
for _, want := range tc.wants {
if !strings.Contains(notes, want) {
t.Fatalf("%s notes missing %q: %q", tc.version, want, notes)
}
}
}
}