messages
listlengths
2
2
metadata
unknown
[ { "role": "user", "content": "Tune Kafka consumer lag in order pipeline during peak traffic. Give tuning guide." }, { "role": "assistant", "content": "Measure lag per partition, processing time, fetch rate, GC pauses. Scale partitions and consumer instances matching key ordering constraints. Inc...
{ "domain": "backend", "task_type": "optimization", "difficulty": "advanced" }
[ { "role": "user", "content": "Pagination offset limit skips duplicates new rows inserted concurrently missing items. How to fix stable cursor pagination" }, { "role": "assistant", "content": "Offset shifts when inserts occur before current page causing skipped or duplicated items and poor user e...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "advanced" }
[ { "role": "user", "content": "Design globally distributed backend with CRDTs, conflict resolution, and causal consistency." }, { "role": "assistant", "content": "Model shared state as operation based CRDTs like OR-Set and LWW registers with hybrid logical clocks for causality. Replicate via Kafk...
{ "domain": "backend", "task_type": "architecture", "difficulty": "expert" }
[ { "role": "user", "content": "My FastAPI app crashes with AttributeError: 'NoneType' object has no attribute 'id' when accessing current_user.id. Traceback points to endpoint after Depends(get_current_user). The dependency returns None on missing token instead of raising. How to fix?" }, { "role": "...
{ "domain": "backend", "task_type": "traceback", "difficulty": "intermediate" }
[ { "role": "user", "content": "Optimize JSON serialization in hot API using orjson and response model exclusion." }, { "role": "assistant", "content": "Standard json plus full ORM dump wastes CPU and bandwidth on unused fields. Switch to orjson for 2x faster dumps and use response_model with excl...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "Android SharedPreferences OAuth cleartext backup rooted reads token theft. Secure storage with Keystore and backup rules" }, { "role": "assistant", "content": "Cleartext preferences with backup enabled exposes tokens to backup extraction or root theft leading to acc...
{ "domain": "backend", "task_type": "security", "difficulty": "expert" }
[ { "role": "user", "content": "Terraform wants recreate RDS engine 14.6 to 14.7 storage drift. How to avoid downtime and data loss during upgrade" }, { "role": "assistant", "content": "Recreation likely from immutable argument change, provider default diff, or parameter group replacement risking ...
{ "domain": "backend", "task_type": "debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "Write backend health check test asserting database connectivity and 200 response." }, { "role": "assistant", "content": "Expose GET /healthz performing SELECT 1 on primary and checking Redis PING, returning {status:'ok', checks:{db:'up', redis:'up'}} with 200 or 503...
{ "domain": "backend", "task_type": "testing", "difficulty": "beginner" }
[ { "role": "user", "content": "Threat model OAuth2 login flow for backend with PKCE. List mitigations." }, { "role": "assistant", "content": "Map assets tokens, user data, trust boundaries browser, backend, IdP. Threats: code interception, CSRF, open redirect, token leakage via logs. Mitigations:...
{ "domain": "backend", "task_type": "security", "difficulty": "advanced" }
[ { "role": "user", "content": "Implement Postgres partitioning by month for 500M row events table with retention." }, { "role": "assistant", "content": "Create range partition by created_at monthly, template with indexes on tenant and id. Automate pg_partman creation 3 months ahead. Detach and dr...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "Add unit tests for password hashing utility using bcrypt." }, { "role": "assistant", "content": "Test hash_password returns different salts for same input, verify_password succeeds for correct and fails for wrong, and handles unicode. Mock bcrypt cost low for speed ...
{ "domain": "backend", "task_type": "testing", "difficulty": "beginner" }
[ { "role": "user", "content": "Implement idempotent webhook receiver for payment provider with signature verification." }, { "role": "assistant", "content": "Expose POST endpoint verifying HMAC signature with timing-safe compare and timestamp tolerance to prevent replay. Store event id unique con...
{ "domain": "backend", "task_type": "implementation", "difficulty": "intermediate" }
[ { "role": "user", "content": "Explain REST pagination, filtering, and sorting conventions for a model registry API." }, { "role": "assistant", "content": "Use cursor based pagination with opaque next_token for stable results under inserts, falling back to page number only for small static lists....
{ "domain": "backend", "task_type": "instruction", "difficulty": "beginner" }
[ { "role": "user", "content": "Review this FastAPI pagination: @app.get('/x') def x(page: int = 1): return items[(page-1)*10:page*10]. No validation, no total, magic numbers. Provide reviewed version with Query validation and envelope." }, { "role": "assistant", "content": "Missing validation all...
{ "domain": "backend", "task_type": "code_review", "difficulty": "intermediate" }
[ { "role": "user", "content": "Review REST pagination returning all rows no limits verbose errors. Production fix?" }, { "role": "assistant", "content": "Issues are unbounded result causing OOM, DoS, and stack leakage aiding attackers. Implement keyset pagination limit 50 max 100 with total count...
{ "domain": "backend", "task_type": "code_review", "difficulty": "advanced" }
[ { "role": "user", "content": "Write Express.js GET endpoint returning user list with basic error handling." }, { "role": "assistant", "content": "Implement app.get('/users', async (req,res,next)=>{ try { const users = await db.select(); res.json(users); } catch(err){ next(err);} }); Add centrali...
{ "domain": "backend", "task_type": "implementation", "difficulty": "beginner" }
[ { "role": "user", "content": "Implement Redis distributed lock for inventory decrement preventing oversell." }, { "role": "assistant", "content": "Acquire lock with SET key uuid NX PX 5000 ensuring only holder with token can release via Lua script comparing value before DEL to avoid deleting oth...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "Implement consistent hashing for sharding embedding cache." }, { "role": "assistant", "content": "Build hash ring with virtual nodes to distribute keys evenly and minimize remapping on scaling. Use murmur or sha256 for uniform distribution. Assign each cache node mu...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "Implement cursor pagination for REST API with stable ordering and total count optimization." }, { "role": "assistant", "content": "Use opaque cursor encoding last seen sort key like created_at plus id to avoid offset drift when rows insert concurrently. Enforce dete...
{ "domain": "backend", "task_type": "architecture", "difficulty": "beginner" }
[ { "role": "user", "content": "Review iOS networking http staging disables ATS ignores SSL delegate true. What change before release for transport security" }, { "role": "assistant", "content": "HTTP plus disabled App Transport Security and blind trust of invalid certificates enables man in middl...
{ "domain": "backend", "task_type": "code_review", "difficulty": "advanced" }
[ { "role": "user", "content": "My FastAPI GET with list query param fails: /items?tags=a,b expects List[str] but gets single string. How to correctly pass arrays and validate in FastAPI?" }, { "role": "assistant", "content": "FastAPI expects repeated params for List, not comma string, unless cust...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "Design CDC pipeline from Postgres WAL to Elasticsearch for search indexing." }, { "role": "assistant", "content": "Deploy Debezium connector reading WAL logical replication slot, publishing row changes to Kafka topics dbserver.schema.table. Consume with sink transfo...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "Document backend background job system with retries and DLQ. Include runbook." }, { "role": "assistant", "content": "Describe queue topology, job types, priorities, concurrency. Explain enqueue API with idempotency keys, payload schema, visibility timeout. Detail re...
{ "domain": "backend", "task_type": "instruction", "difficulty": "advanced" }
[ { "role": "user", "content": "Stripe retry same request no key duplicate charges. How to implement idempotency correctly across services and queues" }, { "role": "assistant", "content": "Without Idempotency Key Stripe treats network retries as new charges creating duplicates, disputes, and suppo...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "advanced" }
[ { "role": "user", "content": "Implement JWT auth with rotating refresh tokens, reuse detection, HttpOnly cookies." }, { "role": "assistant", "content": "Issue short access 15min and refresh 30d JWTs with jti. Store refresh hash in Postgres with revoked flag and parent jti chain. Rotate on each u...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "Explain how to structure a FastAPI backend for serving an ML model with validation, logging, and health checks." }, { "role": "assistant", "content": "Create a modular FastAPI app with routers, services, and schemas. Define Pydantic models for request validation inc...
{ "domain": "backend", "task_type": "instruction", "difficulty": "beginner" }
[ { "role": "user", "content": "Describe Dockerizing a backend service with multi-stage builds, healthchecks, and minimal images." }, { "role": "assistant", "content": "Dockerize backends with multi stage builds separating compile and runtime for small secure images. Start from slim official base,...
{ "domain": "backend", "task_type": "instruction", "difficulty": "intermediate" }
[ { "role": "user", "content": "Block CSV formula injection in pandas export downloaded by finance users in Excel." }, { "role": "assistant", "content": "Cells starting with equals, plus, or at execute as formulas in Excel enabling exfiltration. Pandas export writes raw strings without sanitizatio...
{ "domain": "backend", "task_type": "security", "difficulty": "advanced" }
[ { "role": "user", "content": "How do I create a simple POST endpoint in FastAPI that validates input with Pydantic? I need an endpoint to create a user with name and email, returning the created user with an id. Show the full minimal code." }, { "role": "assistant", "content": "Define a Pydantic...
{ "domain": "backend", "task_type": "instruction", "difficulty": "beginner" }
[ { "role": "user", "content": "Explain event driven vs request response for AI agent tool orchestration." }, { "role": "assistant", "content": "Request response suits synchronous tool calls with immediate results and simple error handling. Event driven via queues enables long running agents, retr...
{ "domain": "backend", "task_type": "instruction", "difficulty": "intermediate" }
[ { "role": "user", "content": "Debug backend distributed trace gaps from missing context propagation across threads and queues." }, { "role": "assistant", "content": "Gaps stem from contextvars not crossing threads or task queue serialization losing traceparent. Fix by injecting W3C traceparent i...
{ "domain": "backend", "task_type": "debugging", "difficulty": "advanced" }
[ { "role": "user", "content": "Implement Postgres advisory locks for distributed cron deduplication across 5 replicas." }, { "role": "assistant", "content": "Use pg_try_advisory_lock bigint key per job to elect single runner among replicas. Acquire at start, release on completion with timeout 10m...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "FastAPI endpoint returns 422 when posting JSON with datetime field. Debug Pydantic validation mismatch." }, { "role": "assistant", "content": "Pydantic version two strictly validates datetime strings requiring timezone awareness if field is configured as aware. Fail...
{ "domain": "backend", "task_type": "debugging", "difficulty": "beginner" }
[ { "role": "user", "content": "Document backend webhook authentication and retry policy for partner integrators." }, { "role": "assistant", "content": "Explain HMAC SHA256 signature header, timestamp tolerance five minutes, IP allowlist, and TLS requirements. Provide verification code samples in ...
{ "domain": "backend", "task_type": "instruction", "difficulty": "advanced" }
[ { "role": "user", "content": "Design an idempotent payment webhook handler with signature verification and exactly-once processing." }, { "role": "assistant", "content": "Payment webhooks must tolerate retries without double charging. Verify HMAC signatures using raw body and timestamp tolerance...
{ "domain": "backend", "task_type": "instruction", "difficulty": "advanced" }
[ { "role": "user", "content": "Implement JWT authentication in backend with refresh rotation, revocation, and secure cookies." }, { "role": "assistant", "content": "Issue short lived access JWT 15m and rotating refresh 30d stored hashed in DB with reuse detection. Sign with RS256, validate iss au...
{ "domain": "backend", "task_type": "implementation", "difficulty": "intermediate" }
[ { "role": "user", "content": "Harden file upload API against malware, size abuse, and SSRF." }, { "role": "assistant", "content": "Validate content type by magic bytes not just extension, rejecting mismatched executables masquerading as images. Enforce size limits at reverse proxy and applicatio...
{ "domain": "backend", "task_type": "security", "difficulty": "intermediate" }
[ { "role": "user", "content": "React Native bridge slow 5MB JSON frame drops list scroll. How to optimize transfer virtualization and native filtering" }, { "role": "assistant", "content": "Serializing five megabytes over bridge blocks JavaScript thread causing dropped frames, jank, and high memo...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "advanced" }
[ { "role": "user", "content": "Handle downstream timeout cascade in order service with deadlines, retries, and fallback cache." }, { "role": "assistant", "content": "Propagate global deadline via context with 2s budget across order and inventory and payment calls to bound tail latency. Set per ho...
{ "domain": "backend", "task_type": "debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "API shows 401 on preflight OPTIONS due to auth middleware rejecting it. Debug and fix CORS plus auth order." }, { "role": "assistant", "content": "Auth middleware runs before CORS handling and rejects OPTIONS without token, so browser never sees ACAO headers and blo...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "beginner" }
[ { "role": "user", "content": "Stored XSS markdown renderer script onload comments CSP missing HttpOnly false. How to sanitize harden output and cookies" }, { "role": "assistant", "content": "Renderer outputs raw HTML enabling script execution stealing sessions via stolen cookies and keylogging. ...
{ "domain": "backend", "task_type": "security", "difficulty": "expert" }
[ { "role": "user", "content": "Review Postgres migration ADD COLUMN email TEXT NOT NULL no default 10M rows no concurrent index. Operational risk zero downtime strategy" }, { "role": "assistant", "content": "Adding NOT NULL without default rewrites table and scans ten million rows holding AccessE...
{ "domain": "backend", "task_type": "code_review", "difficulty": "advanced" }
[ { "role": "user", "content": "Debug race condition where two concurrent orders decrement inventory below zero. Propose safe fix." }, { "role": "assistant", "content": "Race occurs from read then write without lock so both threads see stock 1 and both succeed causing oversell. Confirm with concur...
{ "domain": "backend", "task_type": "debugging", "difficulty": "beginner" }
[ { "role": "user", "content": "Implement idempotent POST endpoints in backend using keys, deduplication store, and response replay." }, { "role": "assistant", "content": "Require Idempotency-Key header, store hashed key plus request fingerprint and response for 24h in DB or Redis with unique cons...
{ "domain": "backend", "task_type": "implementation", "difficulty": "intermediate" }
[ { "role": "user", "content": "Show how to structure a FastAPI service with routers, dependencies, validation, and error handling." }, { "role": "assistant", "content": "Structure FastAPI by routers per domain, dependencies for auth and resources, and pydantic schemas for validation. Organize app...
{ "domain": "backend", "task_type": "instruction", "difficulty": "intermediate" }
[ { "role": "user", "content": "Flask traceback NoneType has no attribute split parsing Authorization header on unauthenticated requests. Best fix returning proper 401 JSON" }, { "role": "assistant", "content": "Code assumes Authorization header present and calls get split without None check, cras...
{ "domain": "backend", "task_type": "traceback", "difficulty": "intermediate" }
[ { "role": "user", "content": "My FastAPI app returns 500 CORS errors in browser but curl works. I added CORSMiddleware but frontend at http://localhost:3000 still blocked. My code uses allow_origins=['*'] with allow_credentials=True. What is wrong and how to fix?" }, { "role": "assistant", "cont...
{ "domain": "backend", "task_type": "debugging", "difficulty": "beginner" }
[ { "role": "user", "content": "Create simple Flask hello world route and explain request handling for beginners." }, { "role": "assistant", "content": "Define minimal app with from flask import Flask; app = Flask(__name__); @app.route('/hello') def hello(): return {'message':'hello'}. Run via fla...
{ "domain": "backend", "task_type": "optimization", "difficulty": "beginner" }
[ { "role": "user", "content": "Debug FastAPI 422 validation errors caused by mismatched datetime formats from frontend." }, { "role": "assistant", "content": "Inspect 422 response detail showing loc, msg, and input to pinpoint field. Frontend sends DD-MM-YYYY while Pydantic expects ISO8601. Fix b...
{ "domain": "backend", "task_type": "debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "How do I handle pagination and filtering in a FastAPI REST list endpoint? I need query params for page, size, and optional search with validation and sane defaults. Show the implementation." }, { "role": "assistant", "content": "Use Query for validated query params ...
{ "domain": "backend", "task_type": "instruction", "difficulty": "intermediate" }
[ { "role": "user", "content": "Review Docker Compose setup for security, resource limits, and startup ordering." }, { "role": "assistant", "content": "Check images pinned by digest not latest tag to ensure reproducible secure builds. Verify no privileged mode and read only root filesystem where p...
{ "domain": "backend", "task_type": "code_review", "difficulty": "intermediate" }
[ { "role": "user", "content": "Review Kubernetes deployment PR lacking probes, limits, and graceful shutdown." }, { "role": "assistant", "content": "Require liveness /livez and readiness /readyz probes with initialDelay 10s period 10s to prevent premature traffic and restart hangs. Demand resourc...
{ "domain": "backend", "task_type": "code_review", "difficulty": "expert" }
[ { "role": "user", "content": "Compare dense versus hybrid retrieval on our e-commerce catalog with sparse product codes and descriptions." }, { "role": "assistant", "content": "Slice eval by query type: SKU exact, attribute filter, and natural language need. Dense excels on paraphrases but fails...
{ "domain": "backend", "task_type": "retrieval_analysis", "difficulty": "intermediate" }
[ { "role": "user", "content": "Design cursor pagination for large activity feed API." }, { "role": "assistant", "content": "Use opaque cursor encoding timestamp plus ID, e.g., base64 of created_at and id. Query where created_at less than cursor ordered desc limit plus one to detect next page. Avo...
{ "domain": "backend", "task_type": "architecture", "difficulty": "intermediate" }
[ { "role": "user", "content": "Optimize slow product listing query with N+1 selects and missing indexes." }, { "role": "assistant", "content": "Detect N plus one via query counter showing one query per product for category and images. Fix with eager loading using selectinload for collections to f...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "My Flask route returns 500 with TypeError: Object of type datetime is not JSON serializable. Traceback in jsonify. Quick fix?" }, { "role": "assistant", "content": "Convert datetime to ISO format before jsonify using isoformat. Set custom JSON provider with Default ...
{ "domain": "backend", "task_type": "traceback", "difficulty": "beginner" }
[ { "role": "user", "content": "Handle backend API errors consistently with RFC7807 problem details and mapped domain errors." }, { "role": "assistant", "content": "Return application problem json with type title status detail instance and extension code. Map ValidationError to 400, AuthError 401 ...
{ "domain": "backend", "task_type": "implementation", "difficulty": "intermediate" }
[ { "role": "user", "content": "Implement full-text search with Postgres tsvector, ranking, highlight, and pagination." }, { "role": "assistant", "content": "Create GIN index on to_tsvector('english', title||' '||body). Query with plainto_tsquery and ts_rank_cd for ranking. Use ts_headline for hig...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "Intermittent 502 from Nginx to upstream inference service. How to triage?" }, { "role": "assistant", "content": "Check upstream timeouts, keepalive mismatches, and worker crashes causing closed connections. Review Nginx error log for upstream prematurely closed and ...
{ "domain": "backend", "task_type": "traceback", "difficulty": "beginner" }
[ { "role": "user", "content": "Build CDC pipeline from Postgres to warehouse with Debezium, schema evolution, and backfill." }, { "role": "assistant", "content": "Deploy Debezium connector reading WAL with slot to capture inserts updates deletes without query polling. Publish to Kafka topics per ...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "My FastAPI file upload returns 400 with large files over 10MB. I use UploadFile but read entire file into memory. How to handle large uploads with streaming and limits?" }, { "role": "assistant", "content": "Reading whole file exhausts memory and hits proxy limits. ...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "Stripe traceback No such payment intent when confirming frontend backend test live keys mismatch. How to fix environment handling safely" }, { "role": "assistant", "content": "Frontend using live publishable key while backend creates intent with test secret causes i...
{ "domain": "backend", "task_type": "traceback", "difficulty": "intermediate" }
[ { "role": "user", "content": "Beginner question: backend A B test shows 55 vs 45 conversions out of 200 users. Is new version better?" }, { "role": "assistant", "content": "With only 200 users 55 versus 45 conversions is not conclusive evidence. Compute rates 55 percent versus 45 percent and run...
{ "domain": "backend", "task_type": "experiment_analysis", "difficulty": "beginner" }
[ { "role": "user", "content": "Optimize GraphQL N+1 with DataLoader batching and field level caching." }, { "role": "assistant", "content": "Identify N plus one via tracing showing per author query for each book in list resolver. Introduce DataLoader per request that batches author IDs into singl...
{ "domain": "backend", "task_type": "optimization", "difficulty": "advanced" }
[ { "role": "user", "content": "Fix FastAPI endpoint returning 500 due to detached SQLAlchemy session after request." }, { "role": "assistant", "content": "The error occurs when lazy loading relationships after session close. Fix by eager loading with selectinload or joinedload in the query, or by...
{ "domain": "backend", "task_type": "debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "How do I structure simple CRUD with FastAPI and SQLAlchemy without N+1 and with validation? Need beginner guide." }, { "role": "assistant", "content": "Define pydantic schemas for create and read separating input from output, SQLAlchemy models with relationships, an...
{ "domain": "backend", "task_type": "implementation", "difficulty": "beginner" }
[ { "role": "user", "content": "Implement request id propagation with structlog contextvars across FastAPI and Celery." }, { "role": "assistant", "content": "Generate uuid request_id in middleware, bind via contextvars and structlog. Propagate to Celery via task headers and downstream HTTP X-Reque...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }
[ { "role": "user", "content": "Harden multi tenant JWT validation against algorithm confusion attacks." }, { "role": "assistant", "content": "Enforce explicit alg allowlist RS256 and reject none, never trust header alg. Fetch JWKS per issuer with strict iss and aud validation scoped by tenant. Ca...
{ "domain": "backend", "task_type": "security", "difficulty": "expert" }
[ { "role": "user", "content": "Design saga orchestration for distributed checkout across payments, inventory, shipping." }, { "role": "assistant", "content": "Model checkout as saga orchestrator issuing commands reserve_inventory, charge_payment, schedule_shipping with compensations release_inven...
{ "domain": "backend", "task_type": "architecture", "difficulty": "advanced" }
[ { "role": "user", "content": "Design zero downtime migration for 500M row embeddings table." }, { "role": "assistant", "content": "Create new table with desired schema and backfill in batches with checksums, tracking progress via watermark column. Use triggers or CDC to capture writes during bac...
{ "domain": "backend", "task_type": "architecture", "difficulty": "expert" }
[ { "role": "user", "content": "Implement Redis caching with TTL, cache aside, and stampede prevention for product API." }, { "role": "assistant", "content": "Apply cache aside pattern where application checks Redis first then loads from Postgres on miss and populates cache with TTL like 300 secon...
{ "domain": "backend", "task_type": "implementation", "difficulty": "beginner" }
[ { "role": "user", "content": "Implement async worker pool for image thumbnailing with bounded concurrency and backpressure." }, { "role": "assistant", "content": "Create asyncio Queue maxsize fifty holding image jobs to enforce backpressure on upload bursts. Spawn eight workers consuming with aw...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "Optimize Redis session storage with TTL and serialization improvements." }, { "role": "assistant", "content": "Store sessions as MessagePack instead of JSON to cut size 30 percent and CPU. Set TTL 30min with sliding refresh on activity. Use namespaced keys sess:{id}...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "Python traceback TypeError unhashable list using list dict key caching API params. How to fix caching with hashable keys correctly" }, { "role": "assistant", "content": "Lists are mutable and unhashable so cannot serve as dictionary keys, causing TypeError on cache ...
{ "domain": "backend", "task_type": "traceback", "difficulty": "intermediate" }
[ { "role": "user", "content": "Optimize Postgres slow query on orders by date with EXPLAIN and index strategy." }, { "role": "assistant", "content": "Run EXPLAIN ANALYZE showing Seq Scan on 5M rows filtering created_at range. Create B-tree index CREATE INDEX CONCURRENTLY idx_orders_created ON ord...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "npm traceback EINTEGRITY EAI AGAIN overlapping lock files install killed mid run. How to recover cleanly deterministic install" }, { "role": "assistant", "content": "Killed install leaves partial node modules and corrupted cache with integrity mismatch plus DNS retr...
{ "domain": "backend", "task_type": "traceback", "difficulty": "intermediate" }
[ { "role": "user", "content": "SwiftUI list freezes loading high res network images memory spikes scrolling janky. How to fix image pipeline with downsampling and cache" }, { "role": "assistant", "content": "Loading full resolution images on main thread without downsampling exhausts memory, block...
{ "domain": "backend", "task_type": "debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "How to prevent basic XSS and injection in FastAPI templates? I return f'<h1>{name}</h1>' directly from query param. Show safe version." }, { "role": "assistant", "content": "Direct string interpolation renders attacker script. Use Jinja2 autoescape or HTML escape. E...
{ "domain": "backend", "task_type": "security", "difficulty": "beginner" }
[ { "role": "user", "content": "Review React useEffect fetching user mount no deps array setState after fetch no cleanup no error. What to change for correctness" }, { "role": "assistant", "content": "Missing dependency array runs effect after every render causing infinite fetch loop; no cleanup s...
{ "domain": "backend", "task_type": "code_review", "difficulty": "intermediate" }
[ { "role": "user", "content": "Review my JWT auth middleware that stores tokens in localStorage and skips verification on public paths via string contains. Issues?" }, { "role": "assistant", "content": "Flag XSS theft via localStorage, use HttpOnly SameSite cookies instead. String contains for pu...
{ "domain": "backend", "task_type": "code_review", "difficulty": "intermediate" }
[ { "role": "user", "content": "Design event driven order processing with Kafka outbox pattern for reliable delivery." }, { "role": "assistant", "content": "Use outbox table in same Postgres transaction as order write to guarantee atomic publish intent, then relay worker polls and publishes to Kaf...
{ "domain": "backend", "task_type": "architecture", "difficulty": "beginner" }
[ { "role": "user", "content": "SQLAlchemy OperationalError too many connections pytest xdist Pool 20 times 8 workers. How to fix test pooling and isolation" }, { "role": "assistant", "content": "Parallel workers each open independent pools multiplying connections beyond Postgres max connections a...
{ "domain": "backend", "task_type": "traceback", "difficulty": "intermediate" }
[ { "role": "user", "content": "Design pagination and filtering for a product catalog API with cursor stability." }, { "role": "assistant", "content": "Use cursor pagination with opaque base64 cursor encoding sort key and id for stable results under writes. Support limit clamped to max 100, sort w...
{ "domain": "backend", "task_type": "architecture", "difficulty": "intermediate" }
[ { "role": "user", "content": "How to structure FastAPI routers for users and orders with versioning? Show APIRouter usage, prefix, tags, and main app inclusion for v1." }, { "role": "assistant", "content": "Split by resource with APIRouter, version prefix at include time to allow v2 later. Examp...
{ "domain": "backend", "task_type": "architecture", "difficulty": "intermediate" }
[ { "role": "user", "content": "NextJS API CORS error frontend Vercel calls backend EC2 preflight OPTIONS 404. How to configure correctly with credentials and allowlist" }, { "role": "assistant", "content": "Browser blocks cross origin without Access Control Allow Origin on actual and preflight re...
{ "domain": "backend", "task_type": "debugging", "difficulty": "intermediate" }
[ { "role": "user", "content": "How to test database transactions with rollback isolation in FastAPI and SQLAlchemy? I need each test to start clean without truncating tables. Show fixture with nested transaction." }, { "role": "assistant", "content": "Use outer transaction with savepoint rollback...
{ "domain": "backend", "task_type": "testing", "difficulty": "advanced" }
[ { "role": "user", "content": "Review Postgres code string concat queries no transactions unclosed clients. Secure fix?" }, { "role": "assistant", "content": "Issues are SQL injection, partial writes, and connection leaks. Replace concat with parameterized $1 placeholders via asyncpg or psycopg. ...
{ "domain": "backend", "task_type": "code_review", "difficulty": "advanced" }
[ { "role": "user", "content": "Secure backend against SQL injection, XSS, CSRF, SSRF with validation and allowlists." }, { "role": "assistant", "content": "Prevent SQLi with parameterized ORM queries forbidding string interpolation, XSS with output encoding and CSP headers, CSRF with SameSite coo...
{ "domain": "backend", "task_type": "security", "difficulty": "intermediate" }
[ { "role": "user", "content": "Postgres query with JOIN on 10M rows does seq scan 8s. EXPLAIN shows no index on foreign key. How to optimize?" }, { "role": "assistant", "content": "Add B-tree index on foreign key and filter columns, then ANALYZE. Rewrite to select only needed columns, add composi...
{ "domain": "backend", "task_type": "optimization", "difficulty": "intermediate" }
[ { "role": "user", "content": "S3 presigned URL 403 SignatureDoesNotMatch content-type mismatch clock skew. Fix?" }, { "role": "assistant", "content": "Root cause is client sending different Content-Type than signed plus clock drift over 15m invalidating signature. Sign exact headers including co...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "advanced" }
[ { "role": "user", "content": "Prevent SQL injection in raw psycopg2 queries with dynamic filters and sorting. Show safe pattern." }, { "role": "assistant", "content": "Injection comes from f string interpolation of user input into SQL, allowing breakout via quotes or stacked queries. Always use ...
{ "domain": "backend", "task_type": "security", "difficulty": "intermediate" }
[ { "role": "user", "content": "Create simple health check endpoint for backend service with DB and Redis checks." }, { "role": "assistant", "content": "Implement GET /healthz returning 200 with status ok, version, uptime. Check DB with SELECT 1 and Redis PING with 500ms timeout, reporting depende...
{ "domain": "backend", "task_type": "implementation", "difficulty": "beginner" }
[ { "role": "user", "content": "My Node app crashes reading map of undefined when API returns null for items. How to make rendering defensive and type safe" }, { "role": "assistant", "content": "API contract allows null or missing items but code assumes array and calls items map directly throwing ...
{ "domain": "backend", "task_type": "debugging", "difficulty": "beginner" }
[ { "role": "user", "content": "Implement FastAPI pagination with limit offset for products endpoint handling 100k rows." }, { "role": "assistant", "content": "Define query params limit: int = Query(20, ge=1, le=100) and offset: int = Query(0, ge=0). Query with SELECT ... LIMIT :limit OFFSET :offs...
{ "domain": "backend", "task_type": "implementation", "difficulty": "intermediate" }
[ { "role": "user", "content": "How to test FastAPI dependencies with overridden auth for different roles? I need admin and user tests without real JWT. Show dependency_overrides pattern with cleanup." }, { "role": "assistant", "content": "Override auth dependency to return fake users per test, cl...
{ "domain": "backend", "task_type": "testing", "difficulty": "intermediate" }
[ { "role": "user", "content": "My Node backend returns 500 on POST due to unhandled promise rejection. How to debug?" }, { "role": "assistant", "content": "Enable unhandledRejection logging and check stack for failing async handler missing try catch or error middleware. Reproduce with curl and mi...
{ "domain": "backend", "task_type": "debugging", "difficulty": "beginner" }
[ { "role": "user", "content": "Explain idempotency keys for POST payment endpoints and how to implement them safely." }, { "role": "assistant", "content": "Idempotency keys let clients retry safely by keying request fingerprint to stored response, preventing double charges on timeouts. Require cl...
{ "domain": "backend", "task_type": "instruction", "difficulty": "intermediate" }
[ { "role": "user", "content": "Explain keyset pagination for a FastAPI Postgres orders API and why it beats offset for large tables." }, { "role": "assistant", "content": "Use keyset pagination with created_at plus id as tiebreaker to avoid offset drift and keep queries indexed and stable under c...
{ "domain": "backend", "task_type": "instruction", "difficulty": "beginner" }
[ { "role": "user", "content": "Liveness kills slow Java 90s startup probe 10s restart loop. How to fix startup versus liveness versus readiness probes" }, { "role": "assistant", "content": "Aggressive liveness during startup causes restart loop where app never becomes ready despite eventual succe...
{ "domain": "backend", "task_type": "api_debugging", "difficulty": "advanced" }
[ { "role": "user", "content": "Implement backend saga coordinator with state persistence, compensation, timeouts, and monitoring." }, { "role": "assistant", "content": "Persist saga steps with states pending compensating done in DB, drive via state machine with idempotent handlers and heartbeat t...
{ "domain": "backend", "task_type": "implementation", "difficulty": "advanced" }