Report known zero usage when smoke tests do not dispatch

This commit is contained in:
2026-10-13 20:32:24 +00:00
parent 116bd0e39b
commit 5ea6f06a6d
3 changed files with 31 additions and 16 deletions

View File

@@ -57,6 +57,12 @@ func (t *SmokeTester) Run(ctx context.Context, request domain.SmokeTestRequest)
}
finish := func(err error) (*domain.SmokeTestReport, error) {
report.Timing.Duration = nonnegativeDuration(now().UTC().Sub(startedAt))
for _, attempt := range report.Attempts {
if attempt.Dispatched {
return report, err
}
}
report.Usage = noDispatchUsage()
return report, err
}
@@ -163,7 +169,6 @@ func (t *SmokeTester) runInference(
if errors.Is(err, ErrAPIKeyRequired) || errors.Is(err, ErrAPIKeyEnvMissing) {
report.Reason = domain.SmokeTestReasonRequiredCredentialMissing
report.Failure = domain.ExecutionFailureInvalidRequest
report.Usage = noDispatchUsage()
report.Completed = true
return finish(nil)
}
@@ -187,13 +192,11 @@ func (t *SmokeTester) runInference(
if err != nil {
if contextErr := ctx.Err(); contextErr != nil {
report.Failure = generation.ClassifyFailure(contextErr)
report.Usage = noDispatchUsage()
return finish(contextErr)
}
var capacityErr *CapacityError
if errors.As(err, &capacityErr) {
report.Failure = domain.ExecutionFailureCapacity
report.Usage = noDispatchUsage()
report.Completed = true
return finish(nil)
}