AIToday
AI Coding AssistantsZenn AI/MLPublished: Dec 5, 2026, 22:01 JST

AI code that passes in Node.js can break in GAS on 1_000_000

Send on LINE
AI code that passes in Node.js can break in GAS on 1_000_000

3 Key Points

  1. What happened

    The author, a working engineer, says AI-written withholding-tax code containing 1_000_000 passed local tests in Node.js but threw a syntax error when pasted and saved in the GAS editor.

  2. Why it matters

    A second failure mode was subtler — AI code that computes tax per line item instead of once per invoice per rate still runs, so tests miss it and only a reader who knows the invoicing rules catches it.

Ask AI

Ask the AI about this article. Questions and answers are published on this page

Context & Analysis

The author, whose day job centers on reviewing AI-written code, began building invoice and form automation in GAS as a side business and chose to review his own AI-generated code with the same eye he uses at work. The 1_000_000 case shows why a passing test suite is not proof of portability — the code was correct JavaScript for Node.js, and only the GAS editor's save step exposed the problem.

The ten checkpoints are grouped into three questions: whether the code does what was asked, whether it actually runs in GAS, and whether it holds up in operation. The per-line tax rounding example illustrates the middle gap — a program can run correctly and still violate the invoicing rules, which is why the author pairs code reading with running it on a test spreadsheet and checking first-party sources such as National Tax Agency examples and Google's official documentation. The trigger duplication and try...catch examples point the same way: AI tends to write code that works once, while the reviewer's job is to ask what happens on the second run or when one step fails.

FAQ
Why did code that passed tests fail in the GAS editor?
It used 1_000_000, a numeric separator that is valid JavaScript in Node.js but produced a syntax error in GAS when saved. The author advises pasting into the GAS editor and running once before trusting any test result.
What is the invoice tax rounding mistake the author warns about?
AI tends to round tax per line item and then sum, but under the invoice system rounding is done once per invoice per tax rate. Because it is not a syntax error, tests will not catch it.
What GAS limits should I watch on a free account?
A free Google account can send email to 100 recipients a day, and a single script run is capped at 6 minutes, so the author says to estimate volume before it grows.
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.

By signing up you agree to the Terms of Service and Privacy Policy.

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

Related Articles

Next articlePlaud Note Pro Flow Edition gets 20% off in first Black Friday sale