From d79fecbbb4f7520ed15b589f8013e643cc0aceda Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Mon, 2 Mar 2026 19:36:59 -0600 Subject: [PATCH] =?UTF-8?q?store:=20Fix:=20swallowed=20HTTPException=20in?= =?UTF-8?q?=20recalculate=5Fstandings=20=E2=80=94=20use=20sed=20to=20avoid?= =?UTF-8?q?=20linter=20reformatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...in-recalculate-standings-use-sed-a5f56c.md | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 graph/fixes/fix-swallowed-httpexception-in-recalculate-standings-use-sed-a5f56c.md diff --git a/graph/fixes/fix-swallowed-httpexception-in-recalculate-standings-use-sed-a5f56c.md b/graph/fixes/fix-swallowed-httpexception-in-recalculate-standings-use-sed-a5f56c.md new file mode 100644 index 00000000000..6e89020fe0a --- /dev/null +++ b/graph/fixes/fix-swallowed-httpexception-in-recalculate-standings-use-sed-a5f56c.md @@ -0,0 +1,42 @@ +--- +id: a5f56cb6-9a7b-4224-98f3-aefc4cfc0a2a +type: fix +title: "Fix: swallowed HTTPException in recalculate_standings — use sed to avoid linter reformatting" +tags: [major-domo-database, fastapi, python, httpexception, linter, sed, standings] +importance: 0.7 +confidence: 0.8 +created: "2026-03-03T01:36:59.027516+00:00" +updated: "2026-03-03T01:36:59.027516+00:00" +--- + +# Fix: Swallowed HTTPException in recalculate_standings + +## Problem +`app/routers_v3/standings.py` line 124 constructed an `HTTPException` but never raised it, causing the endpoint to always return 200 even on failure. + +## Root Cause +Missing `raise` keyword: +```python +# Bug +HTTPException(status_code=500, detail=f'Error recreating Standings rows') + +# Fix +raise HTTPException(status_code=500, detail=f'Error recreating Standings rows') +``` + +## Solution +Add the single `raise` keyword. Used `sed -i` directly rather than the Edit tool, because the Edit tool triggers a linter (black/ruff) that reformats the entire file — which caused the previous PR (#40) to be rejected. + +```bash +sed -i "s/ HTTPException(status_code=500, detail=f'Error recreating Standings rows')/ raise HTTPException(status_code=500, detail=f'Error recreating Standings rows')/" app/routers_v3/standings.py +``` + +## Key Lesson +When a repo has an auto-formatter configured as a save hook, use `sed` or `Bash` tool for surgical one-line fixes instead of the Edit tool, to avoid unintended reformatting of the whole file. + +## Files Changed +- `app/routers_v3/standings.py` (1 line, 1 word added) + +## PR +- Issue: major-domo-database#23 +- PR: major-domo-database#41