perf(storage): 极简化任务历史并增加保留治理
停止持久化 provider 原始响应、兼容响应快照、attempt/event/outbox 重复 JSON,并由标准任务结果动态生成 Kling/Keling/Volces 兼容响应。 增加事件去重与预算、极简 callback 投递、7/30 天分批清理、安全删除条件、并发迁移索引及可实际恢复的任务域排除备份。历史清理默认关闭,待兼容协议和异步恢复在线验证后单独启用。 验证:Go 全量测试与 go vet、PostgreSQL 18 集成与实际备份恢复、迁移安全测试、bash -n、ShellCheck、Compose 配置和人工发布脚本测试均通过。
This commit is contained in:
@@ -6,6 +6,9 @@ import (
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/easyai/easyai-ai-gateway/apps/api/internal/store"
|
||||
)
|
||||
|
||||
func TestKlingV1O1CompatibilityBody(t *testing.T) {
|
||||
@@ -86,6 +89,27 @@ func TestKlingV2CompatibilityBody(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestKlingSubmissionEnvelopesDoNotReplayCurrentResult(t *testing.T) {
|
||||
task := store.GatewayTask{
|
||||
ID: "gateway-task", Status: "succeeded", RemoteTaskID: "upstream-task",
|
||||
CompatibilityProtocol: "kling-v1-omni",
|
||||
CompatibilitySourceProtocol: "kling-v1-omni",
|
||||
Result: map[string]any{"data": []any{map[string]any{"url": "https://example.invalid/result.mp4"}}},
|
||||
CreatedAt: time.Unix(100, 0),
|
||||
UpdatedAt: time.Unix(101, 0),
|
||||
}
|
||||
v1 := klingV1SubmissionEnvelope(task)
|
||||
v1Data, _ := v1["data"].(map[string]any)
|
||||
if v1Data["task_status"] != "submitted" || v1Data["task_result"] != nil {
|
||||
t.Fatalf("V1 submission envelope=%#v", v1)
|
||||
}
|
||||
v2 := klingV2SubmissionEnvelope(task)
|
||||
v2Data, _ := v2["data"].(map[string]any)
|
||||
if v2Data["status"] != "submitted" || v2Data["outputs"] != nil {
|
||||
t.Fatalf("V2 submission envelope=%#v", v2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestKlingCompatibilityValidation(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user