fix(acceptance): 物化验收任务的最终媒体
仅对已认证 Acceptance Run 强制下载并持久化 URL 型结果,确保集群外压测端能验证最终视频;普通生产任务继续遵循现有文件存储策略。压测器仅对 Gateway 自有地址做双入口重写,避免向第三方媒体域名泄露验收凭据。\n\n同时修复本地集群重复使用同一快照文件时的幂等复制失败。验证:Go 全量测试、go vet、gofmt、bash -n、ShellCheck 和 git diff --check 通过。
This commit is contained in:
@@ -112,7 +112,7 @@ func mediaTaskNeedsPreUpstreamMaterializationSlot(modelType string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) uploadGeneratedAssets(ctx context.Context, taskID string, taskKind string, result map[string]any) (map[string]any, error) {
|
||||
func (s *Service) uploadGeneratedAssets(ctx context.Context, taskID string, taskKind string, acceptanceRunID string, result map[string]any) (map[string]any, error) {
|
||||
data, _ := result["data"].([]any)
|
||||
rawNeedsUpload := generatedRawValueHasInlineMedia(result["raw"], "", nil)
|
||||
hasInlineBinary := TaskResultHasInlineBinary(result)
|
||||
@@ -124,6 +124,11 @@ func (s *Service) uploadGeneratedAssets(ctx context.Context, taskID string, task
|
||||
if err != nil {
|
||||
return nil, &clients.ClientError{Code: "upload_config_failed", Message: err.Error(), Retryable: true}
|
||||
}
|
||||
// Acceptance runs must prove that a final URL returned by the protocol
|
||||
// emulator can be persisted and consumed outside the cluster. Keep this
|
||||
// override scoped to the authenticated run so normal production tasks retain
|
||||
// the configured file-storage policy.
|
||||
policy = generatedAssetUploadPolicyForAcceptanceRun(policy, acceptanceRunID)
|
||||
if policy.LocalizeInlineMedia {
|
||||
next, _, err := s.materializeLocalBinaryResult(ctx, taskID, result)
|
||||
if err != nil {
|
||||
@@ -260,6 +265,13 @@ func (s *Service) uploadGeneratedAssets(ctx context.Context, taskID string, task
|
||||
return s.finalizeGeneratedAssets(ctx, taskID, taskKind, next, policy, channels, channelsLoaded, len(nextData))
|
||||
}
|
||||
|
||||
func generatedAssetUploadPolicyForAcceptanceRun(policy generatedAssetUploadPolicy, acceptanceRunID string) generatedAssetUploadPolicy {
|
||||
if strings.TrimSpace(acceptanceRunID) != "" {
|
||||
policy.UploadURLMedia = true
|
||||
}
|
||||
return policy
|
||||
}
|
||||
|
||||
func (s *Service) finalizeGeneratedAssets(
|
||||
ctx context.Context,
|
||||
taskID string,
|
||||
|
||||
Reference in New Issue
Block a user