上游 task_dead_letters 没有解决标记,purge/DELETE 会销毁"失败过"的唯一证据。
治理侧新增解除记录(迁移 073):绑定实时行逐字节指纹、重放引用、源侧观测摘要与
操作人;行被改过、重放后又出现新死信、源侧未结清都不命中,封存照旧阻断。
指纹先压紧空白再摘要,避免 PG to_jsonb::text 与 json.Marshal 的空白差异。
试过:go test ./internal/{librarydeadletter,libraryagent,httpapi,releaseadapter/v071,
platform/postgres},make verify 15 项全绿。
This commit is contained in:
@@ -150,3 +150,34 @@ type LibraryReleaseAuthorization struct {
|
||||
func (a LibraryReleaseAuthorization) ValidAt(now time.Time) bool {
|
||||
return a.RevokedAt == nil && now.Before(a.ExpiresAt)
|
||||
}
|
||||
|
||||
// LibraryDeadLetterRelease 是治理平台对一条上游死信的精确解除记录。上游行保持原样,
|
||||
// 这条记录只说明"这一行已被审计、重放并结清";指纹一变就不再命中。
|
||||
type LibraryDeadLetterRelease struct {
|
||||
ID string `json:"id"`
|
||||
Instance string `json:"instance"`
|
||||
TenantID uint64 `json:"tenant_id"`
|
||||
KnowledgeBaseID string `json:"kb_id"`
|
||||
DeadLetterID int64 `json:"dead_letter_id"`
|
||||
Fingerprint string `json:"fingerprint"`
|
||||
TaskType string `json:"task_type"`
|
||||
Scope string `json:"scope"`
|
||||
ScopeID string `json:"scope_id"`
|
||||
RelatedID string `json:"related_id"`
|
||||
ReplayQueue string `json:"replay_queue"`
|
||||
ReplayTaskID string `json:"replay_task_id"`
|
||||
ReplayedAt time.Time `json:"replayed_at"`
|
||||
ReplayEvidence string `json:"replay_evidence"`
|
||||
ObservationDigest string `json:"observation_digest"`
|
||||
Observation json.RawMessage `json:"observation"`
|
||||
Note string `json:"note"`
|
||||
Actor string `json:"actor"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// LibraryDeadLetterReleaseID 生成解除记录 ID。同一实例同一指纹永远得到同一个 ID,
|
||||
// 重复提交返回已存记录而不是造第二条审计。
|
||||
func LibraryDeadLetterReleaseID(instance, fingerprint string) string {
|
||||
sum := sha256.Sum256([]byte(instance + "|" + fingerprint))
|
||||
return "dldr-" + hex.EncodeToString(sum[:])[:24]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user