Pitfalls of AI Development: The "Infinite Correction Loop" Born from 20,000 Lines of Code and the Database Tragedy
Table of Contents
- Introduction: In the Latter Half of Development, AI Becomes a "Breaker"
- Lesson 1: The Infinite Bug Fix Loop (Whac-A-Mole)
- Solution: Have AI Create a "Debug List" and Direct It
- Lesson 2: The Database Tragedy (Refactoring Hell)
- Lesson 3: AI Cannot See "Omissions in Conception"
- Summary: Don't Be Used by AI, Use AI
Introduction: In the Latter Half of Development, AI Becomes a "Breaker"
"Alright, the basic functionality is done. All that's left is to fix the bugs."
From that moment, the real hell began. For code that had swelled to 22,500 lines, attempting simple bug fixes using Genspark led to an "infinite correction loop" where fixing one thing broke two others.
In this article, I will share the debugging failures I encountered in the latter half of development, and the "debugging flow to bring AI under control" that I devised from them.
Lesson 1: The Infinite Bug Fix Loop (Whac-A-Mole)
Debugging in the early stages of development is easy. Just throw the error logs at the AI, and it will fix them immediately. However, doing the same thing in the latter half when the code has become complex leads to disaster.
Failure Pattern: A Series of "Fix This" Commands
AI is good at eliminating "the immediate error" but cannot perfectly predict "side effects from corrections (impact on other functionalities)."
Fixing A makes B stop working, fixing B causes C to bug out, and fixing C breaks A again... Before you know it, the correction codes clash, and the code becomes spaghetti.
Solution: Have AI Create a "Debug List" and Direct It
To escape from this quagmire, I fundamentally changed how I instruct the AI. Instead of having it "fix," I first have it "organize."
The Golden Debugging Flow
- List Creation: Have the AI enumerate the currently occurring issues, and create a "debug list."
- Documentation: Following the list, have it write a "correction plan document" summarizing each cause and correction policy.
- Quality Check: Have it check that document from a different perspective (quality control prompt), to confirm there are no clashes or omissions in the correction details.
- Implementation: Only when overall consistency is achieved, have it execute the code correction.
✅ Effect: Drastic Reduction in Rework
If you think "there seem to be a lot of issues," stop and first have it create a list. Just this allows the AI to re-recognize the overall picture, and present a consistent correction plan. Haste makes waste (or "slow and steady wins the race") was also true in AI development.
Lesson 2: The Database Tragedy (Refactoring Hell)
Another major failure was the database design.
In the latter half of development, the situation arose where I realized, "Oh, to implement this feature, I need to change the DB structure." I requested the AI to refactor (change the structure), but this was the beginning of a nightmare.
DB type definitions, API response types, frontend reception processing... Just one column change propagated throughout the entire application, spewing out a large number of Type Errors.
⚠️ Important: Incorporate "Extensibility" from the Start
If you leave it to AI, it tends to create "the minimum DB that satisfies current requirements." Extensibility, such as "a notification feature might be added in the future" or "DM features might increase," needs to be explicitly instructed and incorporated by humans from the start.
Lesson 3: AI Cannot See "Omissions in Conception"
As development approached its final stages, I sometimes noticed missing features, thinking, "Wait, without this feature, the app won't function, will it?"
AI is faithful to the specifications. If it's not written in the specifications, it won't create it, no matter how common or necessary the feature is for a social media app.
"You really need to read carefully."
These words are a self-admonition. Humans must thoroughly read the requirements definition document written by AI from a "customer's perspective" and point out any omissions or oversights. If you neglect this process, you will suffer a painful backlash in the latter half of development.
Summary: Don't Be Used by AI, Use AI
In AI development, bug fixing tends to become a "Whac-A-Mole" game. However, when the human conductor gives the command, "Stop for a moment. Create a list," the AI reverts to being an excellent engineer.
Through this series of developments (Articles 57-59), I became convinced that the essence of AI development is not "having AI write code," but rather "documenting and managing the AI's thought process."
I hope that everyone who is about to challenge app development with Genspark will not make the same mistakes I did.
Related Articles
- Series Part 1: [Development Achievement] The Complete Record of Developing an SNS App that Usually Takes 3 Months in One Week with Genspark
- Series Part 2: Is Genspark Bad at Frontend? Three Challenges Faced in Next.js Development and Their Solutions
🎉 Series Concluded
Thank you for reading the three-part series "Struggles of SNS App Development." This blog will continue to share the latest know-how on AI development using Genspark.