feat(domain): progress steps and the two timestamps that tell alive from progressing (ADR-035)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 08:50:39 +02:00
co-authored by Claude Sonnet 5.5
parent 7bf5f6b8b7
commit c9ebe526cc
+35 -2
View File
@@ -175,6 +175,32 @@ type Reconciliation struct {
Contested []ContestedSpot `json:"contested,omitempty"`
}
// StepState is where one phase of an upload job stands (ADR-035).
type StepState string
const (
StepPending StepState = "pending"
StepRunning StepState = "running"
StepDone StepState = "done"
StepFailed StepState = "failed"
// StepSkipped is a step that never ran because the job finished without it, for
// example the second engine's step when the first engine's text was used alone.
StepSkipped StepState = "skipped"
)
// ProgressStep is one named phase of an upload job. Total is zero for a phase with no
// count; only a phase whose work is really countable carries one (ADR-035: no
// percentage that does not come from real counts).
type ProgressStep struct {
Key string `json:"key"`
Label string `json:"label"`
State StepState `json:"state"`
StartedAt time.Time `json:"started_at,omitzero"`
FinishedAt time.Time `json:"finished_at,omitzero"`
Done int `json:"done,omitempty"`
Total int `json:"total,omitempty"`
}
// UploadStatus is the state of an uploaded-audio transcription job.
type UploadStatus string
@@ -218,6 +244,13 @@ type UploadedTranscript struct {
// Reconciliation is how a merged transcript came about, or nil for a single
// engine (ADR-034). Set by Get, not by List.
Reconciliation *Reconciliation
CreatedAt time.Time
FinishedAt time.Time // zero until the job reaches done or failed
// Progress is the job's phases, in order. Set by Get, not by List (ADR-035).
Progress []ProgressStep
// ProgressAt is when a phase last really changed or advanced; AliveAt is the
// heartbeat. They differ on purpose: alive says the service is still reporting,
// progress says work is moving (ADR-035). Both are zero until the job starts.
ProgressAt time.Time
AliveAt time.Time
CreatedAt time.Time
FinishedAt time.Time // zero until the job reaches done or failed
}