┌──────────────────────────────────────────┐
existing SDK → │ EQUAL record → redacted equal/v1 JSONL │ → original API
└───────────────────┬──────────────────────┘
│ one cassette
┌──────────────────┼──────────────────┐
▼ ▼ ▼
EQUAL replay EQUAL export EQUAL verify
│ │ │
local API server OpenAPI 3.1 JSON candidate implementation
│ │ │
offline development existing API tools field-level JSON report
The cassette is the product boundary. It is not a hidden cache tied to a process or a vendor account. It can be reviewed, edited, versioned, generated by another tool, or read by an implementation in another language. OpenAPI export turns the same observed evidence into a portable artifact for the existing API ecosystem rather than forcing users to stay inside EQUAL.
- The recorder buffers one request up to the configured limit and forwards the original credentials and body to the upstream.
- The upstream response is buffered and returned to the caller without redaction.
- Independent request and response copies are redacted before cassette storage.
- The cassette writer is mutex-protected. Interaction IDs come from request arrival; loading restores ID order after concurrent completions.
- An existing file requires explicit
--overwrite. Optional--fsyncrequests persistence after every entry.
A cassette write failure produces an explicit server error instead of pretending the interaction was captured.
At startup, EQUAL validates the complete cassette and precomputes request keys into queues. Lookup is constant-time on average after startup rather than scanning every interaction per request.
The key contains:
- uppercase method;
- escaped path;
- canonical query encoding;
- canonical JSON body when valid, or exact bytes otherwise;
- explicitly selected headers only.
Common credential values are redacted on both the stored and incoming request before matching. Repeated keys consume their response queue in capture order. Strict mode additionally consumes one global sequence.
There is no upstream field or fallback branch in ReplayHandler. Misses cannot silently become live network calls.
Export reads the same validated cassette and groups interactions by generalized path, method, and response status. Numeric and UUID path segments become explicitly documented inferred parameters. Query presence across observations determines whether a parameter is required.
JSON request and response examples are decoded with arbitrary-precision numbers and converted into observed JSON Schema types. The exporter preserves examples and interaction IDs, emits binary content encodings, and retains alternative responses in a provenance extension. It does not invent unobserved endpoints, provider-wide required fields, or authoritative schemas.
Verification is deliberately separate from replay. It reads stored requests and sends them to the candidate in capture order. Candidate credentials can be injected without changing the cassette.
The comparator checks status and selected headers, then:
- decodes JSON with arbitrary-precision
json.Numbervalues; - treats numerically equal forms such as
1,1.0, and1e0as equal; - preserves object member and array index paths in differences;
- applies explicit JSON Pointer removals, including
*for one wildcard segment; - compares non-JSON bodies byte for byte.
Transport failure is a failed interaction, never a pass. Any difference produces a report and CLI exit code 3.
- No implicit volatile-field detection. Automatically ignoring
idortimestampcan hide the exact incompatibility a test should catch. - No production ingress claims. Buffering, authentication, multi-tenancy, streaming, and rate limiting have different requirements.
- No universal protocol claim. Version 0.2.0 handles ordinary HTTP request-response exchanges, not every network protocol.
- No automatic completeness claim. Observed traffic is evidence about observed behavior only.
The implementation uses the Go standard library only. Release builds disable CGO and produce static binaries for Linux, macOS, and Windows on amd64 and arm64. The JSONL format and CLI exit codes are the compatibility surface; internal Go packages are not presented as a stable public API.