AIToday
AI Coding AssistantsZenn AI/MLPublished: Sep 29, 2026, 22:00 JST

AI code runs clean but breaks: 101 DB calls, 7-day tokens

AI code runs clean but breaks: 101 DB calls, 7-day tokens

3 Key Points

  1. What happened

    A Zenn write-up lays out five AI-written code patterns that never throw errors: I/O inside a loop (101 DB calls for 100 products), JWT logout where clearCookie leaves the token valid for seven days, toISOString() that misdates 9 hours daily in JST, soft deletes that leave deactivated users reachable, and Promise.all with no concurrency cap.

  2. Why it matters

    Each pattern passes tests and runs fine locally, so the cost only appears under real production scale — and the author argues the missing ingredient is not the model's knowledge but the business context only the humans who built the feature hold.

  3. What to watch

    Whether reviewers actually ask the five questions the author proposes — how many rows in production, whether a user can be locked out immediately, whose timezone the date belongs to, whether the same value can re-register after deletion, and where the concurrency limit is set — since the answers have to come from people, not from reading the code.

WHO IT HITSThis lands hardest on engineering leads and code reviewers who now approve far more AI-generated code than before: the failure modes are invisible in tests and local runs, so the practical fix the author proposes is a short, fixed list of questions aimed at the product owners who know the real usage numbers, account rules and timezone requirements.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

The article's framing is that writing code has taken less time over the past year, while the time spent reading output and deciding whether it is acceptable has not become any easier. The five examples are chosen for a single shared property: none of them raises an exception, fails a test, or surfaces in local development. The code shown uses Promise.all for parallelization, signs a JWT with a seven-day expiry, formats a date with toISOString(), marks a user row with a deletedAt timestamp, and maps over a user array to send welcome emails — each of which looks clean on the page. The author's point is that the missing information lives outside the code: how many rows the array will hold in production, whose timezone the date is for, whether a deleted email address may be re-registered, and how many operations may run at once.

The author is careful to note this is not an AI-only problem, recounting a Stripe sandbox-to-production switch where two users produced 22 customer records, and a follow-up fix that broke payment screens by referencing a customer ID that no longer existed on Stripe's side. The argument is that what has changed is the quantity of code, not the species of bug, and that suspicion — spotting where things are likely to break — is not something tooling speeds up. The five patterns covered in the piece each have a dedicated longer article, with a free format that starts from an incident, works through diagrams, and ends by asking the reader how they would decide.

The stakes here hinge on whether teams adopt the short question list the author proposes — production row counts, immediate lockout paths, timezone boundaries, post-deletion re-registration, and concurrency caps — since those answers come from whoever owns the feature requirements rather than from reading the code. Whether that habit actually spreads is likely to depend on how much review capacity teams are willing to spend, and on whether reviewers already know which spots in their own systems are the risky ones.

FAQ
What kinds of bugs does the article describe?
Five patterns that produce no error, no red log and no failing test: I/O inside a loop (101 DB calls for 100 products), logout that only clears the browser cookie while the token stays valid for seven days, toISOString() that misdates for nine hours a day in Japan time, soft deletes that leave deleted users in listings and their email addresses occupied, and unbounded Promise.all that can exhaust the DB connection pool.
Why does TypeScript not catch these problems?
As the author puts it, TypeScript does not know that this array will hold 5,000 items in production, or whose 'today' the value represents. The knowledge that is missing is not the concept — ask the model what an N+1 problem is and you get a textbook answer — but the context of that specific service.
Are these AI-specific bugs?
No. The author writes that a human would produce all five the same way and admits to having hit every one, including a Stripe switch where two users generated 22 customer records. What has changed, in the author's framing, is the volume of code, not the kinds of bugs.

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 articleGPT-6 Astra attacks likelier than older models: AISI