CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/separation-of-concerns

Enforce strict three-layer architecture: thin HTTP routes, pure service logic with domain errors, isolated data access with dependency injection.

94

1.08x
Quality

93%

Does it follow best practices?

Impact

97%

1.08x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-2/

{
  "context": "Tests whether the agent uses constructor/factory injection so that services receive their dependencies (repos, email clients) rather than importing them directly, enabling unit tests with mocked dependencies.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Factory/constructor injection",
      "description": "The notification service is created via a factory function or class constructor that accepts its dependencies (e.g., userRepo, emailClient) as parameters — it does NOT import them directly at module level",
      "max_score": 12
    },
    {
      "name": "Dependencies typed as interfaces",
      "description": "Dependencies accepted by the service are typed as interfaces or abstract types (not concrete classes), so they can be swapped for mocks",
      "max_score": 8
    },
    {
      "name": "Tests use injected mocks",
      "description": "Unit tests create the service by passing mock/stub objects for dependencies — not by monkey-patching imports or using module mocks",
      "max_score": 12
    },
    {
      "name": "No direct imports in service",
      "description": "The service file does NOT have top-level imports of concrete repository implementations or email client SDKs — these come in via injection",
      "max_score": 10
    },
    {
      "name": "Wiring shows real deps",
      "description": "wiring.ts (or equivalent) shows how to instantiate the service with real production dependencies using the same factory/constructor",
      "max_score": 8
    },
    {
      "name": "No HTTP in service",
      "description": "The notification service file does NOT reference req, res, request, response, ctx, or import any HTTP framework module",
      "max_score": 8
    },
    {
      "name": "Routes pass plain data",
      "description": "Route handlers extract userId and other parameters from the request and pass plain values (not req/res) to the service",
      "max_score": 8
    },
    {
      "name": "Service throws domain errors",
      "description": "The service throws typed domain errors (e.g., NotFoundError) rather than HTTP errors or generic strings when a user is not found",
      "max_score": 8
    },
    {
      "name": "Routes map errors to HTTP",
      "description": "Route handlers catch domain errors from the service and map them to appropriate HTTP status codes",
      "max_score": 8
    },
    {
      "name": "No SQL in service",
      "description": "The service does NOT contain direct database queries — it delegates data access to the injected repository",
      "max_score": 8
    },
    {
      "name": "Tests are self-contained",
      "description": "Tests do not require network access or a real database — they run entirely with in-memory/mock dependencies",
      "max_score": 10
    }
  ]
}

evals

tile.json