CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/graceful-degradation

Every external call needs a timeout, every timeout needs a fallback — resilience patterns for HTTP, databases, and third-party services

88

4.72x
Quality

90%

Does it follow best practices?

Impact

85%

4.72x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Order Enrichment API

Build a Node.js Express API endpoint that enriches order data by combining information from multiple internal microservices.

GET /api/orders/:orderId/details

Given an order ID, fetch and combine data from:

  1. Order Service (https://orders.internal.example.com/api/orders/:orderId) -- returns the base order: items, quantities, timestamps, customer ID.
  2. Shipping Service (https://shipping.internal.example.com/api/shipments?orderId=:orderId) -- returns tracking number, carrier, estimated delivery date, current status.
  3. Payment Service (https://payments.internal.example.com/api/payments?orderId=:orderId) -- returns payment method, amount charged, payment status, transaction ID.
  4. Inventory Service (https://inventory.internal.example.com/api/stock/check) -- POST with item IDs from the order to get current stock levels for each item.

Return a combined response:

{
  "order": {
    "id": "order-456",
    "items": [{ "productId": "prod-1", "quantity": 2, "price": 29.99 }],
    "customerId": "cust-789",
    "createdAt": "2025-03-15T10:30:00Z"
  },
  "shipping": {
    "trackingNumber": "1Z999AA10123456784",
    "carrier": "UPS",
    "estimatedDelivery": "2025-03-20",
    "status": "in_transit"
  },
  "payment": {
    "method": "visa_ending_4242",
    "amount": 59.98,
    "status": "captured",
    "transactionId": "txn-abc123"
  },
  "inventory": [
    { "productId": "prod-1", "inStock": 145 }
  ]
}

The order service data is required -- if it fails, return a 404 or 500. The other three services (shipping, payment, inventory) provide supplementary data.

Authentication: all services use mTLS, no additional auth headers needed.

Output

Produce TypeScript files in a src/ directory:

  • src/index.ts -- Express server with the enrichment route
  • src/services/orders.ts -- fetches base order data
  • src/services/shipping.ts -- fetches shipping status
  • src/services/payments.ts -- fetches payment details
  • src/services/inventory.ts -- checks stock levels

Do not include test files or build configuration.

evals

tile.json