Skip to content

Building an adapter

Implement contracts, declare capabilities, and test adapter behavior.

An adapter wraps one backend and declares exactly what it can do.

  • Implement DurableAdapter, EphemeralAdapter, or both.
  • Declare truthful capabilities (git, pr, ttl, etc.).
  • Return stable Ref serialization.
  • Fail with typed GitTrix errors where possible.
const capabilities = {
git: true,
push: true,
fetch: true,
history: true,
pr: false,
ttl: false,
latencyClass: 'regional',
}

Bad capability declarations create bad routing decisions. Keep them strict.

  • Contract tests for every adapter method.
  • Capability-gated behavior tests (e.g., PR strategy fails if pr: false).
  • Baseline conflict tests around promotion.
  • TTL/eviction tests for adapters with native expiration.

Build against real backend semantics, not mock-only behavior.