Skip to content

GL-340: Consolidate duplicate Python SDKs + add resiliency tests #46

Description

@discodone

Review source

Round 14 (Opus 4.8 + Gemini) — DX. Two competing Python SDKs.

Problem

  1. Two Python SDKs exist: sdk/grantlayer/client.py vs sdk/python/grantlayer_client.py — which is canonical? This is confusing and a maintenance hazard.
  2. SDK tests primarily cover happy-path. They would be more robust if they also tested resiliency against unexpected server errors (500s, malformed JSON, timeouts).
  3. PII/GDPR consideration for webhook DLQ: webhook_delivery logs the entire payload to the dead-letter queue (Redis) on failure (workers/jobs.py). If the payload contains PII it could be stored indefinitely.

Fix

  • Pick ONE canonical Python SDK (the httpx-based async one), delete or alias the other, update all imports and docs
  • Add SDK resiliency tests: mock 500 responses, malformed JSON, connection timeouts — assert the SDK retries/raises cleanly
  • Webhook DLQ: redact or hash PII fields before storing failed payloads in Redis, OR add a TTL on DLQ entries so they don't persist indefinitely

Acceptance Criteria

  • Exactly one canonical Python SDK; the duplicate is removed/aliased
  • SDK tests cover 500s, malformed JSON, timeouts
  • Webhook DLQ entries are PII-safe (redacted or TTL'd)
  • mypy clean, ruff clean, tests >= baseline

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions