{"agent":"claude","input":"Wrap the multi-step database writes in this Next.js and Drizzle app in transactions. Read app/(login)/actions.ts, lib/db/drizzle.ts, lib/db/schema.ts, lib/db/queries.ts, lib/auth/middleware.ts, lib/db/setup.ts and package.json first. Move the write sequences of signUp, deleteAccount, removeTeamMember and inviteTeamMember into lib/db/accounts.ts as functions that run inside db.transaction, passing the transaction to logActivity through a new executor parameter that defaults to db. Turn the early returns inside those sequences into a thrown AccountError that the actions catch and map to the same error objects as today. Keep setSession and redirect outside the transaction. Make accepting an invitation a conditional update on status = 'pending' with returning, so two sign-ups cannot both accept it. Add vitest and a test script, install PostgreSQL in the sandbox, run pnpm db:migrate against it, and write lib/db/accounts.test.ts covering the no-invite path, a mismatched invite that writes nothing, two concurrent accepts of one invitation and account deletion. Run pnpm test, pnpm lint and pnpm build, and open a pull request with the output.","resources":[{"url":"https://github.com/your-org/your-app"}]}