// Generator calibration only: no application or database state. const http = require('node:http'); const item = { id: '00000000-0000-4000-8000-000000000001', chat_id: '00000000-0000-4000-8000-000000000002', sender_id: '00000000-0000-4000-8000-000000000003', text: 'Synthetic benchmark payload '.repeat(3), created_at: '2026-01-01T00:00:00.000Z' }; const page = JSON.stringify({ items: Array.from({ length: 50 }, () => item), next_cursor: null }); const keys = new Set(); http.createServer(async (req, res) => { for await (const chunk of req) { /* consume POST body */ } if (req.method === 'POST') { const key = req.headers['idempotency-key']; if (!key || keys.has(key)) { res.writeHead(409, { 'Content-Type': 'application/json', 'X-Instance-Id': 'calibration' }); res.end(JSON.stringify({ error: 'calibration detected a repeated write key' })); return; } keys.add(key); } res.writeHead(req.method === 'GET' ? 200 : 201, { 'Content-Type': 'application/json', 'X-Instance-Id': 'calibration' }); res.end(req.method === 'GET' ? page : JSON.stringify(item)); }).listen(8080, '0.0.0.0');