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-1/

Inventory Webhook Receiver

Problem/Feature Description

A retail company needs a Go HTTP service that receives inventory update webhooks from their warehouse management system. When the warehouse ships items, adjusts stock, or receives new inventory, it sends a webhook to this service. The service validates the webhook, updates an in-memory inventory map, and returns appropriate status codes.

The service needs these endpoints:

  • POST /webhooks/inventory — Receive an inventory webhook. The request body contains: event_type (one of: "stock_received", "stock_shipped", "stock_adjusted"), sku, quantity (integer, positive for additions, negative for removals), warehouse_id, and timestamp. Validate that all required fields are present and quantity is non-zero. If the SKU doesn't exist, create it. If a shipment would bring stock below zero, reject with 409 Conflict.
  • GET /inventory/:sku — Get current stock level for a SKU. Returns 404 if SKU not found.
  • GET /inventory — List all SKUs and their current stock levels.
  • GET /health — Health check endpoint, returns 200 OK.

Use Go's standard library net/http. The service will run in a Kubernetes cluster with Fluent Bit collecting stdout for Elasticsearch.

Output Specification

Produce:

  • output/go.mod — Module file with dependencies
  • output/main.go — Server setup and entry point
  • output/handlers.go — HTTP handler functions
  • output/middleware.go — Any middleware needed

Complete Go code, no placeholders or TODO comments.

evals

scenario-1

criteria.json

task.md

tile.json