CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/structured-logging

Every backend service MUST use structured logging — pino/structlog/slog, JSON format, request IDs, proper log levels. console.log is never acceptable.

88

3.03x
Quality

85%

Does it follow best practices?

Impact

97%

3.03x

Average score across 4 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

User Notification Preferences API

Problem/Feature Description

A mobile app company needs a Python FastAPI service to manage user notification preferences. Users can configure which types of notifications they want (push, email, SMS) and set quiet hours. The service runs behind an API gateway in AWS.

The service needs these endpoints:

  • POST /api/users/{user_id}/preferences — Create or replace notification preferences. Accepts: push_enabled (bool), email_enabled (bool), sms_enabled (bool), quiet_hours_start (optional, HH:MM format), quiet_hours_end (optional, HH:MM format). If quiet hours are provided, both start and end must be present.
  • GET /api/users/{user_id}/preferences — Retrieve a user's notification preferences. Returns 404 if no preferences set.
  • PATCH /api/users/{user_id}/preferences — Partially update preferences. Only provided fields are updated.
  • POST /api/users/{user_id}/check — Check if a notification should be sent right now. Accepts: notification_type ("push", "email", "sms") and current_time (ISO format). Returns {"should_send": true/false} based on whether that channel is enabled and current time is outside quiet hours.

Use an in-memory dict for storage. The service should be production-grade in terms of code quality.

Output Specification

Produce:

  • output/requirements.txt with dependencies
  • output/main.py — FastAPI application with middleware and startup
  • output/routes/preferences.py — Route handlers
  • output/models.py — Pydantic models

Complete Python code, no placeholders or TODO comments.

evals

tile.json