Module: Use  |  Deliverable: Debugging and review log (due before Week 5 begins)  |  See assignment →

Learning objectives

By the end of this week, you should be able to:

  1. Identify failure modes in AI-generated analytic code without being told what to look for
  2. Quantify the exact numerical impact of each bug on key business metrics
  3. Build an automated test suite (run_validation()) that catches data quality and logic errors
  4. Apply three test habits: row-count checks, data-description checks, code/unit checks
  5. Use lightweight versioning to track changes
  6. Conduct a peer code review using both manual inspection and automated test suites

Sessions

Session 1 · Class 7
Why AI code breaks - quantifying the damage

Five failure trends in AI-generated code, the three test routines, then a bug hunt on a provided dataset: you'll find bugs in an AI-generated script and compute the exact dollar and percentage impact of each one. "Revenue is wrong" is not enough, you need to say by how much.

Five failure trends Three test routines Bug hunt + impact analysis
Session 2 · Class 8
Test suites, versioning, and review discipline

Build an automated test function that runs 10+ validation checks and produces a pass/fail report. Then peer-review a classmate's Week 3 notebook using both manual inspection and your test suite comparing what each method catches.

Automated test function Lightweight versioning Peer review: manual + automated

Prepare before class

Before Session 1:

  • Make sure you have access to the Week 3 v2 dataset (class5-orders-data.csv)
  • Review your Week 3 notebook - you’ll use it during Session 2’s peer review

Before Session 2:

Key concepts

Concept What it means
Three test routines Row-count checks, data-description checks, code/unit checks - run every time you use AI code
Quantitative impact Not “the bug made revenue wrong” but “the bug overstated revenue by $12,400 (8.3%)”
Test function A reusable run_validation() function with 8+ checks that produces a pass/fail report - infrastructure, not one-off assertions
Peer review Manual checklist + automated test suite, comparing what each catches

Readings and resources

Deliverable

Debugging and Review Log
3 components | 30 points | Due before Week 5's first class | Submit via Canvas

Bug report with quantitative impact analysis, fixed script with an automated test function, and peer review combining manual and automated checks.

Full prompt and rubric →

Looking ahead

Next week: AI as Analytic/Research Companion - you’ll use AI to help design an analysis, not just execute one. Shifting from “write me code” to “help me think through an approach.”