Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
13
13
task_type
stringclasses
14 values
difficulty
stringclasses
4 values
prompt
stringlengths
273
512
response
stringclasses
104 values
metadata
dict
devgod_000001
code_generation
hard
Implement analytics pipeline for a gaming product. Target platform: data (SQL + Python). Requirements: provide production-ready code, configuration, and tests. Constraints: must include tests, must be production-ready, must include documentation/comments. Difficulty: hard. Assume 10k RPS peak traffic.
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000002
code_generation
hard
Implement A/B experimentation for a gaming product. Target platform: backend (Node.js). Requirements: provide production-ready code, configuration, and tests. Constraints: must include documentation/comments, must be easy to extend, must be observable (logs/metrics/traces). Difficulty: hard. Assume untrusted input; validate everything.
Output: design + implementation guidance suitable for shipping. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000003
code_generation
medium
Implement rate limiting for a enterprise SaaS product. Target platform: backend (Go). Requirements: provide production-ready code, configuration, and tests. Constraints: must include clear error handling, must be easy to extend, must include documentation/comments. Difficulty: medium. Include rollback strategy.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000004
code_generation
easy
Implement rate limiting for a customer support product. Target platform: backend (Python FastAPI). Requirements: provide production-ready code, configuration, and tests. Constraints: must include tests, must include type hints where applicable, must be performant under load, must avoid global state. Difficulty: easy. Assume schema evolves frequently; design for migrations.
Output: production-oriented blueprint with code where appropriate. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000005
code_generation
expert
Implement analytics pipeline for a customer support product. Target platform: web (React + TypeScript). Requirements: provide production-ready code, configuration, and tests. Constraints: must include documentation/comments, must be performant under load, must be production-ready, must include tests. Difficulty: expert. Assume strict latency budget (p95 < 200ms).
Output: production-oriented blueprint with code where appropriate. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000006
code_generation
medium
Implement role-based access control for a fraud detection product. Target platform: infra (Terraform). Requirements: provide production-ready code, configuration, and tests. Constraints: must include tests, must be easy to extend, must be observable (logs/metrics/traces), must be performant under load. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: design + implementation guidance suitable for shipping. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000007
code_generation
medium
Implement file uploads for a developer tooling product. Target platform: ML (scikit + batch). Requirements: provide production-ready code, configuration, and tests. Constraints: must be performant under load, must include clear error handling, must be secure-by-default, must be easy to extend. Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000008
code_generation
medium
Implement rate limiting for a e-commerce product. Target platform: backend (Go). Requirements: provide production-ready code, configuration, and tests. Constraints: must be secure-by-default, must be observable (logs/metrics/traces), must be easy to extend, must be performant under load, must include clear error handling. Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000009
code_generation
medium
Implement analytics pipeline for a developer tooling product. Target platform: web (React + TypeScript). Requirements: provide production-ready code, configuration, and tests. Constraints: must be production-ready, must be secure-by-default, must be easy to extend, must avoid global state. Difficulty: medium. Include rollback strategy.
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000010
code_generation
hard
Implement real-time notifications for a logistics product. Target platform: infra (Docker + Kubernetes). Requirements: provide production-ready code, configuration, and tests. Constraints: must include type hints where applicable, must include documentation/comments, must be secure-by-default, must be easy to extend. Difficulty: hard. Assume untrusted input; validate everything.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000011
code_generation
medium
Implement rate limiting for a calendar/scheduling product. Target platform: web (React + TypeScript). Requirements: provide production-ready code, configuration, and tests. Constraints: must include type hints where applicable, must avoid global state, must be performant under load, must be observable (logs/metrics/traces), must be easy to extend. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000012
code_generation
medium
Implement event-driven workflows for a healthtech product. Target platform: web (React + TypeScript). Requirements: provide production-ready code, configuration, and tests. Constraints: must include clear error handling, must be secure-by-default, must be performant under load, must be production-ready, must be observable (logs/metrics/traces). Difficulty: medium. Assume untrusted input; validate everything.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000013
code_generation
expert
Implement event-driven workflows for a calendar/scheduling product. Target platform: backend (Python FastAPI). Requirements: provide production-ready code, configuration, and tests. Constraints: must avoid global state, must be observable (logs/metrics/traces), must be easy to extend, must include type hints where applicable, must be performant under load. Difficulty: expert. Assume 10k RPS peak traffic.
Output: design + implementation guidance suitable for shipping. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "implementation", "api" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000014
bugfix_debugging
medium
Debug and fix a subtle production bug related to A/B experimentation in a education service. Target platform: mobile (iOS Swift). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include tests, must avoid global state, must be production-ready, must be observable (logs/metrics/traces). Difficulty: medium. Assume mobile clients are occasionally offline.
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000015
bugfix_debugging
expert
Debug and fix a subtle production bug related to webhooks in a fraud detection service. Target platform: ML (scikit + batch). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include documentation/comments, must include clear error handling, must include tests, must include type hints where applicable, must be easy to extend. Difficulty: expert. Assume schema evolves frequently; design for migrations.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000016
bugfix_debugging
medium
Debug and fix a subtle production bug related to real-time notifications in a customer support service. Target platform: infra (Terraform). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include type hints where applicable, must be production-ready, must include tests. Difficulty: medium. Assume PII must be protected.
Output: production-oriented blueprint with code where appropriate. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000017
bugfix_debugging
medium
Debug and fix a subtle production bug related to caching in a fintech service. Target platform: data (SQL + Python). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include clear error handling, must include documentation/comments, must avoid global state, must be secure-by-default, must include tests. Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000018
bugfix_debugging
expert
Debug and fix a subtle production bug related to event-driven workflows in a customer support service. Target platform: infra (Docker + Kubernetes). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include type hints where applicable, must be secure-by-default, must be performant under load. Difficulty: expert. Include rollback strategy.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000019
bugfix_debugging
easy
Debug and fix a subtle production bug related to background jobs in a developer tooling service. Target platform: ML (scikit + batch). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must be easy to extend, must avoid global state, must include documentation/comments, must include clear error handling, must be production-ready. Difficulty: easy. Assume mobile clients are occasionally offline.
Output: production-oriented blueprint with code where appropriate. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000020
bugfix_debugging
easy
Debug and fix a subtle production bug related to event-driven workflows in a fintech service. Target platform: web (React + TypeScript). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must avoid global state, must include clear error handling, must include tests, must include documentation/comments, must be performant under load. Difficulty: easy. Assume strict latency budget (p95 < 200ms).
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000021
bugfix_debugging
hard
Debug and fix a subtle production bug related to analytics pipeline in a calendar/scheduling service. Target platform: data (SQL + Python). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must avoid global state, must be observable (logs/metrics/traces), must be performant under load, must include tests, must include clear error handling. Difficulty: hard. Assume schema evolves frequently; design for migrations.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000022
bugfix_debugging
expert
Debug and fix a subtle production bug related to rate limiting in a fraud detection service. Target platform: mobile (Android Kotlin). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must avoid global state, must be production-ready, must be easy to extend, must include clear error handling, must be performant under load. Difficulty: expert. Assume 10k RPS peak traffic.
Output: design + implementation guidance suitable for shipping. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000023
bugfix_debugging
hard
Debug and fix a subtle production bug related to caching in a customer support service. Target platform: backend (Node.js). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include documentation/comments, must include type hints where applicable, must be observable (logs/metrics/traces), must be easy to extend, must be production-ready. Difficulty: hard. Include rollback strategy.
Output: actionable implementation and verification artifacts. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000024
bugfix_debugging
medium
Debug and fix a subtle production bug related to event-driven workflows in a healthtech service. Target platform: CI (GitHub Actions). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include tests, must include documentation/comments, must include type hints where applicable, must include clear error handling, must be easy to extend. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000025
bugfix_debugging
hard
Debug and fix a subtle production bug related to event-driven workflows in a social media service. Target platform: web (React + TypeScript). Requirements: identify root cause, provide patch, and add regression tests. Constraints: must include clear error handling, must be observable (logs/metrics/traces), must be secure-by-default, must include type hints where applicable, must be easy to extend. Difficulty: hard. Assume untrusted input; validate everything.
Output: engineering-grade answer with edge cases covered. Deliverable: production-grade reference implementation (FastAPI) + tests. ```python # app.py from __future__ import annotations import hashlib import json from dataclasses import dataclass from datetime import datetime, timezone from typing import Any, Optional from fastapi import FastAPI, Header, HTTPException from pydantic import BaseModel, Field app = FastAPI(title="Idempotent API") class CreateReq(BaseModel): tenant_id: str = Field(min_length=1) amount_cents: int = Field(ge=0) currency: str = Field(min_length=3, max_length=3) class CreateResp(BaseModel): id: str created_at: str echo: CreateReq @dataclass class _IdempoEntry: request_hash: str response_json: str # In production: Postgres table with UNIQUE(tenant_id, key) _IDEMPO: dict[tuple[str, str], _IdempoEntry] = {} def _hash_req(req: CreateReq) -> str: raw = req.model_dump_json() return hashlib.sha256(raw.encode("utf-8")).hexdigest() @app.post("/v1/payments", response_model=CreateResp) def create_payment( req: CreateReq, idempotency_key: Optional[str] = Header(default=None, alias="Idempotency-Key"), ) -> Any: if not idempotency_key: raise HTTPException(status_code=400, detail="Missing Idempotency-Key") if len(idempotency_key) > 128: raise HTTPException(status_code=400, detail="Idempotency-Key too long") key = (req.tenant_id, idempotency_key) rh = _hash_req(req) existing = _IDEMPO.get(key) if existing: if existing.request_hash != rh: raise HTTPException(status_code=409, detail="Idempotency-Key reuse with different payload") return json.loads(existing.response_json) # Create new payment (stubbed) pid = hashlib.md5(f"{req.tenant_id}:{idempotency_key}".encode()).hexdigest() resp = CreateResp( id=pid, created_at=datetime.now(timezone.utc).isoformat(), echo=req, ) _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json()) return resp ``` ```python # test_app.py (pytest) from fastapi.testclient import TestClient from app import app client = TestClient(app) def test_idempotent_replay(): headers = {"Idempotency-Key": "abc"} body = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} r1 = client.post("/v1/payments", json=body, headers=headers) r2 = client.post("/v1/payments", json=body, headers=headers) assert r1.status_code == 200 and r2.status_code == 200 assert r1.json() == r2.json() def test_payload_conflict(): headers = {"Idempotency-Key": "abc"} b1 = {"tenant_id":"t1","amount_cents":100,"currency":"USD"} b2 = {"tenant_id":"t1","amount_cents":200,"currency":"USD"} assert client.post("/v1/payments", json=b1, headers=headers).status_code == 200 assert client.post("/v1/payments", json=b2, headers=headers).status_code == 409 ``` Notes: - Replace in-memory store with a DB table and transaction. - Store response + request hash to detect key reuse with different payload. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "debugging", "root-cause" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000026
testing_qa
hard
Create a comprehensive test plan and automated tests for rate limiting in a enterprise SaaS product. Target platform: infra (Docker + Kubernetes). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must avoid global state, must be observable (logs/metrics/traces), must include tests, must include clear error handling. Difficulty: hard. Assume schema evolves frequently; design for migrations.
Output: production-oriented blueprint with code where appropriate. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000027
testing_qa
easy
Create a comprehensive test plan and automated tests for rate limiting in a calendar/scheduling product. Target platform: data (SQL + Python). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must avoid global state, must be secure-by-default, must be easy to extend, must include type hints where applicable. Difficulty: easy. Assume mobile clients are occasionally offline.
Output: engineering-grade answer with edge cases covered. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000028
testing_qa
medium
Create a comprehensive test plan and automated tests for idempotent payments in a e-commerce product. Target platform: CI (GitHub Actions). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must avoid global state, must be easy to extend, must include clear error handling, must be performant under load. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: actionable implementation and verification artifacts. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000029
testing_qa
medium
Create a comprehensive test plan and automated tests for file uploads in a customer support product. Target platform: mobile (iOS Swift). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must include documentation/comments, must be performant under load, must be production-ready, must include tests, must include type hints where applicable. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: engineering-grade answer with edge cases covered. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000030
testing_qa
easy
Create a comprehensive test plan and automated tests for A/B experimentation in a gaming product. Target platform: data (SQL + Python). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must be easy to extend, must include clear error handling, must be secure-by-default, must avoid global state, must include documentation/comments. Difficulty: easy. Assume mobile clients are occasionally offline.
Output: actionable implementation and verification artifacts. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000031
testing_qa
expert
Create a comprehensive test plan and automated tests for role-based access control in a gaming product. Target platform: backend (Python FastAPI). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must include type hints where applicable, must include tests, must be easy to extend, must include clear error handling, must be secure-by-default. Difficulty: expert. Assume PII must be protected.
Output: engineering-grade answer with edge cases covered. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000032
testing_qa
medium
Create a comprehensive test plan and automated tests for A/B experimentation in a document processing product. Target platform: mobile (iOS Swift). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must avoid global state, must include clear error handling, must be secure-by-default. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: actionable implementation and verification artifacts. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000033
testing_qa
easy
Create a comprehensive test plan and automated tests for offline-first sync in a e-commerce product. Target platform: mobile (Android Kotlin). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must be easy to extend, must be production-ready, must avoid global state, must be observable (logs/metrics/traces). Difficulty: easy. Assume 10k RPS peak traffic.
Output: production-oriented blueprint with code where appropriate. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000034
testing_qa
easy
Create a comprehensive test plan and automated tests for analytics pipeline in a fraud detection product. Target platform: ML (scikit + batch). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must include clear error handling, must be performant under load, must be secure-by-default, must be observable (logs/metrics/traces). Difficulty: easy. Assume mobile clients are occasionally offline.
Output: production-oriented blueprint with code where appropriate. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000035
testing_qa
easy
Create a comprehensive test plan and automated tests for event-driven workflows in a calendar/scheduling product. Target platform: data (SQL + Python). Requirements: unit/integration tests, edge cases, load tests strategy, and CI gates. Constraints: must be performant under load, must include tests, must be production-ready, must include clear error handling. Difficulty: easy. Include rollback strategy.
Output: design + implementation guidance suitable for shipping. Deliverable: test plan + automation guidance. **Unit tests** - Validation: malformed payloads rejected with correct codes. - AuthZ: tenant boundary enforced. - Idempotency: replay returns same response; conflicting reuse yields 409. **Integration tests** - DB transaction behavior; unique constraints. - Cache behavior: correctness under concurrent requests. **Load tests** - 10k RPS target: measure p95 latency, error rate, saturation. **CI gates** - Lint + typecheck + unit tests required. - Coverage threshold for critical modules. - Block merge on flaky test detection. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "testing", "qa" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000036
system_design
easy
Design a production system for enterprise SaaS supporting rate limiting. Target platform: infra (Docker + Kubernetes). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must include tests, must be performant under load, must be production-ready, must be easy to extend. Difficulty: easy. Assume GDPR-style deletion requests must be supported.
Output: design + implementation guidance suitable for shipping. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000037
system_design
medium
Design a production system for customer support supporting real-time notifications. Target platform: CI (GitHub Actions). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must be observable (logs/metrics/traces), must include tests, must avoid global state. Difficulty: medium. Assume 10k RPS peak traffic.
Output: engineering-grade answer with edge cases covered. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000038
system_design
expert
Design a production system for social media supporting role-based access control. Target platform: web (React + TypeScript). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must be production-ready, must include type hints where applicable, must be performant under load. Difficulty: expert. Assume mobile clients are occasionally offline.
Output: engineering-grade answer with edge cases covered. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000039
system_design
easy
Design a production system for enterprise SaaS supporting search + pagination. Target platform: mobile (iOS Swift). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must include tests, must include type hints where applicable, must be performant under load, must include documentation/comments. Difficulty: easy. Assume 10k RPS peak traffic.
Output: design + implementation guidance suitable for shipping. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000040
system_design
easy
Design a production system for gaming supporting analytics pipeline. Target platform: infra (Docker + Kubernetes). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must be performant under load, must be production-ready, must include tests, must avoid global state. Difficulty: easy. Assume mobile clients are occasionally offline.
Output: design + implementation guidance suitable for shipping. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000041
system_design
hard
Design a production system for IoT telemetry supporting rate limiting. Target platform: infra (Terraform). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must be performant under load, must include clear error handling, must include type hints where applicable. Difficulty: hard. Assume 10k RPS peak traffic.
Output: production-oriented blueprint with code where appropriate. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000042
system_design
expert
Design a production system for content moderation supporting rate limiting. Target platform: mobile (iOS Swift). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must include type hints where applicable, must be performant under load, must include clear error handling, must be secure-by-default. Difficulty: expert. Include rollback strategy.
Output: engineering-grade answer with edge cases covered. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000043
system_design
expert
Design a production system for logistics supporting background jobs. Target platform: data (SQL + Python). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must include tests, must be production-ready, must be secure-by-default, must include documentation/comments. Difficulty: expert. Assume PII must be protected.
Output: engineering-grade answer with edge cases covered. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000044
system_design
hard
Design a production system for developer tooling supporting webhooks. Target platform: CI (GitHub Actions). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must be performant under load, must include type hints where applicable, must be production-ready, must include clear error handling. Difficulty: hard. Assume 10k RPS peak traffic.
Output: production-oriented blueprint with code where appropriate. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000045
system_design
easy
Design a production system for fintech supporting role-based access control. Target platform: web (React + TypeScript). Requirements: APIs, data model, scaling strategy, failure modes, and security. Constraints: must be secure-by-default, must include type hints where applicable, must be observable (logs/metrics/traces), must include documentation/comments, must be performant under load. Difficulty: easy. Assume 10k RPS peak traffic.
Output: production-oriented blueprint with code where appropriate. Deliverable: system design with APIs, data model, and operational plan. **High-level architecture** - Edge: API Gateway + WAF - Core service: stateless app pods behind L7 LB - Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed) - Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs - Observability: structured logs + metrics + tracing **APIs (example)** - `POST /v1/{resource}` create (idempotent via `Idempotency-Key`) - `GET /v1/{resource}/{id}` read - `POST /v1/{resource}/{id}:action` command endpoint when side effects exist **Data model (Postgres)** - `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)` - Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table: - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))` **Scaling** - App layer scales horizontally; keep sessions out of process. - Cache reads in Redis; write-through invalidation on mutations. - Use connection pooling; consider read replicas for heavy reads. **Failure modes** - Retries: only for safe/ idempotent operations; exponential backoff + jitter. - Partial failures: background jobs must be idempotent; use a de-dup key. **Security** - AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation - Validate all inputs; enforce per-tenant quotas/rate limits. **Rollout** - Dark launch + feature flags; canary; rapid rollback by toggling flags. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "architecture", "scalability" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000046
architecture_refactor
easy
Refactor an existing codebase in enterprise SaaS to support analytics pipeline cleanly. Target platform: ML (scikit + batch). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include clear error handling, must be observable (logs/metrics/traces), must be production-ready. Difficulty: easy. Include rollback strategy.
Output: production-oriented blueprint with code where appropriate. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000047
architecture_refactor
medium
Refactor an existing codebase in fintech to support caching cleanly. Target platform: infra (Docker + Kubernetes). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must be secure-by-default, must be performant under load, must include type hints where applicable, must be easy to extend. Difficulty: medium. Assume 10k RPS peak traffic.
Output: actionable implementation and verification artifacts. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000048
architecture_refactor
medium
Refactor an existing codebase in customer support to support real-time notifications cleanly. Target platform: mobile (iOS Swift). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include documentation/comments, must include tests, must include clear error handling, must be observable (logs/metrics/traces), must be secure-by-default. Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: production-oriented blueprint with code where appropriate. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000049
architecture_refactor
medium
Refactor an existing codebase in fintech to support role-based access control cleanly. Target platform: web (React + TypeScript). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include type hints where applicable, must include clear error handling, must be observable (logs/metrics/traces), must include documentation/comments, must be secure-by-default. Difficulty: medium. Assume PII must be protected.
Output: engineering-grade answer with edge cases covered. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000050
architecture_refactor
medium
Refactor an existing codebase in social media to support analytics pipeline cleanly. Target platform: mobile (Android Kotlin). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include tests, must be secure-by-default, must include documentation/comments. Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: actionable implementation and verification artifacts. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000051
architecture_refactor
easy
Refactor an existing codebase in gaming to support caching cleanly. Target platform: ML (PyTorch + serving). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include tests, must include clear error handling, must be performant under load, must be secure-by-default. Difficulty: easy. Assume schema evolves frequently; design for migrations.
Output: actionable implementation and verification artifacts. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000052
architecture_refactor
easy
Refactor an existing codebase in healthtech to support background jobs cleanly. Target platform: data (SQL + Python). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include clear error handling, must avoid global state, must include documentation/comments, must be secure-by-default, must be observable (logs/metrics/traces). Difficulty: easy. Assume schema evolves frequently; design for migrations.
Output: engineering-grade answer with edge cases covered. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000053
architecture_refactor
medium
Refactor an existing codebase in customer support to support audit logs cleanly. Target platform: data (SQL + Python). Requirements: propose new modules/layers, dependency boundaries, and migration plan. Constraints: must include type hints where applicable, must be observable (logs/metrics/traces), must be performant under load, must be production-ready. Difficulty: medium. Include rollback strategy.
Output: actionable implementation and verification artifacts. Deliverable: refactor plan + module boundaries. **Proposed modules** - `domain/` pure business logic (no I/O) - `adapters/` DB, cache, external APIs - `api/` request/response validation and routing - `observability/` logging/metrics/tracing - `tests/` unit + integration suites **Migration plan** 1. Introduce new interfaces + adapters behind feature flags. 2. Dual-write or read-compat layer if schema changes. 3. Incremental cutover; deprecate legacy module. Key rule: dependencies flow inward; domain has no framework imports. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "refactor", "clean-architecture" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000054
code_review
easy
Perform a code review for a enterprise SaaS PR implementing file uploads. Target platform: infra (Docker + Kubernetes). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must include clear error handling, must include documentation/comments, must be easy to extend, must include type hints where applicable, must include tests. Difficulty: easy. Assume GDPR-style deletion requests must be supported.
Output: engineering-grade answer with edge cases covered. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000055
code_review
hard
Perform a code review for a education PR implementing background jobs. Target platform: data (SQL + Python). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must be secure-by-default, must include tests, must be observable (logs/metrics/traces), must include type hints where applicable, must avoid global state. Difficulty: hard. Assume PII must be protected.
Output: design + implementation guidance suitable for shipping. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000056
code_review
medium
Perform a code review for a fintech PR implementing webhooks. Target platform: backend (Python FastAPI). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must avoid global state, must include documentation/comments, must include type hints where applicable, must be performant under load. Difficulty: medium. Assume mobile clients are occasionally offline.
Output: production-oriented blueprint with code where appropriate. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000057
code_review
expert
Perform a code review for a content moderation PR implementing role-based access control. Target platform: data (SQL + Python). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must include tests, must include documentation/comments, must be observable (logs/metrics/traces), must be easy to extend. Difficulty: expert. Assume schema evolves frequently; design for migrations.
Output: production-oriented blueprint with code where appropriate. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000058
code_review
easy
Perform a code review for a customer support PR implementing real-time notifications. Target platform: backend (Python FastAPI). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must include type hints where applicable, must be secure-by-default, must be production-ready, must avoid global state. Difficulty: easy. Assume GDPR-style deletion requests must be supported.
Output: production-oriented blueprint with code where appropriate. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000059
code_review
hard
Perform a code review for a content moderation PR implementing search + pagination. Target platform: backend (Go). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must be production-ready, must be performant under load, must include clear error handling. Difficulty: hard. Include rollback strategy.
Output: engineering-grade answer with edge cases covered. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000060
code_review
expert
Perform a code review for a gaming PR implementing idempotent payments. Target platform: backend (Node.js). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must be observable (logs/metrics/traces), must avoid global state, must be secure-by-default. Difficulty: expert. Assume GDPR-style deletion requests must be supported.
Output: production-oriented blueprint with code where appropriate. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000061
code_review
medium
Perform a code review for a fraud detection PR implementing event-driven workflows. Target platform: CI (GitHub Actions). Requirements: list critical issues, improvements, and provide an improved patch excerpt. Constraints: must include documentation/comments, must be secure-by-default, must avoid global state, must be easy to extend, must be observable (logs/metrics/traces). Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: actionable implementation and verification artifacts. Deliverable: code review findings + improved patch excerpt. **Critical issues** 1. Missing input validation at boundary; potential unexpected exceptions. 2. No idempotency / retry safety for side-effecting endpoint. 3. No tests for edge cases (empty input, duplicates, timeouts). 4. Observability gaps: no request_id correlation, no metrics. **Improvements** - Add strict validation and explicit error responses. - Add idempotency key support for create endpoints. - Add unit + integration tests with CI gating. - Add structured logs and basic metrics. Patch excerpt (illustrative): ```python if not idem_key: raise HTTPException(400, "Missing Idempotency-Key") ``` Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "review", "best-practices" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000062
devops_ci_cd
easy
Design CI/CD for a IoT telemetry service delivering webhooks. Target platform: ML (scikit + batch). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must be performant under load, must be production-ready, must include tests, must be secure-by-default, must include type hints where applicable. Difficulty: easy. Assume PII must be protected.
Output: production-oriented blueprint with code where appropriate. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000063
devops_ci_cd
expert
Design CI/CD for a social media service delivering multi-tenant isolation. Target platform: data (SQL + Python). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must be easy to extend, must include documentation/comments, must include tests. Difficulty: expert. Assume mobile clients are occasionally offline.
Output: design + implementation guidance suitable for shipping. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000064
devops_ci_cd
medium
Design CI/CD for a fintech service delivering file uploads. Target platform: web (React + TypeScript). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must include type hints where applicable, must include documentation/comments, must include tests, must be secure-by-default, must include clear error handling. Difficulty: medium. Assume strict latency budget (p95 < 200ms).
Output: production-oriented blueprint with code where appropriate. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000065
devops_ci_cd
easy
Design CI/CD for a enterprise SaaS service delivering A/B experimentation. Target platform: CI (GitHub Actions). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must be secure-by-default, must include type hints where applicable, must be easy to extend, must include clear error handling. Difficulty: easy. Assume PII must be protected.
Output: engineering-grade answer with edge cases covered. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000066
devops_ci_cd
medium
Design CI/CD for a IoT telemetry service delivering audit logs. Target platform: mobile (iOS Swift). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must be performant under load, must include clear error handling, must be production-ready. Difficulty: medium. Assume 10k RPS peak traffic.
Output: design + implementation guidance suitable for shipping. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000067
devops_ci_cd
easy
Design CI/CD for a calendar/scheduling service delivering rate limiting. Target platform: backend (Python FastAPI). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must be observable (logs/metrics/traces), must avoid global state, must be secure-by-default. Difficulty: easy. Assume untrusted input; validate everything.
Output: design + implementation guidance suitable for shipping. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000068
devops_ci_cd
expert
Design CI/CD for a education service delivering analytics pipeline. Target platform: web (React + TypeScript). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must be production-ready, must be secure-by-default, must be observable (logs/metrics/traces), must be easy to extend, must avoid global state. Difficulty: expert. Assume strict latency budget (p95 < 200ms).
Output: design + implementation guidance suitable for shipping. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000069
devops_ci_cd
easy
Design CI/CD for a developer tooling service delivering A/B experimentation. Target platform: ML (scikit + batch). Requirements: pipelines, checks, artifact strategy, deployments, and rollbacks. Constraints: must include type hints where applicable, must be secure-by-default, must include clear error handling, must include documentation/comments. Difficulty: easy. Assume schema evolves frequently; design for migrations.
Output: engineering-grade answer with edge cases covered. Deliverable: CI/CD pipeline (GitHub Actions) with quality gates. ```yaml name: ci on: pull_request: push: branches: [main] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.11" - run: python -m pip install -U pip - run: pip install -r requirements.txt - run: pip install -r requirements-dev.txt - run: ruff check . - run: mypy . - run: pytest -q --maxfail=1 --disable-warnings docker: needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - run: docker build -t app:${{ github.sha }} . ``` Deployment strategy: - main β†’ build β†’ deploy to staging β†’ smoke tests β†’ canary to prod. - Rollback: redeploy previous image + DB migration rollback plan. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "cicd", "automation" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000070
cloud_infra
easy
Provision infrastructure for a IoT telemetry workload providing real-time notifications. Target platform: backend (Go). Requirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling. Constraints: must avoid global state, must include clear error handling, must include documentation/comments. Difficulty: easy. Assume 10k RPS peak traffic.
Output: production-oriented blueprint with code where appropriate. Deliverable: Kubernetes deployment + basic security posture. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: app spec: replicas: 3 selector: matchLabels: { app: app } template: metadata: labels: { app: app } spec: containers: - name: app image: app:latest ports: [{ containerPort: 8080 }] readinessProbe: httpGet: { path: /healthz, port: 8080 } resources: requests: { cpu: "200m", memory: "256Mi" } limits: { cpu: "1", memory: "1Gi" } ``` Additions: - NetworkPolicy to restrict egress/ingress. - Secrets via external secret store; rotate regularly. - HPA for autoscaling; PodDisruptionBudget for availability. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "infra", "cloud" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000071
cloud_infra
expert
Provision infrastructure for a enterprise SaaS workload providing idempotent payments. Target platform: mobile (Android Kotlin). Requirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling. Constraints: must include tests, must be secure-by-default, must include documentation/comments. Difficulty: expert. Assume PII must be protected.
Output: design + implementation guidance suitable for shipping. Deliverable: Kubernetes deployment + basic security posture. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: app spec: replicas: 3 selector: matchLabels: { app: app } template: metadata: labels: { app: app } spec: containers: - name: app image: app:latest ports: [{ containerPort: 8080 }] readinessProbe: httpGet: { path: /healthz, port: 8080 } resources: requests: { cpu: "200m", memory: "256Mi" } limits: { cpu: "1", memory: "1Gi" } ``` Additions: - NetworkPolicy to restrict egress/ingress. - Secrets via external secret store; rotate regularly. - HPA for autoscaling; PodDisruptionBudget for availability. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "infra", "cloud" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000072
cloud_infra
expert
Provision infrastructure for a customer support workload providing analytics pipeline. Target platform: backend (Node.js). Requirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling. Constraints: must include type hints where applicable, must include tests, must be easy to extend, must avoid global state, must include documentation/comments. Difficulty: expert. Assume untrusted input; validate everything.
Output: engineering-grade answer with edge cases covered. Deliverable: Kubernetes deployment + basic security posture. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: app spec: replicas: 3 selector: matchLabels: { app: app } template: metadata: labels: { app: app } spec: containers: - name: app image: app:latest ports: [{ containerPort: 8080 }] readinessProbe: httpGet: { path: /healthz, port: 8080 } resources: requests: { cpu: "200m", memory: "256Mi" } limits: { cpu: "1", memory: "1Gi" } ``` Additions: - NetworkPolicy to restrict egress/ingress. - Secrets via external secret store; rotate regularly. - HPA for autoscaling; PodDisruptionBudget for availability. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "infra", "cloud" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000073
cloud_infra
medium
Provision infrastructure for a fraud detection workload providing caching. Target platform: data (SQL + Python). Requirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling. Constraints: must be secure-by-default, must include clear error handling, must include tests, must avoid global state, must be performant under load. Difficulty: medium. Assume untrusted input; validate everything.
Output: design + implementation guidance suitable for shipping. Deliverable: Kubernetes deployment + basic security posture. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: app spec: replicas: 3 selector: matchLabels: { app: app } template: metadata: labels: { app: app } spec: containers: - name: app image: app:latest ports: [{ containerPort: 8080 }] readinessProbe: httpGet: { path: /healthz, port: 8080 } resources: requests: { cpu: "200m", memory: "256Mi" } limits: { cpu: "1", memory: "1Gi" } ``` Additions: - NetworkPolicy to restrict egress/ingress. - Secrets via external secret store; rotate regularly. - HPA for autoscaling; PodDisruptionBudget for availability. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "infra", "cloud" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000074
cloud_infra
easy
Provision infrastructure for a content moderation workload providing file uploads. Target platform: backend (Go). Requirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling. Constraints: must be production-ready, must be easy to extend, must be secure-by-default. Difficulty: easy. Assume GDPR-style deletion requests must be supported.
Output: actionable implementation and verification artifacts. Deliverable: Kubernetes deployment + basic security posture. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: app spec: replicas: 3 selector: matchLabels: { app: app } template: metadata: labels: { app: app } spec: containers: - name: app image: app:latest ports: [{ containerPort: 8080 }] readinessProbe: httpGet: { path: /healthz, port: 8080 } resources: requests: { cpu: "200m", memory: "256Mi" } limits: { cpu: "1", memory: "1Gi" } ``` Additions: - NetworkPolicy to restrict egress/ingress. - Secrets via external secret store; rotate regularly. - HPA for autoscaling; PodDisruptionBudget for availability. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "infra", "cloud" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000075
cloud_infra
expert
Provision infrastructure for a e-commerce workload providing multi-tenant isolation. Target platform: ML (scikit + batch). Requirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling. Constraints: must be performant under load, must include clear error handling, must avoid global state. Difficulty: expert. Assume untrusted input; validate everything.
Output: production-oriented blueprint with code where appropriate. Deliverable: Kubernetes deployment + basic security posture. ```yaml apiVersion: apps/v1 kind: Deployment metadata: name: app spec: replicas: 3 selector: matchLabels: { app: app } template: metadata: labels: { app: app } spec: containers: - name: app image: app:latest ports: [{ containerPort: 8080 }] readinessProbe: httpGet: { path: /healthz, port: 8080 } resources: requests: { cpu: "200m", memory: "256Mi" } limits: { cpu: "1", memory: "1Gi" } ``` Additions: - NetworkPolicy to restrict egress/ingress. - Secrets via external secret store; rotate regularly. - HPA for autoscaling; PodDisruptionBudget for availability. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "infra", "cloud" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000076
data_engineering
hard
Build a data pipeline for a calendar/scheduling product around analytics pipeline. Target platform: data (SQL + Python). Requirements: schema, ingestion, validation, backfills, and tests. Constraints: must be secure-by-default, must be performant under load, must include type hints where applicable, must be observable (logs/metrics/traces). Difficulty: hard. Assume strict latency budget (p95 < 200ms).
Output: engineering-grade answer with edge cases covered. Deliverable: schema + ingestion + validation + backfill strategy. **Schema (example)** - events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB) **Ingestion** - Write to raw table first; validate; then materialize to curated tables. - Idempotency by event_id; enforce uniqueness. **Validation** - Reject missing tenant_id/type/ts. - Quarantine bad records with reason. **Backfills** - Re-run deterministic transforms from raw β†’ curated. - Version transformations; store transform_version with outputs. **Tests** - Unit tests for validators and transforms. - Integration test: sample raw batch produces expected curated rows. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "data", "etl" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000077
data_engineering
expert
Build a data pipeline for a social media product around file uploads. Target platform: data (SQL + Python). Requirements: schema, ingestion, validation, backfills, and tests. Constraints: must be performant under load, must be secure-by-default, must include clear error handling, must be observable (logs/metrics/traces). Difficulty: expert. Assume GDPR-style deletion requests must be supported.
Output: production-oriented blueprint with code where appropriate. Deliverable: schema + ingestion + validation + backfill strategy. **Schema (example)** - events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB) **Ingestion** - Write to raw table first; validate; then materialize to curated tables. - Idempotency by event_id; enforce uniqueness. **Validation** - Reject missing tenant_id/type/ts. - Quarantine bad records with reason. **Backfills** - Re-run deterministic transforms from raw β†’ curated. - Version transformations; store transform_version with outputs. **Tests** - Unit tests for validators and transforms. - Integration test: sample raw batch produces expected curated rows. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "data", "etl" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000078
data_engineering
easy
Build a data pipeline for a education product around analytics pipeline. Target platform: data (SQL + Python). Requirements: schema, ingestion, validation, backfills, and tests. Constraints: must be observable (logs/metrics/traces), must avoid global state, must be secure-by-default. Difficulty: easy. Include rollback strategy.
Output: engineering-grade answer with edge cases covered. Deliverable: schema + ingestion + validation + backfill strategy. **Schema (example)** - events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB) **Ingestion** - Write to raw table first; validate; then materialize to curated tables. - Idempotency by event_id; enforce uniqueness. **Validation** - Reject missing tenant_id/type/ts. - Quarantine bad records with reason. **Backfills** - Re-run deterministic transforms from raw β†’ curated. - Version transformations; store transform_version with outputs. **Tests** - Unit tests for validators and transforms. - Integration test: sample raw batch produces expected curated rows. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "data", "etl" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000079
data_engineering
expert
Build a data pipeline for a customer support product around event-driven workflows. Target platform: data (SQL + Python). Requirements: schema, ingestion, validation, backfills, and tests. Constraints: must be observable (logs/metrics/traces), must include clear error handling, must be performant under load, must be easy to extend. Difficulty: expert. Assume untrusted input; validate everything.
Output: engineering-grade answer with edge cases covered. Deliverable: schema + ingestion + validation + backfill strategy. **Schema (example)** - events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB) **Ingestion** - Write to raw table first; validate; then materialize to curated tables. - Idempotency by event_id; enforce uniqueness. **Validation** - Reject missing tenant_id/type/ts. - Quarantine bad records with reason. **Backfills** - Re-run deterministic transforms from raw β†’ curated. - Version transformations; store transform_version with outputs. **Tests** - Unit tests for validators and transforms. - Integration test: sample raw batch produces expected curated rows. Hard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.
{ "tags": [ "software-engineering", "data", "etl" ], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227 }
devgod_000080
data_engineering
easy
Build a data pipeline for a IoT telemetry product around rate limiting. Target platform: data (SQL + Python). Requirements: schema, ingestion, validation, backfills, and tests. Constraints: must be observable (logs/metrics/traces), must be secure-by-default, must be easy to extend, must include tests. Difficulty: easy. Assume mobile clients are occasionally offline.
Output: design + implementation guidance suitable for shipping. Deliverable: schema + ingestion + validation + backfill strategy. **Schema (example)** - events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB) **Ingestion** - Write to raw table first; validate; then materialize to curated tables. - Idempotency by event_id; enforce uniqueness. **Validation** - Reject missing tenant_id/type/ts. - Quarantine bad records with reason. **Backfills** - Re-run deterministic transforms from raw β†’ curated. - Version transformations; store transform_version with outputs. **Tests** - Unit tests for validators and transforms. - Integration test: sample raw batch produces expected curated rows. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "data", "etl" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000081
data_engineering
easy
Build a data pipeline for a customer support product around idempotent payments. Target platform: data (SQL + Python). Requirements: schema, ingestion, validation, backfills, and tests. Constraints: must avoid global state, must be performant under load, must be secure-by-default. Difficulty: easy. Assume strict latency budget (p95 < 200ms).
Output: production-oriented blueprint with code where appropriate. Deliverable: schema + ingestion + validation + backfill strategy. **Schema (example)** - events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB) **Ingestion** - Write to raw table first; validate; then materialize to curated tables. - Idempotency by event_id; enforce uniqueness. **Validation** - Reject missing tenant_id/type/ts. - Quarantine bad records with reason. **Backfills** - Re-run deterministic transforms from raw β†’ curated. - Version transformations; store transform_version with outputs. **Tests** - Unit tests for validators and transforms. - Integration test: sample raw batch produces expected curated rows. Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "data", "etl" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000082
ml_engineering
easy
Implement an ML engineering workflow for content moderation focusing on real-time notifications. Target platform: ML (training + serving). Requirements: data contract, training loop, evaluation, model registry, serving API, monitoring. Constraints: must be easy to extend, must avoid global state, must be performant under load, must include tests, must include clear error handling. Difficulty: easy. Assume 10k RPS peak traffic.
Output: design + implementation guidance suitable for shipping. Deliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented. **Data contract** - Define feature schema + ranges; validate at training and serving. **Training** - Deterministic split; baseline model; track metrics (AUC/F1/latency). - Store artifacts: model, config, feature stats. **Registry** - Promote models via approval gates; record lineage. **Serving** - Separate inference service with `/predict`. - Input validation + default handling; timeouts. **Monitoring** - Data drift: feature distribution checks. - Performance: online metrics + periodic labels; alert on regression. Minimal serving skeleton (FastAPI-ish): ```python # validate input -> vectorize -> model.predict_proba -> return ``` Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "mlops", "serving" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
devgod_000083
ml_engineering
easy
Implement an ML engineering workflow for enterprise SaaS focusing on idempotent payments. Target platform: ML (training + serving). Requirements: data contract, training loop, evaluation, model registry, serving API, monitoring. Constraints: must be secure-by-default, must be easy to extend, must be performant under load. Difficulty: easy. Assume schema evolves frequently; design for migrations.
Output: production-oriented blueprint with code where appropriate. Deliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented. **Data contract** - Define feature schema + ranges; validate at training and serving. **Training** - Deterministic split; baseline model; track metrics (AUC/F1/latency). - Store artifacts: model, config, feature stats. **Registry** - Promote models via approval gates; record lineage. **Serving** - Separate inference service with `/predict`. - Input validation + default handling; timeouts. **Monitoring** - Data drift: feature distribution checks. - Performance: online metrics + periodic labels; alert on regression. Minimal serving skeleton (FastAPI-ish): ```python # validate input -> vectorize -> model.predict_proba -> return ``` Checks: input validation, tests, and safe defaults included.
{ "tags": [ "software-engineering", "mlops", "serving" ], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227 }
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
7