f33730ed 按第一父真实边界说明开发版本历史修复并标注QA分支为集成。
保留另一0.1.28提交自身说明;新增同号不同SHA选择回归。
This commit is contained in:
@@ -80,3 +80,32 @@ func TestMergeNotesUseFirstParentFactsAndRenameStats(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSameVersionDifferentSHAsKeepOwnNotes(t *testing.T) {
|
||||
body, err := os.ReadFile("../../CHANGELOG.md")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
changelog := string(body)
|
||||
f337 := "f33730ed7437536c3d1e01cc2f20231af076b531"
|
||||
notes := governance.ExtractDevelopmentNotesForCommit(changelog, "0.1.28", f337)
|
||||
for _, want := range []string{"开发版本历史", "第一父", "development_notes.go"} {
|
||||
if !strings.Contains(notes, want) {
|
||||
t.Fatalf("f337 notes missing real version-history scope %q: %q", want, notes)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{"持久本地副本", "每 5 分钟", "安全 Markdown"} {
|
||||
if strings.Contains(notes, forbidden) {
|
||||
t.Fatalf("f337 notes still carry the other 0.1.28 commit's body %q: %q", forbidden, notes)
|
||||
}
|
||||
}
|
||||
// Same version number, two target SHAs: exact-SHA selection must not cross.
|
||||
dual := "## 开发快照 snapshot/v0.1.28 - 2026-10-18\n目标提交:" + f337 + "\n\n### Changed\n\n- 版本历史修复\n\n" +
|
||||
"## 开发快照 snapshot/v0.1.28 - 2026-10-18\n目标提交:3e7fcce0b1b077dd6c44f2a4d535813232b941fb\n\n### Added\n\n- 持久本地问答副本\n"
|
||||
if got := governance.ExtractDevelopmentNotesForCommit(dual, "0.1.28", f337); !strings.Contains(got, "版本历史修复") || strings.Contains(got, "持久本地") {
|
||||
t.Fatalf("same-version f337 selected wrong block: %q", got)
|
||||
}
|
||||
if got := governance.ExtractDevelopmentNotesForCommit(dual, "0.1.28", "3e7fcce0b1b077dd6c44f2a4d535813232b941fb"); !strings.Contains(got, "持久本地") || strings.Contains(got, "版本历史修复") {
|
||||
t.Fatalf("same-version 3e7 selected wrong block: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user