feat(usecase): surface TranscriptSource on ProcessResult
The engine already distinguishes SourceNone from SourceRateLimited internally but collapsed both into Skipped. Expose the source string so the runner can persist the right transcript_status and apply rate-limit backoff, without the engine taking on any store/retry concern (dependencies still point inward). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,11 @@ type ProcessResult struct {
|
|||||||
Video domain.Video
|
Video domain.Video
|
||||||
Skipped bool
|
Skipped bool
|
||||||
Reason string // set when Skipped (e.g. "no transcript")
|
Reason string // set when Skipped (e.g. "no transcript")
|
||||||
|
// TranscriptSource is how the transcript resolved (or that there was none):
|
||||||
|
// the domain.TranscriptSource value as a string. The runner reads it to tell a
|
||||||
|
// permanent absence (SourceNone) from a transient 429 (SourceRateLimited) and
|
||||||
|
// persist the right transcript_status. Empty when a fetch error short-circuits.
|
||||||
|
TranscriptSource string
|
||||||
Summary *domain.Summary // nil when Skipped
|
Summary *domain.Summary // nil when Skipped
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +64,9 @@ func (e *Engine) ProcessNewVideo(ctx context.Context, v domain.Video) (ProcessRe
|
|||||||
if !t.HasText() {
|
if !t.HasText() {
|
||||||
// No usable transcript: record the skip, produce no summary, deliver nothing
|
// No usable transcript: record the skip, produce no summary, deliver nothing
|
||||||
// (captions-first, ADR-007; the watcher uses this to avoid reprocessing).
|
// (captions-first, ADR-007; the watcher uses this to avoid reprocessing).
|
||||||
return ProcessResult{Video: v, Skipped: true, Reason: "no transcript"}, nil
|
// Surface the source so the runner separates SourceNone (permanent) from
|
||||||
|
// SourceRateLimited (retry after a backoff window).
|
||||||
|
return ProcessResult{Video: v, Skipped: true, Reason: "no transcript", TranscriptSource: string(t.Source)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
sum, err := e.AI.Summarize(ctx, v, t)
|
sum, err := e.AI.Summarize(ctx, v, t)
|
||||||
@@ -76,7 +83,7 @@ func (e *Engine) ProcessNewVideo(ctx context.Context, v domain.Video) (ProcessRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ProcessResult{Video: v, Summary: &sum}, errors.Join(errs...)
|
return ProcessResult{Video: v, Summary: &sum, TranscriptSource: string(t.Source)}, errors.Join(errs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessNewVideos walks a user's subscriptions and processes each newly seen
|
// ProcessNewVideos walks a user's subscriptions and processes each newly seen
|
||||||
|
|||||||
Reference in New Issue
Block a user