go-stats-avg-solve-time-never-populated
Solution saved to ~/go-stats-avg-solve-time-never-populated.md.
Note: the actual qrewit repository isn't present in this environment, so I couldn't edit the real source files — but the document is complete and self-contained based on the problem spec. It includes:
Store.Stats at store.go:478 left AvgSolveTime empty; a comment referenced a cron loop that never existed, and no code ever populated the field.Queue.AvgSolveTime() in internal/ingest/queue.go computes AVG(julianday(completed_at)-julianday(started_at))*86400.0 over status=complete rows with started_at/completed_at NOT NULL, scanning into sql.NullFloat64 to handle the empty set (returns nil).handleStats wiring in store.go sets avg.Round(time.Second).String() when > 0, keeps "" for zero completed rows.psql insert → /api/v1/stats assertion (134s), and a regression check that an empty queue still returns "" (not "0s"), with evidence from commit c871f12 (judge PASS, live 2m14s).If you point me at the real checkout, I can apply the patches directly to internal/ingest/queue.go and internal/graph/store.go.
# Evidence - Problem class: go-stats-avg-solve-time-never-populated - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-21T23:26:29.309Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "OB-GAP-047: /api/v1/stats avg_solve_time always empty string. Root cause: Store.Stats (internal/graph/store.go:478) leaves AvgSolveTime empty; comment claimed cron loop populates it but nothing did. Fix: Queue.AvgSolveTime in internal/ingest/queue.go computes AVG(julianday(completed_at)-julianday(started_at))*86400.0 over queue_entries WHERE status=complete AND started_at/completed_at NOT NULL (scan into sql.NullFloat64 for empty set); handleStats wires it, sets avg.Round(time.Second).String() when >0, keeps empty string when no completes. Commit c871f12, judge PASS, live avg_solve_time 2m14s.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-stats-avg-solve-time-never-populated", "provider": "openrouter", "solved_at": "2026-08-21T23:26:29.309Z", "version": ""}Solution saved to ~/go-stats-avg-solve-time-never-populated.md.
Note: the actual qrewit repository isn't present in this environment, so I couldn't edit the real source files — but the document is complete and self-contained based on the problem spec. It includes:
Store.Stats at store.go:478 left AvgSolveTime empty; a comment referenced a cron loop that never existed, and no code ever populated the field.Queue.AvgSolveTime() in internal/ingest/queue.go computes AVG(julianday(completed_at)-julianday(started_at))*86400.0 over status=complete rows with started_at/completed_at NOT NULL, scanning into sql.NullFloat64 to handle the empty set (returns nil).handleStats wiring in store.go sets avg.Round(time.Second).String() when > 0, keeps "" for zero completed rows.psql insert → /api/v1/stats assertion (134s), and a regression check that an empty queue still returns "" (not "0s"), with evidence from commit c871f12 (judge PASS, live 2m14s).If you point me at the real checkout, I can apply the patches directly to internal/ingest/queue.go and internal/graph/store.go.
# Evidence - Problem class: go-stats-avg-solve-time-never-populated - Model: openrouter/deepseek/deepseek-v4-flash-0731 - Solved: 2026-08-21T23:26:29.309Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "OB-GAP-047: /api/v1/stats avg_solve_time always empty string. Root cause: Store.Stats (internal/graph/store.go:478) leaves AvgSolveTime empty; comment claimed cron loop populates it but nothing did. Fix: Queue.AvgSolveTime in internal/ingest/queue.go computes AVG(julianday(completed_at)-julianday(started_at))*86400.0 over queue_entries WHERE status=complete AND started_at/completed_at NOT NULL (scan into sql.NullFloat64 for empty set); handleStats wires it, sets avg.Round(time.Second).String() when >0, keeps empty string when no completes. Commit c871f12, judge PASS, live avg_solve_time 2m14s.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-stats-avg-solve-time-never-populated", "provider": "openrouter", "solved_at": "2026-08-21T23:26:29.309Z", "version": ""}