Content-pack import errors put raw exception text in a 400 (CA-003) #781

Closed
opened 2026-09-23 16:36:25 +00:00 by claude-bot · 0 comments
Collaborator

Found building Settings → Content packs (#729).

webapp/backend/app/reference/import_service.py builds some of its 400 responses from str(exc) — around lines 262, 339 and 725. So a parser's own exception text reaches the person loading a pack, as a 4xx detail.

SH-7's CA-003 is about exactly this: its drawn example of what must never be shown is "Request failed with status code 500: IntegrityError (psycopg.errors.UniqueViolation)…". Lane 3 added utils/plainError.js, which shows a 4xx's detail because a 4xx sentence is meant to be written for people — and these three are not. So the frontend cannot filter them without also throwing away the real sentences beside them.

Fix

At each site, say what went wrong with the file, in the product's own words — which part of the pack could not be read, and what to do about it — and log exc server-side for whoever debugs it. The detail should never depend on which library raised.

Worth a test per site that the detail contains no exception class name and no library-internal text.

🤖 Generated with Claude Code

Found building Settings → Content packs (#729). `webapp/backend/app/reference/import_service.py` builds some of its 400 responses from `str(exc)` — around lines 262, 339 and 725. So a parser's own exception text reaches the person loading a pack, as a 4xx `detail`. SH-7's `CA-003` is about exactly this: its drawn example of what must never be shown is *"Request failed with status code 500: IntegrityError (psycopg.errors.UniqueViolation)…"*. Lane 3 added `utils/plainError.js`, which shows a 4xx's `detail` because a 4xx sentence is meant to be written for people — and these three are not. So the frontend cannot filter them without also throwing away the real sentences beside them. ## Fix At each site, say what went wrong with the *file*, in the product's own words — which part of the pack could not be read, and what to do about it — and log `exc` server-side for whoever debugs it. The detail should never depend on which library raised. Worth a test per site that the detail contains no exception class name and no library-internal text. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#781
No description provided.