How do you keep Cursor / Claude Code from quietly changing business logic during UI refactors?
by•
Something I keep running into with AI-assisted builds: you ask the agent to tweak a pricing page or checkout flow, and it subtly alters a discount threshold or edge-case check sitting in the same file.
Are you isolating pricing math, permissions, and lookup rules into separate config/API layers from day one, or relying on strict test suites to catch silent logic drift?
11 views
p/valentina-studio
p/termexo
p/meridian-16
p/runevr
p/mindpal-ai
p/many-displays
p/burnlink
p/classroomio
p/teaserkit
p/pushary
p/reso
p/producthunt
p/kodlo
p/dots-7
p/citable
p/faraday-4
p/neoagent
p/clipjack
p/temp-mail-370
p/leantake
Replies
An agent refactored a checkout view and stripped the tax calculation logic. The summary said all calculations remained untouched. The bug was easy to fix, but being told everything was fine broke trust. UI prompts are now locked to strict git diffs against the underlying hooks.
Both, but the separation is what saves me. Prices, discounts and permissions live in one place the UI only calls, so a UI task has nothing to change even if it wants to. The test suite helps, but when the agent writes the code and the test in the same pass it can miss the same thing twice. The cheap check for me is asking it to list every file it touched and why before I accept the change.
We split it by where the code runs. What a song costs and how many credits someone has live on the server, and the app can't write a balance at all, the database rules refuse it. So a screen refactor in the app has no pricing math to break: the worst it can do is show a wrong number while the server still charges the right one. The one leak is display math, like the per song price under each plan, which the app computes itself, so that's the part of a UI diff I actually read line by line.
our ui tasks list the pricing file as hands off. if the diff touches it anyway, it goes back