diff --git "a/devgod_100k_sample_100.jsonl" "b/devgod_100k_sample_100.jsonl" new file mode 100644--- /dev/null +++ "b/devgod_100k_sample_100.jsonl" @@ -0,0 +1,100 @@ +{"id": "devgod_000001", "task_type": "code_generation", "difficulty": "expert", "prompt": "Implement offline-first sync for a IoT telemetry product.\nTarget platform: ML (PyTorch + serving).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include type hints where applicable, must be observable (logs/metrics/traces), must include documentation/comments.\nDifficulty: expert. Assume 10k RPS peak traffic.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000002", "task_type": "code_generation", "difficulty": "medium", "prompt": "Implement offline-first sync for a gaming product.\nTarget platform: ML (PyTorch + serving).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include clear error handling, must include documentation/comments, must be observable (logs/metrics/traces).\nDifficulty: medium. Assume mobile clients are occasionally offline.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000003", "task_type": "code_generation", "difficulty": "expert", "prompt": "Implement real-time notifications for a gaming product.\nTarget platform: backend (Go).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include documentation/comments, must be secure-by-default, must be performant under load, must be production-ready, must include type hints where applicable.\nDifficulty: expert. Assume GDPR-style deletion requests must be supported.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000004", "task_type": "code_generation", "difficulty": "medium", "prompt": "Implement file uploads for a calendar/scheduling product.\nTarget platform: infra (Terraform).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include clear error handling, must be performant under load, must include type hints where applicable, must be secure-by-default.\nDifficulty: medium. Assume 10k RPS peak traffic.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000005", "task_type": "code_generation", "difficulty": "expert", "prompt": "Implement multi-tenant isolation for a IoT telemetry product.\nTarget platform: backend (Python FastAPI).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include type hints where applicable, must be secure-by-default, must include tests.\nDifficulty: expert. Assume GDPR-style deletion requests must be supported.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000006", "task_type": "code_generation", "difficulty": "expert", "prompt": "Implement caching for a calendar/scheduling product.\nTarget platform: ML (PyTorch + serving).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must be secure-by-default, must include tests, must be performant under load, must be easy to extend, must be observable (logs/metrics/traces).\nDifficulty: expert. Assume strict latency budget (p95 < 200ms).", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000007", "task_type": "code_generation", "difficulty": "easy", "prompt": "Implement audit logs for a calendar/scheduling product.\nTarget platform: CI (GitHub Actions).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must avoid global state, must include clear error handling, must be performant under load, must include tests.\nDifficulty: easy. Include rollback strategy.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000008", "task_type": "code_generation", "difficulty": "medium", "prompt": "Implement offline-first sync for a healthtech product.\nTarget platform: ML (PyTorch + serving).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must be easy to extend, must include tests, must be observable (logs/metrics/traces), must include type hints where applicable.\nDifficulty: medium. Assume PII must be protected.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000009", "task_type": "code_generation", "difficulty": "expert", "prompt": "Implement A/B experimentation for a social media product.\nTarget platform: backend (Node.js).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must be observable (logs/metrics/traces), must include documentation/comments, must include tests, must be secure-by-default.\nDifficulty: expert. Include rollback strategy.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000010", "task_type": "code_generation", "difficulty": "medium", "prompt": "Implement multi-tenant isolation for a logistics product.\nTarget platform: web (React + TypeScript).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must be observable (logs/metrics/traces), must include tests, must be production-ready, must avoid global state, must be performant under load.\nDifficulty: medium. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000011", "task_type": "code_generation", "difficulty": "expert", "prompt": "Implement multi-tenant isolation for a content moderation product.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include clear error handling, must be performant under load, must include documentation/comments, must avoid global state.\nDifficulty: expert. Assume PII must be protected.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000012", "task_type": "code_generation", "difficulty": "medium", "prompt": "Implement real-time notifications for a fraud detection product.\nTarget platform: mobile (iOS Swift).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must avoid global state, must be secure-by-default, must be production-ready.\nDifficulty: medium. Assume untrusted input; validate everything.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000013", "task_type": "code_generation", "difficulty": "hard", "prompt": "Implement analytics pipeline for a healthtech product.\nTarget platform: data (SQL + Python).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include tests, must be observable (logs/metrics/traces), must avoid global state, must be easy to extend, must be secure-by-default.\nDifficulty: hard. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000014", "task_type": "bugfix_debugging", "difficulty": "easy", "prompt": "Debug and fix a subtle production bug related to search + pagination in a developer tooling service.\nTarget platform: ML (scikit + batch).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be performant under load, must be observable (logs/metrics/traces), must be easy to extend, must avoid global state, must be secure-by-default.\nDifficulty: easy. Assume untrusted input; validate everything.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000015", "task_type": "bugfix_debugging", "difficulty": "medium", "prompt": "Debug and fix a subtle production bug related to background jobs in a content moderation service.\nTarget platform: backend (Node.js).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must avoid global state, must be secure-by-default, must be observable (logs/metrics/traces).\nDifficulty: medium. Assume schema evolves frequently; design for migrations.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000016", "task_type": "bugfix_debugging", "difficulty": "easy", "prompt": "Debug and fix a subtle production bug related to idempotent payments in a enterprise SaaS service.\nTarget platform: mobile (Android Kotlin).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be observable (logs/metrics/traces), must be production-ready, must include tests, must be easy to extend.\nDifficulty: easy. Assume PII must be protected.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000017", "task_type": "bugfix_debugging", "difficulty": "medium", "prompt": "Debug and fix a subtle production bug related to caching in a IoT telemetry service.\nTarget platform: backend (Go).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be observable (logs/metrics/traces), must include tests, must be easy to extend, must avoid global state, must include clear error handling.\nDifficulty: medium. Assume 10k RPS peak traffic.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000018", "task_type": "bugfix_debugging", "difficulty": "medium", "prompt": "Debug and fix a subtle production bug related to idempotent payments in a e-commerce service.\nTarget platform: ML (PyTorch + serving).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must avoid global state, must include type hints where applicable, must include tests, must be observable (logs/metrics/traces), must be performant under load.\nDifficulty: medium. Assume mobile clients are occasionally offline.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000019", "task_type": "bugfix_debugging", "difficulty": "expert", "prompt": "Debug and fix a subtle production bug related to real-time notifications in a social media service.\nTarget platform: CI (GitHub Actions).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must include documentation/comments, must be easy to extend, must avoid global state, must be performant under load, must be observable (logs/metrics/traces).\nDifficulty: expert. Assume 10k RPS peak traffic.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000020", "task_type": "bugfix_debugging", "difficulty": "medium", "prompt": "Debug and fix a subtle production bug related to A/B experimentation in a calendar/scheduling service.\nTarget platform: backend (Go).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be secure-by-default, must include type hints where applicable, must avoid global state, must include clear error handling, must be observable (logs/metrics/traces).\nDifficulty: medium. Assume GDPR-style deletion requests must be supported.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000021", "task_type": "bugfix_debugging", "difficulty": "easy", "prompt": "Debug and fix a subtle production bug related to offline-first sync in a content moderation service.\nTarget platform: mobile (iOS Swift).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must include documentation/comments, must be secure-by-default, must avoid global state.\nDifficulty: easy. Assume GDPR-style deletion requests must be supported.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000022", "task_type": "bugfix_debugging", "difficulty": "hard", "prompt": "Debug and fix a subtle production bug related to file uploads in a social media service.\nTarget platform: backend (Go).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be secure-by-default, must be easy to extend, must be performant under load, must be production-ready.\nDifficulty: hard. Assume strict latency budget (p95 < 200ms).", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000023", "task_type": "bugfix_debugging", "difficulty": "medium", "prompt": "Debug and fix a subtle production bug related to analytics pipeline in a calendar/scheduling service.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be production-ready, must be observable (logs/metrics/traces), must include type hints where applicable, must be easy to extend.\nDifficulty: medium. Assume untrusted input; validate everything.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000024", "task_type": "bugfix_debugging", "difficulty": "easy", "prompt": "Debug and fix a subtle production bug related to role-based access control in a social media service.\nTarget platform: CI (GitHub Actions).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must be production-ready, must include clear error handling, must include tests.\nDifficulty: easy. Assume strict latency budget (p95 < 200ms).", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000025", "task_type": "bugfix_debugging", "difficulty": "hard", "prompt": "Debug and fix a subtle production bug related to file uploads in a document processing service.\nTarget platform: infra (Terraform).\nRequirements: identify root cause, provide patch, and add regression tests.\nConstraints: must include type hints where applicable, must be performant under load, must be observable (logs/metrics/traces).\nDifficulty: hard. Assume mobile clients are occasionally offline.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "debugging", "root-cause"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000026", "task_type": "testing_qa", "difficulty": "expert", "prompt": "Create a comprehensive test plan and automated tests for background jobs in a healthtech product.\nTarget platform: mobile (iOS Swift).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must include type hints where applicable, must be secure-by-default, must be performant under load.\nDifficulty: expert. Assume PII must be protected.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000027", "task_type": "testing_qa", "difficulty": "hard", "prompt": "Create a comprehensive test plan and automated tests for idempotent payments in a gaming product.\nTarget platform: web (React + TypeScript).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must be secure-by-default, must include documentation/comments, must be easy to extend.\nDifficulty: hard. Assume mobile clients are occasionally offline.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000028", "task_type": "testing_qa", "difficulty": "easy", "prompt": "Create a comprehensive test plan and automated tests for A/B experimentation in a developer tooling product.\nTarget platform: infra (Terraform).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must include type hints where applicable, must include documentation/comments, must include clear error handling.\nDifficulty: easy. Assume PII must be protected.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000029", "task_type": "testing_qa", "difficulty": "expert", "prompt": "Create a comprehensive test plan and automated tests for search + pagination in a gaming product.\nTarget platform: backend (Python FastAPI).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must be secure-by-default, must avoid global state, must be production-ready, must include type hints where applicable, must be easy to extend.\nDifficulty: expert. Assume PII must be protected.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000030", "task_type": "testing_qa", "difficulty": "medium", "prompt": "Create a comprehensive test plan and automated tests for audit logs in a document processing product.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must avoid global state, must include clear error handling, must be production-ready, must include documentation/comments, must be easy to extend.\nDifficulty: medium. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000031", "task_type": "testing_qa", "difficulty": "easy", "prompt": "Create a comprehensive test plan and automated tests for audit logs in a customer support product.\nTarget platform: mobile (iOS Swift).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must include documentation/comments, must be performant under load, must include tests, must avoid global state, must be secure-by-default.\nDifficulty: easy. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000032", "task_type": "testing_qa", "difficulty": "hard", "prompt": "Create a comprehensive test plan and automated tests for search + pagination in a enterprise SaaS product.\nTarget platform: backend (Node.js).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must be performant under load, must avoid global state, must be observable (logs/metrics/traces), must be secure-by-default.\nDifficulty: hard. Assume PII must be protected.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000033", "task_type": "testing_qa", "difficulty": "hard", "prompt": "Create a comprehensive test plan and automated tests for caching in a social media product.\nTarget platform: ML (scikit + batch).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must be production-ready, must include documentation/comments, must be secure-by-default, must include type hints where applicable, must be easy to extend.\nDifficulty: hard. Assume 10k RPS peak traffic.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000034", "task_type": "testing_qa", "difficulty": "expert", "prompt": "Create a comprehensive test plan and automated tests for background jobs in a calendar/scheduling product.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must be observable (logs/metrics/traces), must be secure-by-default, must include documentation/comments.\nDifficulty: expert. Assume untrusted input; validate everything.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000035", "task_type": "testing_qa", "difficulty": "expert", "prompt": "Create a comprehensive test plan and automated tests for background jobs in a logistics product.\nTarget platform: data (SQL + Python).\nRequirements: unit/integration tests, edge cases, load tests strategy, and CI gates.\nConstraints: must include clear error handling, must include type hints where applicable, must be performant under load, must be observable (logs/metrics/traces).\nDifficulty: expert. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: test plan + automation guidance.\n\n**Unit tests**\n- Validation: malformed payloads rejected with correct codes.\n- AuthZ: tenant boundary enforced.\n- Idempotency: replay returns same response; conflicting reuse yields 409.\n\n**Integration tests**\n- DB transaction behavior; unique constraints.\n- Cache behavior: correctness under concurrent requests.\n\n**Load tests**\n- 10k RPS target: measure p95 latency, error rate, saturation.\n\n**CI gates**\n- Lint + typecheck + unit tests required.\n- Coverage threshold for critical modules.\n- Block merge on flaky test detection.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "testing", "qa"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000036", "task_type": "system_design", "difficulty": "expert", "prompt": "Design a production system for customer support supporting real-time notifications.\nTarget platform: CI (GitHub Actions).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must be performant under load, must include documentation/comments, must be secure-by-default, must avoid global state, must include tests.\nDifficulty: expert. Assume untrusted input; validate everything.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000037", "task_type": "system_design", "difficulty": "hard", "prompt": "Design a production system for IoT telemetry supporting audit logs.\nTarget platform: ML (scikit + batch).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must be production-ready, must avoid global state, must include documentation/comments, must include type hints where applicable, must be easy to extend.\nDifficulty: hard. Assume untrusted input; validate everything.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000038", "task_type": "system_design", "difficulty": "medium", "prompt": "Design a production system for document processing supporting rate limiting.\nTarget platform: mobile (Android Kotlin).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must include type hints where applicable, must be observable (logs/metrics/traces), must be secure-by-default, must be production-ready.\nDifficulty: medium. Assume schema evolves frequently; design for migrations.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000039", "task_type": "system_design", "difficulty": "hard", "prompt": "Design a production system for social media supporting webhooks.\nTarget platform: ML (PyTorch + serving).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must be easy to extend, must avoid global state, must include type hints where applicable, must be observable (logs/metrics/traces), must be performant under load.\nDifficulty: hard. Include rollback strategy.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000040", "task_type": "system_design", "difficulty": "hard", "prompt": "Design a production system for gaming supporting rate limiting.\nTarget platform: ML (scikit + batch).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must be easy to extend, must include clear error handling, must include documentation/comments, must be performant under load, must be secure-by-default.\nDifficulty: hard. Assume PII must be protected.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000041", "task_type": "system_design", "difficulty": "expert", "prompt": "Design a production system for e-commerce supporting audit logs.\nTarget platform: backend (Python FastAPI).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must be performant under load, must be production-ready, must include type hints where applicable, must be observable (logs/metrics/traces), must include documentation/comments.\nDifficulty: expert. Assume GDPR-style deletion requests must be supported.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000042", "task_type": "system_design", "difficulty": "expert", "prompt": "Design a production system for enterprise SaaS supporting audit logs.\nTarget platform: backend (Go).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must include clear error handling, must be easy to extend, must avoid global state.\nDifficulty: expert. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000043", "task_type": "system_design", "difficulty": "medium", "prompt": "Design a production system for content moderation supporting search + pagination.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must avoid global state, must be performant under load, must be production-ready, must be secure-by-default, must include clear error handling.\nDifficulty: medium. Assume schema evolves frequently; design for migrations.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000044", "task_type": "system_design", "difficulty": "easy", "prompt": "Design a production system for social media supporting event-driven workflows.\nTarget platform: mobile (iOS Swift).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must be performant under load, must include tests, must be observable (logs/metrics/traces), must include clear error handling, must be production-ready.\nDifficulty: easy. Assume strict latency budget (p95 < 200ms).", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000045", "task_type": "system_design", "difficulty": "easy", "prompt": "Design a production system for education supporting rate limiting.\nTarget platform: web (React + TypeScript).\nRequirements: APIs, data model, scaling strategy, failure modes, and security.\nConstraints: must include type hints where applicable, must include tests, must be observable (logs/metrics/traces), must avoid global state.\nDifficulty: easy. Include rollback strategy.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: system design with APIs, data model, and operational plan.\n\n**High-level architecture**\n- Edge: API Gateway + WAF\n- Core service: stateless app pods behind L7 LB\n- Data: Postgres (primary), Redis (cache + rate limit tokens), Object storage (uploads if needed)\n- Async: message queue (e.g., SQS/Rabbit) + worker pool for background jobs\n- Observability: structured logs + metrics + tracing\n\n**APIs (example)**\n- `POST /v1/{resource}` create (idempotent via `Idempotency-Key`)\n- `GET /v1/{resource}/{id}` read\n- `POST /v1/{resource}/{id}:action` command endpoint when side effects exist\n\n**Data model (Postgres)**\n- `resources(id UUID PK, tenant_id UUID, status TEXT, payload JSONB, created_at, updated_at)`\n- Unique constraint for idempotency: `(tenant_id, idempotency_key)` in a separate table:\n - `idempotency(tenant_id, key TEXT, request_hash TEXT, response JSONB, created_at, PRIMARY KEY(tenant_id,key))`\n\n**Scaling**\n- App layer scales horizontally; keep sessions out of process.\n- Cache reads in Redis; write-through invalidation on mutations.\n- Use connection pooling; consider read replicas for heavy reads.\n\n**Failure modes**\n- Retries: only for safe/ idempotent operations; exponential backoff + jitter.\n- Partial failures: background jobs must be idempotent; use a de-dup key.\n\n**Security**\n- AuthN: JWT/OIDC; AuthZ: RBAC/ABAC with tenant isolation\n- Validate all inputs; enforce per-tenant quotas/rate limits.\n\n**Rollout**\n- Dark launch + feature flags; canary; rapid rollback by toggling flags.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "architecture", "scalability"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000046", "task_type": "architecture_refactor", "difficulty": "medium", "prompt": "Refactor an existing codebase in enterprise SaaS to support search + pagination cleanly.\nTarget platform: mobile (iOS Swift).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must include clear error handling, must avoid global state, must include tests.\nDifficulty: medium. Assume PII must be protected.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000047", "task_type": "architecture_refactor", "difficulty": "expert", "prompt": "Refactor an existing codebase in gaming to support background jobs cleanly.\nTarget platform: backend (Go).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must be easy to extend, must be production-ready, must be performant under load, must include type hints where applicable.\nDifficulty: expert. Assume schema evolves frequently; design for migrations.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000048", "task_type": "architecture_refactor", "difficulty": "easy", "prompt": "Refactor an existing codebase in healthtech to support real-time notifications cleanly.\nTarget platform: mobile (Android Kotlin).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must include clear error handling, must be performant under load, must include type hints where applicable, must be easy to extend.\nDifficulty: easy. Include rollback strategy.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000049", "task_type": "architecture_refactor", "difficulty": "easy", "prompt": "Refactor an existing codebase in fintech to support real-time notifications cleanly.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must be easy to extend, must include clear error handling, must be secure-by-default, must include tests, must include type hints where applicable.\nDifficulty: easy. Assume untrusted input; validate everything.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000050", "task_type": "architecture_refactor", "difficulty": "expert", "prompt": "Refactor an existing codebase in fintech to support role-based access control cleanly.\nTarget platform: backend (Python FastAPI).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must include type hints where applicable, must be production-ready, must include clear error handling.\nDifficulty: expert. Include rollback strategy.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000051", "task_type": "architecture_refactor", "difficulty": "medium", "prompt": "Refactor an existing codebase in document processing to support A/B experimentation cleanly.\nTarget platform: infra (Terraform).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must be production-ready, must include documentation/comments, must be easy to extend, must include type hints where applicable.\nDifficulty: medium. Assume schema evolves frequently; design for migrations.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000052", "task_type": "architecture_refactor", "difficulty": "expert", "prompt": "Refactor an existing codebase in document processing to support file uploads cleanly.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must be performant under load, must include type hints where applicable, must avoid global state, must include documentation/comments, must include tests.\nDifficulty: expert. Include rollback strategy.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000053", "task_type": "architecture_refactor", "difficulty": "hard", "prompt": "Refactor an existing codebase in enterprise SaaS to support analytics pipeline cleanly.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: propose new modules/layers, dependency boundaries, and migration plan.\nConstraints: must be observable (logs/metrics/traces), must be easy to extend, must be performant under load, must be production-ready.\nDifficulty: hard. Assume 10k RPS peak traffic.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: refactor plan + module boundaries.\n\n**Proposed modules**\n- `domain/` pure business logic (no I/O)\n- `adapters/` DB, cache, external APIs\n- `api/` request/response validation and routing\n- `observability/` logging/metrics/tracing\n- `tests/` unit + integration suites\n\n**Migration plan**\n1. Introduce new interfaces + adapters behind feature flags.\n2. Dual-write or read-compat layer if schema changes.\n3. Incremental cutover; deprecate legacy module.\n\nKey rule: dependencies flow inward; domain has no framework imports.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "refactor", "clean-architecture"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000054", "task_type": "code_review", "difficulty": "easy", "prompt": "Perform a code review for a developer tooling PR implementing webhooks.\nTarget platform: ML (scikit + batch).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must be production-ready, must include documentation/comments, must be secure-by-default.\nDifficulty: easy. Assume untrusted input; validate everything.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000055", "task_type": "code_review", "difficulty": "medium", "prompt": "Perform a code review for a developer tooling PR implementing multi-tenant isolation.\nTarget platform: ML (scikit + batch).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must include documentation/comments, must avoid global state, must be performant under load, must include clear error handling.\nDifficulty: medium. Assume schema evolves frequently; design for migrations.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000056", "task_type": "code_review", "difficulty": "medium", "prompt": "Perform a code review for a fintech PR implementing rate limiting.\nTarget platform: web (React + TypeScript).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must avoid global state, must include tests, must include type hints where applicable, must be easy to extend.\nDifficulty: medium. Assume 10k RPS peak traffic.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000057", "task_type": "code_review", "difficulty": "easy", "prompt": "Perform a code review for a healthtech PR implementing event-driven workflows.\nTarget platform: backend (Node.js).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must be observable (logs/metrics/traces), must be easy to extend, must include type hints where applicable, must include documentation/comments, must avoid global state.\nDifficulty: easy. Include rollback strategy.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000058", "task_type": "code_review", "difficulty": "medium", "prompt": "Perform a code review for a healthtech PR implementing caching.\nTarget platform: ML (PyTorch + serving).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must include type hints where applicable, must be performant under load, must include documentation/comments.\nDifficulty: medium. Include rollback strategy.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000059", "task_type": "code_review", "difficulty": "hard", "prompt": "Perform a code review for a calendar/scheduling PR implementing background jobs.\nTarget platform: web (React + TypeScript).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must be production-ready, must be observable (logs/metrics/traces), must avoid global state, must be secure-by-default.\nDifficulty: hard. Include rollback strategy.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000060", "task_type": "code_review", "difficulty": "expert", "prompt": "Perform a code review for a fintech PR implementing multi-tenant isolation.\nTarget platform: mobile (Android Kotlin).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must be easy to extend, must include tests, must include type hints where applicable.\nDifficulty: expert. Assume untrusted input; validate everything.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000061", "task_type": "code_review", "difficulty": "medium", "prompt": "Perform a code review for a calendar/scheduling PR implementing role-based access control.\nTarget platform: data (SQL + Python).\nRequirements: list critical issues, improvements, and provide an improved patch excerpt.\nConstraints: must be production-ready, must include documentation/comments, must include tests.\nDifficulty: medium. Assume GDPR-style deletion requests must be supported.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: code review findings + improved patch excerpt.\n\n**Critical issues**\n1. Missing input validation at boundary; potential unexpected exceptions.\n2. No idempotency / retry safety for side-effecting endpoint.\n3. No tests for edge cases (empty input, duplicates, timeouts).\n4. Observability gaps: no request_id correlation, no metrics.\n\n**Improvements**\n- Add strict validation and explicit error responses.\n- Add idempotency key support for create endpoints.\n- Add unit + integration tests with CI gating.\n- Add structured logs and basic metrics.\n\nPatch excerpt (illustrative):\n```python\nif not idem_key:\n raise HTTPException(400, \"Missing Idempotency-Key\")\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "review", "best-practices"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000062", "task_type": "devops_ci_cd", "difficulty": "expert", "prompt": "Design CI/CD for a IoT telemetry service delivering analytics pipeline.\nTarget platform: infra (Terraform).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must be production-ready, must be secure-by-default, must include tests.\nDifficulty: expert. Assume GDPR-style deletion requests must be supported.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000063", "task_type": "devops_ci_cd", "difficulty": "expert", "prompt": "Design CI/CD for a enterprise SaaS service delivering role-based access control.\nTarget platform: ML (scikit + batch).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must avoid global state, must be easy to extend, must be production-ready, must include tests, must be performant under load.\nDifficulty: expert. Assume mobile clients are occasionally offline.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000064", "task_type": "devops_ci_cd", "difficulty": "medium", "prompt": "Design CI/CD for a social media service delivering event-driven workflows.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must be performant under load, must avoid global state, must include clear error handling, must include type hints where applicable.\nDifficulty: medium. Include rollback strategy.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000065", "task_type": "devops_ci_cd", "difficulty": "medium", "prompt": "Design CI/CD for a IoT telemetry service delivering real-time notifications.\nTarget platform: data (SQL + Python).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must include type hints where applicable, must be easy to extend, must be production-ready, must include documentation/comments.\nDifficulty: medium. Assume PII must be protected.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000066", "task_type": "devops_ci_cd", "difficulty": "hard", "prompt": "Design CI/CD for a developer tooling service delivering background jobs.\nTarget platform: web (React + TypeScript).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must be secure-by-default, must include type hints where applicable, must be production-ready, must include documentation/comments, must include clear error handling.\nDifficulty: hard. Assume mobile clients are occasionally offline.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000067", "task_type": "devops_ci_cd", "difficulty": "expert", "prompt": "Design CI/CD for a e-commerce service delivering file uploads.\nTarget platform: mobile (iOS Swift).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must include documentation/comments, must be easy to extend, must include clear error handling.\nDifficulty: expert. Include rollback strategy.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000068", "task_type": "devops_ci_cd", "difficulty": "expert", "prompt": "Design CI/CD for a enterprise SaaS service delivering file uploads.\nTarget platform: mobile (Android Kotlin).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must include clear error handling, must be easy to extend, must include tests, must be production-ready.\nDifficulty: expert. Include rollback strategy.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000069", "task_type": "devops_ci_cd", "difficulty": "expert", "prompt": "Design CI/CD for a gaming service delivering audit logs.\nTarget platform: mobile (iOS Swift).\nRequirements: pipelines, checks, artifact strategy, deployments, and rollbacks.\nConstraints: must be easy to extend, must be secure-by-default, must be production-ready, must avoid global state, must include type hints where applicable.\nDifficulty: expert. Assume 10k RPS peak traffic.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: CI/CD pipeline (GitHub Actions) with quality gates.\n\n```yaml\nname: ci\non:\n pull_request:\n push:\n branches: [main]\n\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-python@v5\n with:\n python-version: \"3.11\"\n - run: python -m pip install -U pip\n - run: pip install -r requirements.txt\n - run: pip install -r requirements-dev.txt\n - run: ruff check .\n - run: mypy .\n - run: pytest -q --maxfail=1 --disable-warnings\n\n docker:\n needs: test\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: docker/setup-buildx-action@v3\n - run: docker build -t app:${{ github.sha }} .\n```\n\nDeployment strategy:\n- main → build → deploy to staging → smoke tests → canary to prod.\n- Rollback: redeploy previous image + DB migration rollback plan.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "cicd", "automation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000070", "task_type": "cloud_infra", "difficulty": "expert", "prompt": "Provision infrastructure for a enterprise SaaS workload providing rate limiting.\nTarget platform: mobile (iOS Swift).\nRequirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling.\nConstraints: must include type hints where applicable, must include tests, must be performant under load.\nDifficulty: expert. Assume PII must be protected.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: Kubernetes deployment + basic security posture.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: app\nspec:\n replicas: 3\n selector:\n matchLabels: { app: app }\n template:\n metadata:\n labels: { app: app }\n spec:\n containers:\n - name: app\n image: app:latest\n ports: [{ containerPort: 8080 }]\n readinessProbe:\n httpGet: { path: /healthz, port: 8080 }\n resources:\n requests: { cpu: \"200m\", memory: \"256Mi\" }\n limits: { cpu: \"1\", memory: \"1Gi\" }\n```\n\nAdditions:\n- NetworkPolicy to restrict egress/ingress.\n- Secrets via external secret store; rotate regularly.\n- HPA for autoscaling; PodDisruptionBudget for availability.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "infra", "cloud"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000071", "task_type": "cloud_infra", "difficulty": "expert", "prompt": "Provision infrastructure for a education workload providing multi-tenant isolation.\nTarget platform: infra (Terraform).\nRequirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling.\nConstraints: must be production-ready, must include documentation/comments, must be observable (logs/metrics/traces), must be performant under load, must avoid global state.\nDifficulty: expert. Assume schema evolves frequently; design for migrations.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: Kubernetes deployment + basic security posture.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: app\nspec:\n replicas: 3\n selector:\n matchLabels: { app: app }\n template:\n metadata:\n labels: { app: app }\n spec:\n containers:\n - name: app\n image: app:latest\n ports: [{ containerPort: 8080 }]\n readinessProbe:\n httpGet: { path: /healthz, port: 8080 }\n resources:\n requests: { cpu: \"200m\", memory: \"256Mi\" }\n limits: { cpu: \"1\", memory: \"1Gi\" }\n```\n\nAdditions:\n- NetworkPolicy to restrict egress/ingress.\n- Secrets via external secret store; rotate regularly.\n- HPA for autoscaling; PodDisruptionBudget for availability.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "infra", "cloud"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000072", "task_type": "cloud_infra", "difficulty": "expert", "prompt": "Provision infrastructure for a IoT telemetry workload providing caching.\nTarget platform: infra (Terraform).\nRequirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling.\nConstraints: must include documentation/comments, must be performant under load, must include tests.\nDifficulty: expert. Include rollback strategy.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: Kubernetes deployment + basic security posture.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: app\nspec:\n replicas: 3\n selector:\n matchLabels: { app: app }\n template:\n metadata:\n labels: { app: app }\n spec:\n containers:\n - name: app\n image: app:latest\n ports: [{ containerPort: 8080 }]\n readinessProbe:\n httpGet: { path: /healthz, port: 8080 }\n resources:\n requests: { cpu: \"200m\", memory: \"256Mi\" }\n limits: { cpu: \"1\", memory: \"1Gi\" }\n```\n\nAdditions:\n- NetworkPolicy to restrict egress/ingress.\n- Secrets via external secret store; rotate regularly.\n- HPA for autoscaling; PodDisruptionBudget for availability.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "infra", "cloud"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000073", "task_type": "cloud_infra", "difficulty": "medium", "prompt": "Provision infrastructure for a customer support workload providing real-time notifications.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling.\nConstraints: must avoid global state, must be production-ready, must be secure-by-default, must be easy to extend.\nDifficulty: medium. Assume 10k RPS peak traffic.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: Kubernetes deployment + basic security posture.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: app\nspec:\n replicas: 3\n selector:\n matchLabels: { app: app }\n template:\n metadata:\n labels: { app: app }\n spec:\n containers:\n - name: app\n image: app:latest\n ports: [{ containerPort: 8080 }]\n readinessProbe:\n httpGet: { path: /healthz, port: 8080 }\n resources:\n requests: { cpu: \"200m\", memory: \"256Mi\" }\n limits: { cpu: \"1\", memory: \"1Gi\" }\n```\n\nAdditions:\n- NetworkPolicy to restrict egress/ingress.\n- Secrets via external secret store; rotate regularly.\n- HPA for autoscaling; PodDisruptionBudget for availability.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "infra", "cloud"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000074", "task_type": "cloud_infra", "difficulty": "hard", "prompt": "Provision infrastructure for a document processing workload providing analytics pipeline.\nTarget platform: backend (Python FastAPI).\nRequirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling.\nConstraints: must be performant under load, must include type hints where applicable, must be secure-by-default, must be observable (logs/metrics/traces), must include clear error handling.\nDifficulty: hard. Assume mobile clients are occasionally offline.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: Kubernetes deployment + basic security posture.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: app\nspec:\n replicas: 3\n selector:\n matchLabels: { app: app }\n template:\n metadata:\n labels: { app: app }\n spec:\n containers:\n - name: app\n image: app:latest\n ports: [{ containerPort: 8080 }]\n readinessProbe:\n httpGet: { path: /healthz, port: 8080 }\n resources:\n requests: { cpu: \"200m\", memory: \"256Mi\" }\n limits: { cpu: \"1\", memory: \"1Gi\" }\n```\n\nAdditions:\n- NetworkPolicy to restrict egress/ingress.\n- Secrets via external secret store; rotate regularly.\n- HPA for autoscaling; PodDisruptionBudget for availability.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "infra", "cloud"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000075", "task_type": "cloud_infra", "difficulty": "hard", "prompt": "Provision infrastructure for a content moderation workload providing background jobs.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: IaC (Terraform or Kubernetes YAML), networking, secrets, autoscaling.\nConstraints: must include clear error handling, must include tests, must include documentation/comments.\nDifficulty: hard. Assume strict latency budget (p95 < 200ms).", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: Kubernetes deployment + basic security posture.\n\n```yaml\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: app\nspec:\n replicas: 3\n selector:\n matchLabels: { app: app }\n template:\n metadata:\n labels: { app: app }\n spec:\n containers:\n - name: app\n image: app:latest\n ports: [{ containerPort: 8080 }]\n readinessProbe:\n httpGet: { path: /healthz, port: 8080 }\n resources:\n requests: { cpu: \"200m\", memory: \"256Mi\" }\n limits: { cpu: \"1\", memory: \"1Gi\" }\n```\n\nAdditions:\n- NetworkPolicy to restrict egress/ingress.\n- Secrets via external secret store; rotate regularly.\n- HPA for autoscaling; PodDisruptionBudget for availability.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "infra", "cloud"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000076", "task_type": "data_engineering", "difficulty": "medium", "prompt": "Build a data pipeline for a gaming product around file uploads.\nTarget platform: data (SQL + Python).\nRequirements: schema, ingestion, validation, backfills, and tests.\nConstraints: must avoid global state, must be easy to extend, must be observable (logs/metrics/traces), must include documentation/comments, must include type hints where applicable.\nDifficulty: medium. Assume 10k RPS peak traffic.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: schema + ingestion + validation + backfill strategy.\n\n**Schema (example)**\n- events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB)\n\n**Ingestion**\n- Write to raw table first; validate; then materialize to curated tables.\n- Idempotency by event_id; enforce uniqueness.\n\n**Validation**\n- Reject missing tenant_id/type/ts.\n- Quarantine bad records with reason.\n\n**Backfills**\n- Re-run deterministic transforms from raw → curated.\n- Version transformations; store transform_version with outputs.\n\n**Tests**\n- Unit tests for validators and transforms.\n- Integration test: sample raw batch produces expected curated rows.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "data", "etl"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000077", "task_type": "data_engineering", "difficulty": "expert", "prompt": "Build a data pipeline for a healthtech product around role-based access control.\nTarget platform: data (SQL + Python).\nRequirements: schema, ingestion, validation, backfills, and tests.\nConstraints: must be performant under load, must include documentation/comments, must include clear error handling.\nDifficulty: expert. Assume mobile clients are occasionally offline.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: schema + ingestion + validation + backfill strategy.\n\n**Schema (example)**\n- events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB)\n\n**Ingestion**\n- Write to raw table first; validate; then materialize to curated tables.\n- Idempotency by event_id; enforce uniqueness.\n\n**Validation**\n- Reject missing tenant_id/type/ts.\n- Quarantine bad records with reason.\n\n**Backfills**\n- Re-run deterministic transforms from raw → curated.\n- Version transformations; store transform_version with outputs.\n\n**Tests**\n- Unit tests for validators and transforms.\n- Integration test: sample raw batch produces expected curated rows.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "data", "etl"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000078", "task_type": "data_engineering", "difficulty": "medium", "prompt": "Build a data pipeline for a fraud detection product around file uploads.\nTarget platform: data (SQL + Python).\nRequirements: schema, ingestion, validation, backfills, and tests.\nConstraints: must include type hints where applicable, must include documentation/comments, must be easy to extend.\nDifficulty: medium. Include rollback strategy.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: schema + ingestion + validation + backfill strategy.\n\n**Schema (example)**\n- events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB)\n\n**Ingestion**\n- Write to raw table first; validate; then materialize to curated tables.\n- Idempotency by event_id; enforce uniqueness.\n\n**Validation**\n- Reject missing tenant_id/type/ts.\n- Quarantine bad records with reason.\n\n**Backfills**\n- Re-run deterministic transforms from raw → curated.\n- Version transformations; store transform_version with outputs.\n\n**Tests**\n- Unit tests for validators and transforms.\n- Integration test: sample raw batch produces expected curated rows.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "data", "etl"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000079", "task_type": "data_engineering", "difficulty": "expert", "prompt": "Build a data pipeline for a logistics product around search + pagination.\nTarget platform: data (SQL + Python).\nRequirements: schema, ingestion, validation, backfills, and tests.\nConstraints: must include clear error handling, must be easy to extend, must be production-ready, must include tests.\nDifficulty: expert. Assume GDPR-style deletion requests must be supported.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: schema + ingestion + validation + backfill strategy.\n\n**Schema (example)**\n- events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB)\n\n**Ingestion**\n- Write to raw table first; validate; then materialize to curated tables.\n- Idempotency by event_id; enforce uniqueness.\n\n**Validation**\n- Reject missing tenant_id/type/ts.\n- Quarantine bad records with reason.\n\n**Backfills**\n- Re-run deterministic transforms from raw → curated.\n- Version transformations; store transform_version with outputs.\n\n**Tests**\n- Unit tests for validators and transforms.\n- Integration test: sample raw batch produces expected curated rows.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "data", "etl"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000080", "task_type": "data_engineering", "difficulty": "easy", "prompt": "Build a data pipeline for a healthtech product around idempotent payments.\nTarget platform: data (SQL + Python).\nRequirements: schema, ingestion, validation, backfills, and tests.\nConstraints: must be observable (logs/metrics/traces), must avoid global state, must include tests, must be performant under load, must be easy to extend.\nDifficulty: easy. Assume strict latency budget (p95 < 200ms).", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: schema + ingestion + validation + backfill strategy.\n\n**Schema (example)**\n- events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB)\n\n**Ingestion**\n- Write to raw table first; validate; then materialize to curated tables.\n- Idempotency by event_id; enforce uniqueness.\n\n**Validation**\n- Reject missing tenant_id/type/ts.\n- Quarantine bad records with reason.\n\n**Backfills**\n- Re-run deterministic transforms from raw → curated.\n- Version transformations; store transform_version with outputs.\n\n**Tests**\n- Unit tests for validators and transforms.\n- Integration test: sample raw batch produces expected curated rows.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "data", "etl"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000081", "task_type": "data_engineering", "difficulty": "easy", "prompt": "Build a data pipeline for a e-commerce product around webhooks.\nTarget platform: data (SQL + Python).\nRequirements: schema, ingestion, validation, backfills, and tests.\nConstraints: must include clear error handling, must be observable (logs/metrics/traces), must be production-ready, must include type hints where applicable.\nDifficulty: easy. Assume GDPR-style deletion requests must be supported.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: schema + ingestion + validation + backfill strategy.\n\n**Schema (example)**\n- events(event_id TEXT PK, tenant_id TEXT, ts TIMESTAMP, type TEXT, payload JSONB)\n\n**Ingestion**\n- Write to raw table first; validate; then materialize to curated tables.\n- Idempotency by event_id; enforce uniqueness.\n\n**Validation**\n- Reject missing tenant_id/type/ts.\n- Quarantine bad records with reason.\n\n**Backfills**\n- Re-run deterministic transforms from raw → curated.\n- Version transformations; store transform_version with outputs.\n\n**Tests**\n- Unit tests for validators and transforms.\n- Integration test: sample raw batch produces expected curated rows.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "data", "etl"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000082", "task_type": "ml_engineering", "difficulty": "expert", "prompt": "Implement an ML engineering workflow for document processing focusing on event-driven workflows.\nTarget platform: ML (training + serving).\nRequirements: data contract, training loop, evaluation, model registry, serving API, monitoring.\nConstraints: must include clear error handling, must be performant under load, must include type hints where applicable, must include tests.\nDifficulty: expert. Assume schema evolves frequently; design for migrations.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented.\n\n**Data contract**\n- Define feature schema + ranges; validate at training and serving.\n\n**Training**\n- Deterministic split; baseline model; track metrics (AUC/F1/latency).\n- Store artifacts: model, config, feature stats.\n\n**Registry**\n- Promote models via approval gates; record lineage.\n\n**Serving**\n- Separate inference service with `/predict`.\n- Input validation + default handling; timeouts.\n\n**Monitoring**\n- Data drift: feature distribution checks.\n- Performance: online metrics + periodic labels; alert on regression.\n\nMinimal serving skeleton (FastAPI-ish):\n```python\n# validate input -> vectorize -> model.predict_proba -> return\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "mlops", "serving"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000083", "task_type": "ml_engineering", "difficulty": "hard", "prompt": "Implement an ML engineering workflow for logistics focusing on background jobs.\nTarget platform: ML (training + serving).\nRequirements: data contract, training loop, evaluation, model registry, serving API, monitoring.\nConstraints: must be production-ready, must include documentation/comments, must include tests, must be observable (logs/metrics/traces), must include clear error handling.\nDifficulty: hard. Assume strict latency budget (p95 < 200ms).", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented.\n\n**Data contract**\n- Define feature schema + ranges; validate at training and serving.\n\n**Training**\n- Deterministic split; baseline model; track metrics (AUC/F1/latency).\n- Store artifacts: model, config, feature stats.\n\n**Registry**\n- Promote models via approval gates; record lineage.\n\n**Serving**\n- Separate inference service with `/predict`.\n- Input validation + default handling; timeouts.\n\n**Monitoring**\n- Data drift: feature distribution checks.\n- Performance: online metrics + periodic labels; alert on regression.\n\nMinimal serving skeleton (FastAPI-ish):\n```python\n# validate input -> vectorize -> model.predict_proba -> return\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "mlops", "serving"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000084", "task_type": "ml_engineering", "difficulty": "expert", "prompt": "Implement an ML engineering workflow for healthtech focusing on A/B experimentation.\nTarget platform: ML (training + serving).\nRequirements: data contract, training loop, evaluation, model registry, serving API, monitoring.\nConstraints: must include documentation/comments, must include tests, must avoid global state.\nDifficulty: expert. Assume strict latency budget (p95 < 200ms).", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented.\n\n**Data contract**\n- Define feature schema + ranges; validate at training and serving.\n\n**Training**\n- Deterministic split; baseline model; track metrics (AUC/F1/latency).\n- Store artifacts: model, config, feature stats.\n\n**Registry**\n- Promote models via approval gates; record lineage.\n\n**Serving**\n- Separate inference service with `/predict`.\n- Input validation + default handling; timeouts.\n\n**Monitoring**\n- Data drift: feature distribution checks.\n- Performance: online metrics + periodic labels; alert on regression.\n\nMinimal serving skeleton (FastAPI-ish):\n```python\n# validate input -> vectorize -> model.predict_proba -> return\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "mlops", "serving"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000085", "task_type": "ml_engineering", "difficulty": "expert", "prompt": "Implement an ML engineering workflow for fintech focusing on caching.\nTarget platform: ML (training + serving).\nRequirements: data contract, training loop, evaluation, model registry, serving API, monitoring.\nConstraints: must be secure-by-default, must be performant under load, must be observable (logs/metrics/traces), must avoid global state.\nDifficulty: expert. Assume mobile clients are occasionally offline.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented.\n\n**Data contract**\n- Define feature schema + ranges; validate at training and serving.\n\n**Training**\n- Deterministic split; baseline model; track metrics (AUC/F1/latency).\n- Store artifacts: model, config, feature stats.\n\n**Registry**\n- Promote models via approval gates; record lineage.\n\n**Serving**\n- Separate inference service with `/predict`.\n- Input validation + default handling; timeouts.\n\n**Monitoring**\n- Data drift: feature distribution checks.\n- Performance: online metrics + periodic labels; alert on regression.\n\nMinimal serving skeleton (FastAPI-ish):\n```python\n# validate input -> vectorize -> model.predict_proba -> return\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "mlops", "serving"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000086", "task_type": "ml_engineering", "difficulty": "hard", "prompt": "Implement an ML engineering workflow for gaming focusing on search + pagination.\nTarget platform: ML (training + serving).\nRequirements: data contract, training loop, evaluation, model registry, serving API, monitoring.\nConstraints: must include type hints where applicable, must be easy to extend, must be secure-by-default, must be performant under load, must include tests.\nDifficulty: hard. Assume mobile clients are occasionally offline.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented.\n\n**Data contract**\n- Define feature schema + ranges; validate at training and serving.\n\n**Training**\n- Deterministic split; baseline model; track metrics (AUC/F1/latency).\n- Store artifacts: model, config, feature stats.\n\n**Registry**\n- Promote models via approval gates; record lineage.\n\n**Serving**\n- Separate inference service with `/predict`.\n- Input validation + default handling; timeouts.\n\n**Monitoring**\n- Data drift: feature distribution checks.\n- Performance: online metrics + periodic labels; alert on regression.\n\nMinimal serving skeleton (FastAPI-ish):\n```python\n# validate input -> vectorize -> model.predict_proba -> return\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "mlops", "serving"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000087", "task_type": "ml_engineering", "difficulty": "expert", "prompt": "Implement an ML engineering workflow for fintech focusing on caching.\nTarget platform: ML (training + serving).\nRequirements: data contract, training loop, evaluation, model registry, serving API, monitoring.\nConstraints: must be observable (logs/metrics/traces), must be production-ready, must be easy to extend.\nDifficulty: expert. Assume 10k RPS peak traffic.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: ML engineering blueprint (training + serving + monitoring), safe and production-oriented.\n\n**Data contract**\n- Define feature schema + ranges; validate at training and serving.\n\n**Training**\n- Deterministic split; baseline model; track metrics (AUC/F1/latency).\n- Store artifacts: model, config, feature stats.\n\n**Registry**\n- Promote models via approval gates; record lineage.\n\n**Serving**\n- Separate inference service with `/predict`.\n- Input validation + default handling; timeouts.\n\n**Monitoring**\n- Data drift: feature distribution checks.\n- Performance: online metrics + periodic labels; alert on regression.\n\nMinimal serving skeleton (FastAPI-ish):\n```python\n# validate input -> vectorize -> model.predict_proba -> return\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "mlops", "serving"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000088", "task_type": "mobile_app", "difficulty": "easy", "prompt": "Implement a mobile feature for healthtech: file uploads.\nTarget platform: mobile.\nRequirements: offline-safe behavior, UI state handling, and tests.\nConstraints: must be secure-by-default, must include tests, must avoid global state, must include type hints where applicable, must include clear error handling.\nDifficulty: easy. Assume strict latency budget (p95 < 200ms).", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: offline-safe mobile approach (Kotlin) + key snippets.\n\n```kotlin\n// Repository.kt\ninterface Api {\n suspend fun fetch(): List\n suspend fun post(item: Item): Item\n}\n\ninterface LocalStore {\n suspend fun getAll(): List\n suspend fun upsert(items: List)\n suspend fun enqueuePending(item: Item)\n suspend fun pending(): List\n suspend fun markSent(id: String)\n}\n\nclass Repo(private val api: Api, private val db: LocalStore) {\n suspend fun sync(): List {\n val local = db.getAll()\n // optimistic: show local first, then refresh\n return try {\n val remote = api.fetch()\n db.upsert(remote)\n flushPending()\n remote\n } catch (e: Exception) {\n local\n }\n }\n\n suspend fun createOfflineFirst(item: Item): Item {\n db.enqueuePending(item)\n return item\n }\n\n private suspend fun flushPending() {\n for (p in db.pending()) {\n try {\n api.post(p)\n db.markSent(p.id)\n } catch (_: Exception) {\n // keep pending; retry later with backoff in a WorkManager job\n }\n }\n }\n}\n```\n\nTesting guidance:\n- Unit test Repo with fake Api/LocalStore.\n- Integration test offline queue + retry policy (WorkManager).\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "mobile", "kotlin_swift"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000089", "task_type": "mobile_app", "difficulty": "medium", "prompt": "Implement a mobile feature for developer tooling: file uploads.\nTarget platform: mobile.\nRequirements: offline-safe behavior, UI state handling, and tests.\nConstraints: must be observable (logs/metrics/traces), must avoid global state, must be production-ready.\nDifficulty: medium. Assume mobile clients are occasionally offline.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: offline-safe mobile approach (Kotlin) + key snippets.\n\n```kotlin\n// Repository.kt\ninterface Api {\n suspend fun fetch(): List\n suspend fun post(item: Item): Item\n}\n\ninterface LocalStore {\n suspend fun getAll(): List\n suspend fun upsert(items: List)\n suspend fun enqueuePending(item: Item)\n suspend fun pending(): List\n suspend fun markSent(id: String)\n}\n\nclass Repo(private val api: Api, private val db: LocalStore) {\n suspend fun sync(): List {\n val local = db.getAll()\n // optimistic: show local first, then refresh\n return try {\n val remote = api.fetch()\n db.upsert(remote)\n flushPending()\n remote\n } catch (e: Exception) {\n local\n }\n }\n\n suspend fun createOfflineFirst(item: Item): Item {\n db.enqueuePending(item)\n return item\n }\n\n private suspend fun flushPending() {\n for (p in db.pending()) {\n try {\n api.post(p)\n db.markSent(p.id)\n } catch (_: Exception) {\n // keep pending; retry later with backoff in a WorkManager job\n }\n }\n }\n}\n```\n\nTesting guidance:\n- Unit test Repo with fake Api/LocalStore.\n- Integration test offline queue + retry policy (WorkManager).\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "mobile", "kotlin_swift"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000090", "task_type": "mobile_app", "difficulty": "medium", "prompt": "Implement a mobile feature for e-commerce: analytics pipeline.\nTarget platform: mobile.\nRequirements: offline-safe behavior, UI state handling, and tests.\nConstraints: must avoid global state, must be performant under load, must include documentation/comments, must include type hints where applicable, must be easy to extend.\nDifficulty: medium. Include rollback strategy.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: offline-safe mobile approach (Kotlin) + key snippets.\n\n```kotlin\n// Repository.kt\ninterface Api {\n suspend fun fetch(): List\n suspend fun post(item: Item): Item\n}\n\ninterface LocalStore {\n suspend fun getAll(): List\n suspend fun upsert(items: List)\n suspend fun enqueuePending(item: Item)\n suspend fun pending(): List\n suspend fun markSent(id: String)\n}\n\nclass Repo(private val api: Api, private val db: LocalStore) {\n suspend fun sync(): List {\n val local = db.getAll()\n // optimistic: show local first, then refresh\n return try {\n val remote = api.fetch()\n db.upsert(remote)\n flushPending()\n remote\n } catch (e: Exception) {\n local\n }\n }\n\n suspend fun createOfflineFirst(item: Item): Item {\n db.enqueuePending(item)\n return item\n }\n\n private suspend fun flushPending() {\n for (p in db.pending()) {\n try {\n api.post(p)\n db.markSent(p.id)\n } catch (_: Exception) {\n // keep pending; retry later with backoff in a WorkManager job\n }\n }\n }\n}\n```\n\nTesting guidance:\n- Unit test Repo with fake Api/LocalStore.\n- Integration test offline queue + retry policy (WorkManager).\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "mobile", "kotlin_swift"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000091", "task_type": "web_app", "difficulty": "medium", "prompt": "Implement a web feature for fintech: search + pagination.\nTarget platform: web (React + TypeScript).\nRequirements: accessible UI, API integration, and tests.\nConstraints: must include type hints where applicable, must be performant under load, must include documentation/comments, must be secure-by-default.\nDifficulty: medium. Include rollback strategy.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: accessible React + TypeScript feature skeleton with tests.\n\n```tsx\n// Feature.tsx\nimport React, { useEffect, useMemo, useState } from \"react\";\n\ntype Item = { id: string; label: string };\n\nexport function Feature({ fetchItems }: { fetchItems: () => Promise }) {\n const [items, setItems] = useState([]);\n const [q, setQ] = useState(\"\");\n const filtered = useMemo(\n () => items.filter(i => i.label.toLowerCase().includes(q.toLowerCase())),\n [items, q]\n );\n\n useEffect(() => {\n let cancelled = false;\n fetchItems().then(xs => { if (!cancelled) setItems(xs); });\n return () => { cancelled = true; };\n }, [fetchItems]);\n\n return (\n
\n \n
    \n {filtered.map(i =>
  • {i.label}
  • )}\n
\n
\n );\n}\n```\n\n```tsx\n// Feature.test.tsx (vitest + testing-library)\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Feature } from \"./Feature\";\n\ntest(\"filters items\", async () => {\n const fetchItems = async () => [{ id:\"1\", label:\"Alpha\" }, { id:\"2\", label:\"Beta\" }];\n render();\n expect(await screen.findByText(\"Alpha\")).toBeInTheDocument();\n await userEvent.type(screen.getByLabelText(\"Search\"), \"be\");\n expect(screen.queryByText(\"Alpha\")).toBeNull();\n expect(screen.getByText(\"Beta\")).toBeInTheDocument();\n});\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "web", "typescript"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000092", "task_type": "web_app", "difficulty": "hard", "prompt": "Implement a web feature for calendar/scheduling: analytics pipeline.\nTarget platform: web (React + TypeScript).\nRequirements: accessible UI, API integration, and tests.\nConstraints: must include documentation/comments, must avoid global state, must include type hints where applicable.\nDifficulty: hard. Assume mobile clients are occasionally offline.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: accessible React + TypeScript feature skeleton with tests.\n\n```tsx\n// Feature.tsx\nimport React, { useEffect, useMemo, useState } from \"react\";\n\ntype Item = { id: string; label: string };\n\nexport function Feature({ fetchItems }: { fetchItems: () => Promise }) {\n const [items, setItems] = useState([]);\n const [q, setQ] = useState(\"\");\n const filtered = useMemo(\n () => items.filter(i => i.label.toLowerCase().includes(q.toLowerCase())),\n [items, q]\n );\n\n useEffect(() => {\n let cancelled = false;\n fetchItems().then(xs => { if (!cancelled) setItems(xs); });\n return () => { cancelled = true; };\n }, [fetchItems]);\n\n return (\n
\n \n
    \n {filtered.map(i =>
  • {i.label}
  • )}\n
\n
\n );\n}\n```\n\n```tsx\n// Feature.test.tsx (vitest + testing-library)\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Feature } from \"./Feature\";\n\ntest(\"filters items\", async () => {\n const fetchItems = async () => [{ id:\"1\", label:\"Alpha\" }, { id:\"2\", label:\"Beta\" }];\n render();\n expect(await screen.findByText(\"Alpha\")).toBeInTheDocument();\n await userEvent.type(screen.getByLabelText(\"Search\"), \"be\");\n expect(screen.queryByText(\"Alpha\")).toBeNull();\n expect(screen.getByText(\"Beta\")).toBeInTheDocument();\n});\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "web", "typescript"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000093", "task_type": "web_app", "difficulty": "medium", "prompt": "Implement a web feature for e-commerce: search + pagination.\nTarget platform: web (React + TypeScript).\nRequirements: accessible UI, API integration, and tests.\nConstraints: must avoid global state, must include documentation/comments, must be observable (logs/metrics/traces).\nDifficulty: medium. Assume mobile clients are occasionally offline.", "response": "Output: engineering-grade answer with edge cases covered.\nDeliverable: accessible React + TypeScript feature skeleton with tests.\n\n```tsx\n// Feature.tsx\nimport React, { useEffect, useMemo, useState } from \"react\";\n\ntype Item = { id: string; label: string };\n\nexport function Feature({ fetchItems }: { fetchItems: () => Promise }) {\n const [items, setItems] = useState([]);\n const [q, setQ] = useState(\"\");\n const filtered = useMemo(\n () => items.filter(i => i.label.toLowerCase().includes(q.toLowerCase())),\n [items, q]\n );\n\n useEffect(() => {\n let cancelled = false;\n fetchItems().then(xs => { if (!cancelled) setItems(xs); });\n return () => { cancelled = true; };\n }, [fetchItems]);\n\n return (\n
\n \n
    \n {filtered.map(i =>
  • {i.label}
  • )}\n
\n
\n );\n}\n```\n\n```tsx\n// Feature.test.tsx (vitest + testing-library)\nimport { render, screen } from \"@testing-library/react\";\nimport userEvent from \"@testing-library/user-event\";\nimport { Feature } from \"./Feature\";\n\ntest(\"filters items\", async () => {\n const fetchItems = async () => [{ id:\"1\", label:\"Alpha\" }, { id:\"2\", label:\"Beta\" }];\n render();\n expect(await screen.findByText(\"Alpha\")).toBeInTheDocument();\n await userEvent.type(screen.getByLabelText(\"Search\"), \"be\");\n expect(screen.queryByText(\"Alpha\")).toBeNull();\n expect(screen.getByText(\"Beta\")).toBeInTheDocument();\n});\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "web", "typescript"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000094", "task_type": "observability", "difficulty": "expert", "prompt": "Add observability for caching in a social media system.\nTarget platform: infra (Terraform).\nRequirements: structured logs, metrics, tracing, dashboards, and alerting rules.\nConstraints: must be performant under load, must be easy to extend, must be secure-by-default, must include clear error handling, must be production-ready.\nDifficulty: expert. Assume strict latency budget (p95 < 200ms).", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: observability plan + example instrumentation.\n\n**Logs**\n- JSON logs with: request_id, tenant_id, route, status, latency_ms, error_code.\n\n**Metrics**\n- Counters: requests_total{route,status}, errors_total{code}\n- Histograms: request_latency_ms{route}\n- Gauges: queue_depth, db_pool_in_use\n\n**Tracing**\n- Trace ID propagated via headers; spans around DB, cache, external calls.\n\n**Alerts**\n- p95 latency breach, error rate spike, saturation (CPU/mem), queue backlog.\n\nExample (Python structured logging pseudo):\n```python\nlog.info(\"request_done\", extra={\"route\": route, \"status\": status, \"latency_ms\": ms, \"request_id\": rid})\n```\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "logging", "metrics", "tracing"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000095", "task_type": "observability", "difficulty": "medium", "prompt": "Add observability for webhooks in a developer tooling system.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: structured logs, metrics, tracing, dashboards, and alerting rules.\nConstraints: must be secure-by-default, must be observable (logs/metrics/traces), must include tests.\nDifficulty: medium. Assume untrusted input; validate everything.", "response": "Output: production-oriented blueprint with code where appropriate.\nDeliverable: observability plan + example instrumentation.\n\n**Logs**\n- JSON logs with: request_id, tenant_id, route, status, latency_ms, error_code.\n\n**Metrics**\n- Counters: requests_total{route,status}, errors_total{code}\n- Histograms: request_latency_ms{route}\n- Gauges: queue_depth, db_pool_in_use\n\n**Tracing**\n- Trace ID propagated via headers; spans around DB, cache, external calls.\n\n**Alerts**\n- p95 latency breach, error rate spike, saturation (CPU/mem), queue backlog.\n\nExample (Python structured logging pseudo):\n```python\nlog.info(\"request_done\", extra={\"route\": route, \"status\": status, \"latency_ms\": ms, \"request_id\": rid})\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "logging", "metrics", "tracing"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000096", "task_type": "observability", "difficulty": "medium", "prompt": "Add observability for file uploads in a fintech system.\nTarget platform: data (SQL + Python).\nRequirements: structured logs, metrics, tracing, dashboards, and alerting rules.\nConstraints: must avoid global state, must include documentation/comments, must be production-ready, must be observable (logs/metrics/traces), must be secure-by-default.\nDifficulty: medium. Assume 10k RPS peak traffic.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: observability plan + example instrumentation.\n\n**Logs**\n- JSON logs with: request_id, tenant_id, route, status, latency_ms, error_code.\n\n**Metrics**\n- Counters: requests_total{route,status}, errors_total{code}\n- Histograms: request_latency_ms{route}\n- Gauges: queue_depth, db_pool_in_use\n\n**Tracing**\n- Trace ID propagated via headers; spans around DB, cache, external calls.\n\n**Alerts**\n- p95 latency breach, error rate spike, saturation (CPU/mem), queue backlog.\n\nExample (Python structured logging pseudo):\n```python\nlog.info(\"request_done\", extra={\"route\": route, \"status\": status, \"latency_ms\": ms, \"request_id\": rid})\n```\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "logging", "metrics", "tracing"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000097", "task_type": "security_safe", "difficulty": "expert", "prompt": "Secure-by-default implementation for file uploads in a IoT telemetry product.\nTarget platform: mobile (iOS Swift).\nRequirements: threat model, input validation, authz/authn guidance, safe storage, tests.\nConstraints: must avoid global state, must include clear error handling, must include tests.\nDifficulty: expert. Assume mobile clients are occasionally offline.", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: threat model + secure patterns (no offensive content).\n\n**Threat model**\n- Input: untrusted clients → validation required\n- Auth: token theft / privilege escalation → short-lived tokens + RBAC checks\n- Data: PII exposure → encryption at rest + access logging + least privilege\n- Webhooks/callbacks: SSRF → allowlist destinations + timeouts + egress controls\n\n**Secure implementation patterns**\n- Validate and normalize inputs at boundaries (API/CLI/file).\n- Use parameterized SQL; never string interpolate.\n- Prevent path traversal when writing files (resolve + base containment).\n- Use idempotency keys for side-effecting endpoints; safe retries.\n- Centralize authorization checks in one layer; test them.\n\n**Test checklist**\n- Invalid inputs rejected with clear error messages.\n- AuthZ tests for tenant boundary violations.\n- Replay/idempotency conflict test.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "security", "validation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000098", "task_type": "security_safe", "difficulty": "hard", "prompt": "Secure-by-default implementation for real-time notifications in a document processing product.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: threat model, input validation, authz/authn guidance, safe storage, tests.\nConstraints: must include tests, must be performant under load, must be observable (logs/metrics/traces), must be easy to extend, must include documentation/comments.\nDifficulty: hard. Assume strict latency budget (p95 < 200ms).", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: threat model + secure patterns (no offensive content).\n\n**Threat model**\n- Input: untrusted clients → validation required\n- Auth: token theft / privilege escalation → short-lived tokens + RBAC checks\n- Data: PII exposure → encryption at rest + access logging + least privilege\n- Webhooks/callbacks: SSRF → allowlist destinations + timeouts + egress controls\n\n**Secure implementation patterns**\n- Validate and normalize inputs at boundaries (API/CLI/file).\n- Use parameterized SQL; never string interpolate.\n- Prevent path traversal when writing files (resolve + base containment).\n- Use idempotency keys for side-effecting endpoints; safe retries.\n- Centralize authorization checks in one layer; test them.\n\n**Test checklist**\n- Invalid inputs rejected with clear error messages.\n- AuthZ tests for tenant boundary violations.\n- Replay/idempotency conflict test.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "security", "validation"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}} +{"id": "devgod_000099", "task_type": "security_safe", "difficulty": "medium", "prompt": "Secure-by-default implementation for caching in a customer support product.\nTarget platform: CI (GitHub Actions).\nRequirements: threat model, input validation, authz/authn guidance, safe storage, tests.\nConstraints: must include type hints where applicable, must be easy to extend, must include documentation/comments, must be secure-by-default.\nDifficulty: medium. Assume strict latency budget (p95 < 200ms).", "response": "Output: actionable implementation and verification artifacts.\nDeliverable: threat model + secure patterns (no offensive content).\n\n**Threat model**\n- Input: untrusted clients → validation required\n- Auth: token theft / privilege escalation → short-lived tokens + RBAC checks\n- Data: PII exposure → encryption at rest + access logging + least privilege\n- Webhooks/callbacks: SSRF → allowlist destinations + timeouts + egress controls\n\n**Secure implementation patterns**\n- Validate and normalize inputs at boundaries (API/CLI/file).\n- Use parameterized SQL; never string interpolate.\n- Prevent path traversal when writing files (resolve + base containment).\n- Use idempotency keys for side-effecting endpoints; safe retries.\n- Centralize authorization checks in one layer; test them.\n\n**Test checklist**\n- Invalid inputs rejected with clear error messages.\n- AuthZ tests for tenant boundary violations.\n- Replay/idempotency conflict test.\n\n\nChecks: input validation, tests, and safe defaults included.", "metadata": {"tags": ["software-engineering", "security", "validation"], "multi_domain": true, "has_code": true, "requires_thinking": false, "seed": 20251227}} +{"id": "devgod_000100", "task_type": "code_generation", "difficulty": "hard", "prompt": "Implement webhooks for a social media product.\nTarget platform: infra (Docker + Kubernetes).\nRequirements: provide production-ready code, configuration, and tests.\nConstraints: must include documentation/comments, must be secure-by-default, must include clear error handling, must include type hints where applicable.\nDifficulty: hard. Assume 10k RPS peak traffic.", "response": "Output: design + implementation guidance suitable for shipping.\nDeliverable: production-grade reference implementation (FastAPI) + tests.\n\n```python\n# app.py\nfrom __future__ import annotations\n\nimport hashlib\nimport json\nfrom dataclasses import dataclass\nfrom datetime import datetime, timezone\nfrom typing import Any, Optional\n\nfrom fastapi import FastAPI, Header, HTTPException\nfrom pydantic import BaseModel, Field\n\napp = FastAPI(title=\"Idempotent API\")\n\nclass CreateReq(BaseModel):\n tenant_id: str = Field(min_length=1)\n amount_cents: int = Field(ge=0)\n currency: str = Field(min_length=3, max_length=3)\n\nclass CreateResp(BaseModel):\n id: str\n created_at: str\n echo: CreateReq\n\n@dataclass\nclass _IdempoEntry:\n request_hash: str\n response_json: str\n\n# In production: Postgres table with UNIQUE(tenant_id, key)\n_IDEMPO: dict[tuple[str, str], _IdempoEntry] = {}\n\ndef _hash_req(req: CreateReq) -> str:\n raw = req.model_dump_json()\n return hashlib.sha256(raw.encode(\"utf-8\")).hexdigest()\n\n@app.post(\"/v1/payments\", response_model=CreateResp)\ndef create_payment(\n req: CreateReq,\n idempotency_key: Optional[str] = Header(default=None, alias=\"Idempotency-Key\"),\n) -> Any:\n if not idempotency_key:\n raise HTTPException(status_code=400, detail=\"Missing Idempotency-Key\")\n if len(idempotency_key) > 128:\n raise HTTPException(status_code=400, detail=\"Idempotency-Key too long\")\n\n key = (req.tenant_id, idempotency_key)\n rh = _hash_req(req)\n\n existing = _IDEMPO.get(key)\n if existing:\n if existing.request_hash != rh:\n raise HTTPException(status_code=409, detail=\"Idempotency-Key reuse with different payload\")\n return json.loads(existing.response_json)\n\n # Create new payment (stubbed)\n pid = hashlib.md5(f\"{req.tenant_id}:{idempotency_key}\".encode()).hexdigest()\n resp = CreateResp(\n id=pid,\n created_at=datetime.now(timezone.utc).isoformat(),\n echo=req,\n )\n _IDEMPO[key] = _IdempoEntry(request_hash=rh, response_json=resp.model_dump_json())\n return resp\n```\n\n```python\n# test_app.py (pytest)\nfrom fastapi.testclient import TestClient\nfrom app import app\n\nclient = TestClient(app)\n\ndef test_idempotent_replay():\n headers = {\"Idempotency-Key\": \"abc\"}\n body = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n r1 = client.post(\"/v1/payments\", json=body, headers=headers)\n r2 = client.post(\"/v1/payments\", json=body, headers=headers)\n assert r1.status_code == 200 and r2.status_code == 200\n assert r1.json() == r2.json()\n\ndef test_payload_conflict():\n headers = {\"Idempotency-Key\": \"abc\"}\n b1 = {\"tenant_id\":\"t1\",\"amount_cents\":100,\"currency\":\"USD\"}\n b2 = {\"tenant_id\":\"t1\",\"amount_cents\":200,\"currency\":\"USD\"}\n assert client.post(\"/v1/payments\", json=b1, headers=headers).status_code == 200\n assert client.post(\"/v1/payments\", json=b2, headers=headers).status_code == 409\n```\n\nNotes:\n- Replace in-memory store with a DB table and transaction.\n- Store response + request hash to detect key reuse with different payload.\n\n\nHard-mode checks: concurrency safety, idempotency, and rollback validated; add chaos tests where feasible.", "metadata": {"tags": ["software-engineering", "implementation", "api"], "multi_domain": true, "has_code": true, "requires_thinking": true, "seed": 20251227}}