feat(api): X-RateLimit-* headers on /api/demo + createdAt/completedAt on job responses
Task #19 — API response polish. Changes to artifacts/api-server/src/routes/demo.ts: - checkRateLimit() return type extended: { allowed, resetAt, remaining } - remaining = RATE_LIMIT_MAX - 1 on first request (count just incremented to 1) - remaining = 0 when rate limited (count >= max) - remaining = RATE_LIMIT_MAX - entry.count after each subsequent increment - X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset headers set on ALL responses (200, 400, 429, 500) — not just 429s - Reset value is Unix epoch seconds (Math.floor(resetAt / 1000)) Changes to artifacts/api-server/src/routes/jobs.ts: - base object now includes createdAt: job.createdAt.toISOString() for all states - complete state response adds completedAt: job.updatedAt.toISOString() (updatedAt is set to new Date() at completion time in runWorkInBackground) - POST /api/jobs response includes createdAt: createdAt.toISOString() (captured as new Date() before transaction, also passed explicitly to insert) Verification: - 20/20 testkit PASS (full run after server restart to reset in-memory quota) - TypeCheck: passing (pre-push hook confirmed) - Lint: passing (pre-push hook confirmed) - Gitea PR #28 squash-merged to main No DB schema changes. No migration needed.
This commit is contained in: