fix(version): 补全开发快照记录与同步交付闭环
build / build (push) Successful in 1m3s

收录 main、注释开发快照和完整运行 SHA;开发说明绑定原提交,补记 0.1.1–0.1.25。
进行中同步按仓库合并,完成后重新执行;启动入队,部署脚本读回版本证据。
开发快照独立于正式标签与 Release,既有冲突标签不移动。

已运行:整仓 make verify,Go 673 通过、前端 274 通过,92 个已声明可选跳过,必需跳过 0。
隔离 PostgreSQL 重复同步队列用例及 -race 通过;未更新现有 8088、未修改生产问答。
This commit is contained in:
姚章浩
2026-10-18 18:11:49 +08:00
parent 90901a4458
commit 013ce4a24e
19 changed files with 860 additions and 32 deletions
+29 -7
View File
@@ -8,6 +8,7 @@ package versionhistory
import (
"sort"
"strings"
"time"
"knowledge-governance/internal/governance"
@@ -25,6 +26,7 @@ type RawCommit struct {
// RawTag 是一个 tag 及其可核验属性;Annotated=false 表示轻量 tag(不算正式版本的证据)。
type RawTag struct {
Message string
Name string
TagSHA string
TargetSHA string
@@ -36,13 +38,14 @@ type ChangelogSource func(sha string) (string, error)
// DeriveInput 是一次换算的全部输入。
type DeriveInput struct {
RepoKey string
CommitURLBase string // 形如 "<origin>/<owner>/<repo>/commit/",由配置拼好,不接受外部传入
TagURLBase string // 形如 "<origin>/<owner>/<repo>/src/tag/";空则不下发 tag 链接
Commits []RawCommit
Tags []RawTag
Changelog ChangelogSource
SnapshotID int64
DeliveryArchive string
RepoKey string
CommitURLBase string // 形如 "<origin>/<owner>/<repo>/commit/",由配置拼好,不接受外部传入
TagURLBase string // 形如 "<origin>/<owner>/<repo>/src/tag/";空则不下发 tag 链接
Commits []RawCommit
Tags []RawTag
Changelog ChangelogSource
SnapshotID int64
}
// DeriveResult 是换算结果。
@@ -192,6 +195,25 @@ func DeriveVersions(in DeriveInput) DeriveResult {
}
if kind == governance.RecordKindRelease {
record.ReleaseNotes = governance.ExtractReleaseNotes(changelog, label)
} else if kind == governance.RecordKindDevelopment {
record.ReleaseNotes = governance.ExtractDevelopmentNotes(changelog, label)
if record.ReleaseNotes == "" {
archived := governance.ExtractDevelopmentNotes(in.DeliveryArchive, label)
if strings.Contains(archived, "目标提交:"+commit.SHA) {
record.ReleaseNotes = archived
}
}
if record.ReleaseNotes == "" {
for _, tag := range tagsByTarget[commit.SHA] {
if tag.Annotated && tag.Name == "snapshot/v"+label {
_, body, found := strings.Cut(tag.Message, "\n\n")
if found {
record.ReleaseNotes = strings.TrimSpace(body)
}
break
}
}
}
}
records = append(records, record)
}