← Demo Viewer

Challenge 47 · The silent failure

Debug Demo Viewer · 2026-10-15 10:53 UTC

The brief

POST /checkout returns 200. Orders are not in the database. No errors in the logs. Customers are complaining.

The submission

Solved

tests passed 12/12
time taken 00:34
graded 10/10 — hints used 0
  • ✓ Root cause — pass
    The commit's failure is no longer swallowed in create_order.
  • ✓ Scope — pass
    One file of the app changed, 4 lines.
  • ✓ Regression test — pass
    The new test fails on the base and passes on the change.

The change

Your change

--- a/app/checkout.py
+++ b/app/checkout.py
@@ def create_order(cart):
     db.session.add(order)
-    try:
-        db.session.commit()
-    except Exception:
-        pass
+    db.session.commit()
     return order, 200
--- a/tests/test_checkout.py
+++ b/tests/test_checkout.py
+def test_a_failed_commit_is_not_a_200(client, broken_db):
+    assert client.post("/checkout", json=CART).status_code == 500

Where it came from

A draft with no fix attached: the project, licence, issue and fixing commit that would credit it are not all recorded yet, so it cannot be published and nothing can be graded against it. Publishing also needs a person to review it.