Phased Adapter Expansion

When scaling a plugin architecture, ship configuration and data files first (before any code), tier new plugins by API complexity, and close with registry-level consistency tests. This ordering catches integration mismatches early and keeps each phase independently shippable.

Tags

Phased Adapter Expansion

The Lesson

When scaling a plugin architecture, ship configuration and data files first (before any code), tier new plugins by API complexity, and close with registry-level consistency tests. This ordering catches integration mismatches early and keeps each phase independently shippable.

Context

GTMLeads is a signal intelligence pipeline that ingests data from multiple public APIs (GitHub, Federal Register, NVD, etc.) through a registry of adapter plugins. After the initial 5 adapters were stable, the project needed to add 5 more (SEC EDGAR, arXiv, HN Algolia, Semantic Scholar, Reddit). The adapters share a common base class but each has unique API conventions, rate limits, and response formats. The expansion was planned as a 4-phase effort across ~1,500 lines of new code.

What Happened

  1. Phase 1 (config-first): Added all 5 new sources to sources.json, their query templates to query-templates.json, and source quality scores to scoring.py — before writing a single adapter class. This forced early validation that the data model could represent every new source.
  2. Phase 2 (Tier 1 — well-documented APIs): Implemented SEC EDGAR, arXiv, and HN Algolia. These had the best-documented APIs and simplest auth models, so they served as the test bed for the adapter expansion pattern.
  3. Phase 3 (Tier 2 — complex APIs): Added Semantic Scholar and Reddit. Reddit required OAuth token handling and a more complex normalization step. By this point the patterns from Phase 2 were proven and reusable.
  4. Phase 4 (verification): Added registry consistency tests that check every source in sources.json has a corresponding adapter in ADAPTER_REGISTRY, and vice versa. Also ran live smoke tests against real APIs and documented the results.
  5. A post-expansion fix (7b9b47e) revealed that two Tier 1 adapters had bugs only visible against real API responses — the SEC EDGAR response used different field names than the PDR assumed, and arXiv used HTTP instead of HTTPS causing 301 redirects. The Phase 4 consistency tests caught these only partially; the live smoke tests caught them fully.

Key Insights

Applicability

This pattern applies whenever you are adding multiple plugins, integrations, or data sources to a system that already has a working registry pattern. It is less useful for a greenfield system where the plugin contract itself is still evolving — there, you want one adapter end-to-end before generalizing.

Related Lessons

Related Lessons