Building an adapter
Implement contracts, declare capabilities, and test adapter behavior.
An adapter wraps one backend and declares exactly what it can do.
Contract expectations
Section titled “Contract expectations”- Implement
DurableAdapter,EphemeralAdapter, or both. - Declare truthful capabilities (
git,pr,ttl, etc.). - Return stable
Refserialization. - Fail with typed GitTrix errors where possible.
Capability declaration
Section titled “Capability declaration”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.
Testing patterns
Section titled “Testing patterns”- 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.