Feedback admin: 404 on missing id for read/delete

Per audit: read-toggle and delete returned {"ok":true} even for a nonexistent
id. Return 404 when no row is affected, so the optimistic UI can distinguish a
stale/already-deleted row from a real success. (The postJSON/delJSON imports
flagged in the audit were already present — verified in source + built bundle.)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-08 13:45:14 -04:00
parent ecaca35977
commit 18707a50d2
2 changed files with 13 additions and 5 deletions
+6
View File
@@ -88,3 +88,9 @@ def test_feedback_admin_actions_gated(tmp_path, monkeypatch):
anon = TestClient(app)
assert anon.post("/api/admin/feedback/1/read", json={"read": True}).status_code == 401
assert anon.delete("/api/admin/feedback/1").status_code == 401
def test_feedback_actions_404_on_missing_id(tmp_path, monkeypatch):
tc = _admin_client(tmp_path, monkeypatch)
assert tc.post("/api/admin/feedback/9999/read", json={"read": True}).status_code == 404
assert tc.delete("/api/admin/feedback/9999").status_code == 404