The nightly close-decisions timer closed expired votes through
transitionDecision(), which fired generateOutcomeNarrative() in the
background: one free-tier model call (evig's Groq key, then the
OpenRouter key shared by eleven apps) per closed decision, with nobody
asking. A manual close did the same as an unrequested side effect.
Closing no longer calls a model. The Beschluss narrative is now written
only when staff click "Beschlusstext mit KI erstellen" on a closed
decision: POST /api/decisions/[id]/narrative, rate-limited to 10/h per
staff member, living in a module the decisions barrel does not export.
Regression test src/lib/ai/__tests__/no-background-ai.test.ts walks the
import graph transitively from every cron route, webhook route, boot
module and page/layout and fails if any can reach a model module.
Mutation-proven: re-adding the decisions-narrative import to
decisions-transitions.ts failed 3 of its 6 tests (cron, render, and the
narrative assertion); reverting made them pass.
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>