Skip to content

Commit 642c684

Browse files
fix(trace): avoid the forbidden test error pattern
The lint rule interprets the trace parameter's Error field as a forbidden test assertion. Name the parameter explicitly so production trace handling does not match that pattern. Assisted-by: Codex:gpt-5.6 [Codex]
1 parent 02dff80 commit 642c684

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

core/trace/backend_trace.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func advanceBackendTraceID(id string) {
200200
}
201201
}
202202

203-
func RecordBackendTrace(t BackendTrace) {
203+
func RecordBackendTrace(trace BackendTrace) {
204204
backendMu.Lock()
205205
maxBody := backendMaxBodyBytes
206206
store := backendTraceStore
@@ -210,22 +210,22 @@ func RecordBackendTrace(t BackendTrace) {
210210
// (Inf/NaN) that encoding/json cannot marshal. A single such value — e.g. a
211211
// -Inf dBFS audio metric from a silent clip — would otherwise fail the whole
212212
// /api/backend-traces response and blank the Traces UI.
213-
if t.Data != nil {
214-
t.Data = sanitizeData(t.Data, maxBody)
213+
if trace.Data != nil {
214+
trace.Data = sanitizeData(trace.Data, maxBody)
215215
}
216-
if t.ID == "" {
217-
t.ID = strconv.FormatUint(backendTraceIDSeq.Add(1), 10)
216+
if trace.ID == "" {
217+
trace.ID = strconv.FormatUint(backendTraceIDSeq.Add(1), 10)
218218
}
219-
if t.Error != "" {
220-
t.Status = BackendTraceFailed
219+
if trace.Error != "" {
220+
trace.Status = BackendTraceFailed
221221
} else {
222-
t.Status = BackendTraceCompleted
222+
trace.Status = BackendTraceCompleted
223223
}
224224
backendMu.Lock()
225-
delete(backendInFlight, t.ID)
225+
delete(backendInFlight, trace.ID)
226226
backendMu.Unlock()
227227
select {
228-
case backendLogChan <- backendTraceCommand{trace: &t, store: store}:
228+
case backendLogChan <- backendTraceCommand{trace: &trace, store: store}:
229229
default:
230230
xlog.Warn("Backend trace channel full, dropping trace")
231231
}

0 commit comments

Comments
 (0)