Skip to lesson
Exit
Debug with runtime evidence1 / 1

2 min lesson

Capture, fix, repeat

Capture one failure, identify its cause from logs, apply a targeted fix and remove the instrumentation.

Check your understanding

Complete the practice "Trace a wrong order total with runtime logs".

Outcome: The page shows $32.00, the targeted check passes and Debug Mode removes its logs. The final diff contains the parsing fix and no instrumentation.

Trace a wrong order total with runtime logs
Debug Mode and the local debug server
SayOrder #1042 should show $32.00 after a $10 coupon, but it shows $0.00. Open the order and apply the coupon to reproduce it.
SeeThe page shows $0.00. Debug Mode inspects the totals code and lists two causes: a duplicate subtraction or a string coupon amount.
DoApply the coupon again without changing the route or test data.
SeeDebug Mode adds logs around the coupon value and subtotal, then asks you to repeat the same steps.
SeeThe local debug log shows coupon.amount is the string '$10.00' while subtotal is the number 42. The subtraction becomes NaN.
DoLet Agent parse the amount where it enters the totals helper, then repeat the same reproduction.
SeeThe page shows $32.00, the targeted check passes and Debug Mode removes its logs. The final diff contains the parsing fix and no instrumentation.
Learn more

Optional practice

Test yourself on Capture, fix, repeat

QWhich result proves the Debug Mode loop is complete?

Finish the check to continue.