Thuta Learning
ExercisesAIbeginner

Debug, Review, and Git Workflow Combo Challenge

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Try out the Debug, Review, and Git Workflow Combo Challenge yourself
  • Practice the skills you've already learned to make them solid
  • Get good at finding mistakes, fixing them, and checking your own work

Take a moment to think about this

This lesson combines the debugging, code review, secrets/security, testing, and git commit skills you learned across earlier chapters, and puts them all to work at once. It's harder than a beginner exercise — you're not just solving one problem, you're working through a whole workflow in sequence. You can lean on AI for help, but you're expected to review, understand, and verify every decision it makes. It's best to work through the tasks in order.

Practice Drills

Task 1: Give the AI the broken function below and prompt it with something like "explain why this crashes and fix it" — then review the diff line by line. Task 2: Find the hardcoded API key in the code sample, move it into .env, and add that to .gitignore. Task 3: Write a test case that checks the edge case (empty array) for the fixed function. Task 4: Split all of these changes into four logical units and commit them with conventional-commit style messages (don't push — just make the local commits).

Code Example

javascript
// Task 1: buggy function — crash ဖြစ်ရတဲ့ အကြောင်းရင်းကို ရှာပါ
function averagePrice(items) {
  const total = items.reduce((sum, item) => sum + item.price, 0);
  return total / items.length; // items ဗလာဆိုရင် NaN ပြန်လာမယ်
}

// Task 2: hardcoded secret ကို ရှာပြီး .env ထဲ ရွှေ့ပါ
const STRIPE_KEY = "sk_live_51Hxxxxxxxxxxxxxxxxxxxxxxxx";

function chargeCustomer(amount) {
  return fetch("https://api.stripe.com/v1/charges", {
    headers: { Authorization: `Bearer ${STRIPE_KEY}` },
    method: "POST",
    body: JSON.stringify({ amount }),
  });
}

// Task 3: ဒီ edge case အတွက် test တစ်ခု ရေးပါ
// test("empty array should not crash", () => { ... })
You should see
Your local repo history should show the bug fix, the secret removal, a test, and four commits — and no secret string left anywhere in the code.

Try It in 5 Minutes

Set a 5-minute timer and focus on just Task 1 and Task 2 — if you can review the bug fix diff and move the secret into .env, that counts as a win.

A Quick Word of Caution

Never practice with a real API key — use a dummy string that just looks like a sample key when you practice the secret-removal flow.

Easy traps

  • Accepting the AI's fix without noticing it never handles the empty array/null case
  • Moving the secret into .env but forgetting to add it to .gitignore, so it ends up in the commit history anyway

Now Try It Yourself

Set a 5-minute timer and focus on just Task 1 and Task 2 — if you can review the bug fix diff and move the secret into .env, that counts as a win.

You'll know it worked when: Your local repo history should show the bug fix, the secret removal, a test, and four commits — and no secret string left anywhere in the code.

Debug, Review, and Git Workflow Combo Challenge | Thuta Learning