跪拜 Guibai
← All articles
Backend

The Business Rules AI Can't Guess

By 回家路上绕了弯 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

AI-generated code that passes all tests can still ship the wrong business behavior, and the cost multiplies when discovery comes during integration. Teams that treat AI as a requirements interpreter instead of an implementation tool will accumulate hidden technical debt and broken user-facing contracts.

Summary

A one-line requirement like "add an order cancellation feature" sets off a chain of unspoken business questions. AI will locate the order interface, add status checks, update the database, write notification logic, and even pass tests. Then a product manager asks when the money refunds for paid orders, and the real work begins: inventory release, coupon refundability, shipment state, and what the user sees when a refund API times out.

Those default assumptions come from prior discussions and existing system behavior, not from the requirement text. When context runs thin, AI picks a common implementation and realizes it fully, which makes the team less likely to notice the unconfirmed assumptions baked in. Compilation and green tests only prove the code satisfies language and test conditions, not that it matches business intent. Code and tests sharing the same wrong assumption cannot correct each other.

The fix is to write a task spec with five parts: goal, scope, basis (where to find code, APIs, docs), constraints (compatibilities, permissions), and acceptance criteria that cover normal, exceptional, and repeated scenarios. For order cancellation, explicit scenarios like unpaid cancellation, paid cancellation, shipped orders, duplicate requests, and downstream failures each need defined behavior. Existing systems magnify the cost: a wrong field meaning spreads into APIs, databases, pages, and tests before integration exposes it. The depth of confirmation should match the change's impact, and humans confirm business meaning while AI handles the implementation.

Takeaways
— A one-line request like "add order cancellation" leaves unanswered questions about refund timing, inventory, coupon refundability, shipping state, and timeout behavior.
— AI picks a common implementation when context is missing, and its thoroughness can hide unconfirmed assumptions from the team.
— Reviewing AI output requires separating rules that come from explicit requirements, existing implementation, AI assumptions, and open questions for business owners.
— Passing compilation and tests only demonstrates language/dependency satisfaction and behavior under those tests; it does not prove business correctness.
— Code and tests sharing the same wrong assumption cannot correct each other, so acceptance criteria must be defined before implementation.
— A task spec for AI should include goal, scope, basis, constraints, and acceptance criteria.
— For order cancellation, concrete scenarios (unpaid, paid, shipped, duplicate, downstream failure) each need defined behavior that changes the implementation and test design.
— The depth of confirmation should match the change's impact: a few sentences for simple changes, detailed behavioral specifications for payment, inventory, permissions, or cross-system state.
— The later a wrong direction is found, the more layers it has touched; asking AI to list open questions and classify which block implementation lets teams proceed on confirmed parts.
Conclusions

The silent propagation of an unconfirmed decision is the biggest risk in AI-assisted development; a single wrong status definition can touch API, database, pages, and tests before integration reveals it.

AI's usefulness scales with the context it receives: limited project access and screened-in docs restrict the impact analysis it can produce, so teams must treat repository and documentation access as a prerequisite.

The article shifts the developer's role from writing code to defining an unambiguous brief and auditing AI output for business meaning; that is a different kind of skill than most teams currently hire for.

Source: juejin.cn ↗ Google Translate ↗ Backup ↗