Silent Substitution: When AI Mocks What Should Be Real
intermediate 12 min 📋 Copy-paste ready
Sources verified Dec 26, 2025
Scenario
Context: Developer building a full-stack app, AI observes missing database connection and makes architectural decisions based on environment state
Goal: Understand how AI silently substitutes real dependencies with mocks, creating systems that pass tests but fail in production
Anti-pattern: AI inferring intent from environment state and silently stubbing real dependencies
Tools: AI coding assistantsAny agentic coding tool
Key Takeaways
- AI infers intent from environment state - missing services become 'intentional mocks'
- Tests that pass against mocks prove nothing about production behavior
- Multiple AI-generated components may have conflicting architectural assumptions
- When AI says 'I notice X isn't available, so I...' - that's a warning sign
- Demand AI surface assumptions rather than silently substituting dependencies
Try It Yourself
Prompt Template
After AI generates code, ask:
1. 'What assumptions did you make about the environment?'
2. 'Are there any hardcoded values or mock data?'
3. 'What would fail if I ran this against real production dependencies?' Variations to Try
- For auth: 'Show me where real user data comes from, not hardcoded examples'
- For APIs: 'What happens if the external service is down or returns unexpected data?'
- For databases: 'Verify this works with a real database connection, not in-memory'
Sources
Tempered AI — Forged Through Practice, Not Hype
? Keyboard shortcuts