Serverless cache cold starts
You ask an AI to add caching to a TypeScript function that fetches a user's feature flags from an API. It wraps it in a module-level `Map` cache keyed by userId — fast, but now flags never update until redeploy, and in your serverless runtime each cold invocation has an empty cache so the hit rate is ~0 anyway. You re-prompt 'add cache expiry'; it adds a 1-hour TTL, which fixes staleness but not the cold-start miss or a thundering herd on expiry. How do you re-steer?
plan_cache_reads(request_times: list[int], fresh_ttl: int, stale_window: int) → list[str][[0,10,30,95,200],60,30]out["fetch","hit","hit","fetch","fetch"][[0,70,70,75],60,30]out["fetch","stale_revalidate","hit","hit"][[],60,30]out[]Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.
Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.