feat(library): 真实差异比对 + 孤儿作业回收 + 验收矩阵与台账
build / build (push) Successful in 1m18s

为什么:发布管理的差异一直显示"未接入",业务作业也可能因队列丢作业而永久占锁;
本轮把这两件做成真实实现,并把 30 个验收项与 CI/版本身份落成可审计文档。

- internal/librarydiff:稳定文档 ID + 排除易变列的整行摘要做增改撤销;overview 在
  生产权威版本与测试封存都在时给出 computed 差异并标注两侧快照,缺一侧仍是 unknown。
- 发布管理"本次变更"列文档身份与比对版本;无差异时明确写"没有文档差异"。
- ReconcileLibraryJobs:worker 启动清理队列已无对应作业的孤儿,避免永久互斥。
- docs/library-acceptance-matrix.md 与 docs/release-ledger.md 固定证据与版本事实。
This commit is contained in:
姚章浩
2026-10-28 14:39:17 +08:00
parent e3db157ba8
commit e313ae12f2
12 changed files with 490 additions and 1 deletions
+20 -1
View File
@@ -248,6 +248,20 @@ function StageBar({ view }: { view: ScopeView }) {
)
}
// 差异行是 {id,title,digest} 对象;只展示人能核对的身份,不摊开内部摘要。
function diffLabel(item: unknown): string {
if (typeof item === 'string') return item
if (item && typeof item === 'object') {
const record = item as Record<string, unknown>
const title = typeof record.title === 'string' ? record.title : ''
const id = typeof record.id === 'string' ? record.id : ''
if (title && id) return `${title} · ${id.slice(0, 8)}`
if (title) return title
if (id) return id
}
return JSON.stringify(item)
}
function ChangeTable({ diff }: { diff: LibraryOverview['diff'] }) {
const computed = diff.state === 'computed'
const rows = computed
@@ -266,6 +280,11 @@ function ChangeTable({ diff }: { diff: LibraryOverview['diff'] }) {
</div>
<span className={`rel-pill ${computed ? 'green' : 'gray'}`}>{computed ? `${rows.length} 条` : '未接入'}</span>
</header>
{computed && diff.base_snapshot && diff.target_snapshot ? (
<p className="rel-scope-note">
生产 {diff.base_snapshot.slice(0, 12)} → 测试 {diff.target_snapshot.slice(0, 12)}
</p>
) : null}
<table>
<thead>
<tr>
@@ -286,7 +305,7 @@ function ChangeTable({ diff }: { diff: LibraryOverview['diff'] }) {
rows.map((row, index) => (
<tr key={`${row.action}-${index}`}>
<td>{row.action}</td>
<td>{typeof row.item === 'string' ? row.item : JSON.stringify(row.item)}</td>
<td>{diffLabel(row.item)}</td>
</tr>
))
)}