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

Personalized Content Feed API

Build a Node.js Express API for a social media app's personalized content feed.

GET /api/feed/:userId

Query parameters: page (default 1), limit (default 20)

The endpoint constructs a personalized feed by pulling data from multiple services:

  1. Social Graph Service (https://social.internal.example.com/api/users/:userId/following) -- returns the list of accounts the user follows.
  2. Posts Service (https://posts.internal.example.com/api/posts/feed) -- POST with the list of followed user IDs to get recent posts, sorted by recency.
  3. Ads Service (https://ads.internal.example.com/api/placements) -- returns sponsored content to intersperse in the feed based on user demographics.
  4. Notification Badge Service (https://notifications.internal.example.com/api/users/:userId/unread-count) -- returns the count of unread notifications to display in the response header.

Return a combined response:

{
  "userId": "user-123",
  "feed": [
    { "type": "post", "id": "post-1", "author": "user-456", "content": "...", "timestamp": "..." },
    { "type": "ad", "id": "ad-1", "sponsor": "Acme Corp", "content": "...", "cta": "Learn more" },
    { "type": "post", "id": "post-2", "author": "user-789", "content": "...", "timestamp": "..." }
  ],
  "pagination": { "page": 1, "limit": 20, "hasMore": true },
  "unreadNotifications": 5
}

The social graph and posts services are critical -- without them there is no feed. The ads and notification services are supplementary features.

Output

Produce TypeScript files in a src/ directory:

  • src/index.ts -- Express server with the feed route
  • src/services/socialGraph.ts -- fetches following list
  • src/services/posts.ts -- fetches posts for feed
  • src/services/ads.ts -- fetches ad placements
  • src/services/notifications.ts -- fetches unread count
  • src/types.ts -- TypeScript interfaces

Do not include test files or build configuration.

evals

scenario-1

criteria.json

task.md

tile.json