CRITICAL: clavis-telemetry silent database errors in updateSpan() #2

Closed
opened 2026-04-09 04:46:02 +00:00 by johan · 0 comments
Owner

Violation

Per CLAVITOR-AGENT-HANDBOOK.md Part 1:

Mandatory error handling with unique codes:

  • Every if needs an else. The if exists because the condition IS possible
  • Use unique error codes: ToLog("ERR-12345: ...")

Location

File: clavis/clavis-telemetry/main.go
Function: updateSpan() (lines 323-358)

Violation 1: Line 328 — Error from QueryRow not checked:

db.QueryRow(`SELECT COUNT(*) > 0 FROM maintenance WHERE end_at IS NULL`).Scan(&inMaint)

Error returned but silently ignored.

Violation 2: Line 332 — Error checked but not logged with unique code:

err := db.QueryRow(`SELECT id, end_at FROM uptime_spans...`).Scan(&spanID, &spanEnd)

Used for flow control, never logged when non-nil.

Violation 3: Lines 335, 338, 354 — db.Exec() errors not checked

Why This Matters

Silent database failures mean:

  • Outage tracking becomes unreliable
  • Maintenance mode detection fails silently
  • Uptime span data becomes corrupt without anyone knowing
  • No forensic trail when investigating incidents

Required Fix

  1. Check and handle ALL db.QueryRow() errors with unique codes
  2. Check and handle ALL db.Exec() errors with unique codes
  3. Log errors with format: ERR-TELEMETRY-XXX: <context> - <details>
  4. Consider whether failures should affect span tracking logic

Assignment

  • Domain: clavis-telemetry
  • Domain Owner: Hans (per Section I agent mapping)
  • Priority: Critical
  • Review by: Yurii (after fix)
## Violation Per CLAVITOR-AGENT-HANDBOOK.md Part 1: > Mandatory error handling with unique codes: > - Every `if` needs an `else`. The `if` exists because the condition IS possible > - Use unique error codes: `ToLog("ERR-12345: ...")` ## Location File: `clavis/clavis-telemetry/main.go` Function: `updateSpan()` (lines 323-358) **Violation 1:** Line 328 — Error from `QueryRow` not checked: ```go db.QueryRow(`SELECT COUNT(*) > 0 FROM maintenance WHERE end_at IS NULL`).Scan(&inMaint) ``` Error returned but silently ignored. **Violation 2:** Line 332 — Error checked but not logged with unique code: ```go err := db.QueryRow(`SELECT id, end_at FROM uptime_spans...`).Scan(&spanID, &spanEnd) ``` Used for flow control, never logged when non-nil. **Violation 3:** Lines 335, 338, 354 — `db.Exec()` errors not checked ## Why This Matters Silent database failures mean: - Outage tracking becomes unreliable - Maintenance mode detection fails silently - Uptime span data becomes corrupt without anyone knowing - No forensic trail when investigating incidents ## Required Fix 1. Check and handle ALL `db.QueryRow()` errors with unique codes 2. Check and handle ALL `db.Exec()` errors with unique codes 3. Log errors with format: `ERR-TELEMETRY-XXX: <context> - <details>` 4. Consider whether failures should affect span tracking logic ## Assignment - Domain: clavis-telemetry - Domain Owner: Hans (per Section I agent mapping) - Priority: **Critical** - Review by: Yurii (after fix)
hans was assigned by johan 2026-04-09 05:41:53 +00:00
johan closed this issue 2026-04-09 06:34:03 +00:00
Sign in to join this conversation.
No description provided.