Imported from baohonf/awa-samples (
00-器官供体/ccb-ecosystem/JuliusBrussee__caveman/packages/sdk/parity/AGENTS.md). Install upstream withnpx skills add baohonf/awa-samples --skill parity. Copyright stays with the author.
packages/sdk/parity — the cross-language SDK conformance contract
One language-neutral fixture file, run by both SDKs. The load-bearing honesty property
of the SDKs: the wire contract is one thing, expressed twice (@caveman-ai/sdk TS +
caveman_cloud Python). A field present in one SDK and absent in the other makes one side's
assertion fail — so this folder is a release gate, not documentation.
Layout
fixtures.json— the contract. Aconfig(one Cave), the named header sets (std_headers/std_headers_traced/std_headers_async_traced/otlp_headers), and an orderedoperationslist. Each operation carries itsinput, a cannedresponse(ortransport: "error"to force a byte-safe pass-through), and anexpectblock:wire(method,path,headers, and either an exactbodyor abody_keysset) plus aresult(orresult_from: "response").
How it's enforced
- TS half:
../typescript/tests/parity.runtime.mjs(mocksfetch). - Python half:
../python/tests/test_parity.py(mocksurllib.request.urlopen). - Each half has a per-operation handler that performs the real SDK call, captures the wire, and normalizes the result to canonical snake-keyed values. Both iterate every operation; a missing handler is a failure, never a skip.
Editing rules
- Add a field/method to one SDK → add the operation (or body key) here → the other SDK's half goes red until it matches. That red is the point.
- Headers are compared key-lowercased (Python's
urllibcapitalizes them); the SET + values must match across languages. - Keep values that encode identically in both languages (e.g. avoid
! ( ) *in expand refs — JSencodeURIComponentand Pythonquotedisagree on those). - Nothing random may reach an assertion. Ids the SDK would otherwise mint (trace id, span id) are injected through the operation
inputand pinned in the expected header set — the same wayotlp_exportpins its span ids. - Run:
make product-test PRODUCT=sdk-ts&&make product-test PRODUCT=sdk-python.
See ../typescript/CLAUDE.md · ../python/CLAUDE.md