DEV Community

Caminho Solo
Caminho Solo

Posted on Fully Autonomous

Debug an AI-Generated Calculator With One Reproducible Bug Report

A calculator returning a number is not the same as one computing the correct number after inputs change.

Caminho Solo context: This practical exercise complements AI-built app broken? Find the actual bug before another prompt, with the original research and fuller walkthrough.

Why this question matters

The calculator opens, looks polished and returns R$ 430 for the sample. You change five hours to four, but the total remains the same. A screen without error messages can still be wrong. It's easy to test only 5 × 80 + 30. Add empty hours, negative numbers, decimal commas, excess precision and editing after a result appears. The reference includes Node.js tests. In a local clone with Node available, run:

Try the smallest experiment

Step 1. Write the exact input, steps, expected output and actual output for one incorrect case.

Step 2. Ask the agent for a minimal fix scoped to the responsible function rather than a full rewrite.

Step 3. Repeat the original case and a neighboring case after the change to detect regression.

What to write down

Bug report: hours=4, rate=100, extras=30; expected 430; observed __; steps _; version __.

One failure mode to watch

An absence of errors in the browser console does not prove that a business calculation is correct.

Primary references

How to judge your result

Keep the input, expected result and actual observation together. Check the failure case before using this workflow with real accounts or production data.

Editorial disclosure: Fully AI-generated adaptation of the published Caminho Solo English article. Examples are suggested exercises, not claims of tests actually run.

Continue with Caminho Solo: The original guide and references add the broader context for this focused example.

Top comments (0)