From 371ee1370bb33529e1efe0b492846ddc91335c42 Mon Sep 17 00:00:00 2001 From: Coff0xc <184964491+Coff0xc@users.noreply.github.com> Date: Sat, 21 Nov 2026 19:54:56 +0000 Subject: [PATCH] fix(server): do not return database errors from the skill endpoints Recent skill calls and missing-skill stats put pgx text in the HTTP body. The server now logs that error and returns a fixed message. --- CHANGELOG.md | 1 + server/server_mgmt.go | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5af6fb65..fa807d5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented in this file. The format is b ### Fixed +- **Skill endpoints no longer return database driver text**: a failure loading skill usage or missing-skill stats is logged on the server and the client receives a fixed message. - **Docker Compose database passwords with URL-special characters**: `docker-compose.yml` no longer pastes `POSTGRES_PASSWORD` into `ARTEX_PG_DSN`. The server builds the URL from `ARTEX_PG_HOST`, `ARTEX_PG_PORT`, `ARTEX_PG_USER`, `ARTEX_PG_PASSWORD`, `ARTEX_PG_DBNAME` and `ARTEX_PG_SSLMODE`, percent-encoding the user and password, so `/`, `?`, `%`, `@`, `:` and spaces connect. An explicit `ARTEX_PG_DSN` still wins and is not rewritten. `ARTEX_PG_PASSWORD` is removed from the environment with the other startup secrets (#450). ## [0.7.0] - 2026-11-21 diff --git a/server/server_mgmt.go b/server/server_mgmt.go index 732f99a7..e1c550f2 100644 --- a/server/server_mgmt.go +++ b/server/server_mgmt.go @@ -1227,7 +1227,8 @@ func (s *Server) fsSkillUsage(w http.ResponseWriter, r *http.Request) { limit, _ := strconv.Atoi(r.URL.Query().Get("limit")) calls, err := pg.RecentSkillCalls(name, limit) if err != nil { - writeErr(w, 500, err.Error()) + log.Printf("[skills] recent calls for %s: %v", name, err) + writeErr(w, 500, "failed to load skill usage") return } writeJSON(w, 200, map[string]any{"calls": calls}) @@ -1243,7 +1244,8 @@ func (s *Server) fsMissingSkills(w http.ResponseWriter, r *http.Request) { limit, _ := strconv.Atoi(r.URL.Query().Get("limit")) missing, err := pg.MissingSkillStats(limit) if err != nil { - writeErr(w, 500, err.Error()) + log.Printf("[skills] missing skills: %v", err) + writeErr(w, 500, "failed to load missing skills") return } writeJSON(w, 200, map[string]any{"missing": missing})