CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-posthog

Integrate PostHog into any python application.

89

1.03x
Overview
Eval results
Files

rubric.jsonevals/scenario-4/

{
  "context": "This criteria evaluates how well the engineer implements a custom flag definition cache provider that integrates with PostHog's distributed caching system. The focus is on correct usage of the FlagDefinitionCacheProvider protocol methods and proper implementation of file-based locking and caching mechanisms.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Protocol implementation",
      "description": "Implements all four required protocol methods: should_fetch_flag_definitions(), get_flag_definitions(), on_flag_definitions_received(), and shutdown() with correct signatures and return types",
      "max_score": 20
    },
    {
      "name": "File locking mechanism",
      "description": "Uses fcntl module for file locking in should_fetch_flag_definitions() to implement leader election, ensuring only one process fetches at a time",
      "max_score": 20
    },
    {
      "name": "Cache storage format",
      "description": "Stores flag definitions as JSON in the cache file using json.dump() or json.dumps(), including timestamp metadata for staleness detection",
      "max_score": 15
    },
    {
      "name": "Cache retrieval",
      "description": "Implements get_flag_definitions() to read and parse JSON from the cache file, returning None when file doesn't exist or read fails",
      "max_score": 15
    },
    {
      "name": "Staleness checking",
      "description": "Compares cached timestamp against cache_ttl_seconds parameter to determine if cache is stale, triggering refresh when needed",
      "max_score": 15
    },
    {
      "name": "Resource cleanup",
      "description": "Properly releases file locks and closes file handles in shutdown() method to prevent resource leaks",
      "max_score": 10
    },
    {
      "name": "Error handling",
      "description": "Handles file I/O errors gracefully (FileNotFoundError, JSONDecodeError, IOError) without crashing, allowing fallback to API fetch",
      "max_score": 5
    }
  ]
}

Install with Tessl CLI

npx tessl i tessl/pypi-posthog

tile.json