AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Nov 23, 2026, 16:00 JST

20-year architect flags 5 warning signs in AI-generated code

Send on LINE
20-year architect flags 5 warning signs in AI-generated code

3 Key Points

  1. What happened

    An architect with 20年以上 of systems and DB experience reviewed code from Cursor, GitHub Copilot and Claude Code, naming five recurring flaws that pass tests but fail in production.

  2. Why it matters

    The write-up argues AI-generated code swallows exceptions so failed orders still commit, and leaves authorization gaps such as IDOR open, which can leak customer data and corrupt records in production.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

Five specific smells are each paired with a "smelly" PHP/Laravel and SQL example, a mechanism for why it breaks, and a corrected version. The first targets swallowed exceptions: Laravel's DB::transaction() only rolls back when an exception reaches outside the closure, so a catch that returns false commits a half-finished order. The second concerns N+1 queries and search conditions that disable indexes — applying DATE_FORMAT or YEAR to created_at blocks the optimizer's range scan unless a function or expression index is declared. The third is calling a slow external payment API while holding a row lock and connection, which risks lock pileups and double charges when a timeout is retried. The fourth is missing authorization, where changing an order ID in the URL exposes another customer's data, and mass assignment lets a request body rewrite fields like status or price. The fifth is AI-written tests that mirror the implementation, so boundary and authorization cases stay untested. The closing section frames the human role as designing and inspecting three boundaries — error and transaction, data and performance, security and authorization — rather than hand-writing every line.

FAQ
What specific risk is highlighted inside database transactions?
Swallowing exceptions inside a transaction and returning false makes Laravel treat the block as successful, so the order status commits even after inventory reservation fails. The fix is to let the exception propagate so the rollback fires.
Why doesn't unit testing catch these problems?
AI-written tests often treat the implementation as the source of truth, so bugs pass as green. Mocking the repository and DB layers also leaves SQL errors, constraints and transaction rollback untested.
What is IDOR and how is it fixed?
IDOR is a missing object-level authorization check that lets a user change an ID in the URL to see another customer's order. The fix is to scope queries to the logged-in user's own resources and return 404 when the ID belongs to someone else.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleHairstyle AI previews judged on identity, not single images