AfterTest and AfterDiff Released to Record Traffic and Compare Versions
Aftermarket 0.3.0 adds two tools that work as a pair. AfterTest, run as aftermarket record, saves real traffic as test fixtures. AfterDiff, run as aftermarket replay, sends those fixtures to two versions of a service and tells you where the answers differ.
The first two tools fix things. These two answer the question that comes before any fix: what actually changed? A new release, a migrated service or a rewritten endpoint can look the same in the docs and still answer differently. The fastest way to find out is to take real requests and ask both versions.
Recording
record is a proxy that changes nothing. You put it in front of a service and point a client, or its test suite, at it:
aftermarket record --upstream http://127.0.0.1:9001 --out recorded.yaml
Every request and answer passes through byte for byte, and each finished exchange is written to recorded.yaml as a case in the fixture format patch test and adapt test already read. You can stop it at any moment and the file is still valid.
Real traffic carries secrets, so redaction comes first. Authorization, cookies, X-Api-Key and query keys such as api_key and token are always saved as REDACTED. A small config file can add more headers, query keys and JSON fields, with * for every element of a list:
redact:
headers: [X-Request-Token]
json: [password, data.*.email]
The client and the service still see the real values. Only the file is blanked. Anything record can’t store safely, such as a binary body, a body over the size limit or a body that was cut off, still passes through, and the audit log says why it wasn’t saved.
Replaying
aftermarket replay --fixture recorded.yaml --a http://127.0.0.1:9001 --b http://127.0.0.1:9002
replay sends each request to both services and compares status codes, Content-Type and bodies. JSON is compared by meaning, so key order and number formatting don’t count. Each difference is listed by path:
- status: 200 vs 404
- customer_id: only in A (7)
- error: only in B (an object)
--ignore data.*.updated_at leaves out fields that change on every call. Without --b, one service is compared with the recorded answers instead.
By default replay sends only GET and HEAD requests, so pointing it at a live service can’t create or delete anything. --include-writes sends the rest, for test services you can reset. It writes a Markdown report, or JSON with --json, and exits with an error when anything differs, so it can run in CI.
The whole loop
The customer-api example from AfterAPI now runs end to end. The old client’s twelve checks are recorded against the v1 service. Replayed against v2 directly, all twelve answers differ. Replayed against v2 through aftermarket adapt, all twelve are the same. That’s the proof that the mapping works, taken from traffic instead of from a hand-written test.
The quick start has a third part that runs this loop. The full format is in the AfterTest and AfterDiff reference, and the binaries are on the download page. How they were tested covers what the tests check and what the review found.