Skip to content

Releases: aftermarket-dev/aftermarket

Aftermarket v0.3.0

Choose a tag to compare

@github-actions github-actions released this 20 Oct 08:19
1794f46

Aftermarket 0.3.0 adds two tools that work as a pair: AfterTest (aftermarket record) and AfterDiff (aftermarket replay).

  • record is a proxy that changes nothing. Every request and answer passes through byte for byte, and each finished exchange is written to a fixture file in the format patch test and adapt test already read.
  • Redaction. Authorization, Proxy-Authorization, Cookie, Set-Cookie and X-Api-Key, and query keys such as api_key, access_token and token, are always saved as REDACTED. A config file can add header names, query keys and JSON fields by dot path, with * for any list element. The traffic itself keeps the real values.
  • Nothing unsafe is stored. Bodies over max_body, binary bodies, compression other than gzip, cut-off bodies, upgraded connections and failed upstreams pass through and are logged as skipped. The fixture file is valid after every case, and record never overwrites one.
  • replay sends each recorded request to two versions of a service, or to one and compares with the recording. It compares status codes, Content-Type and bodies. JSON is compared by meaning, key order and number formatting aside, and every difference is listed by path. --ignore leaves out fields such as timestamps.
  • Safe by default. replay sends only GET and HEAD unless you pass --include-writes. --set-header puts real credentials back for the run.
  • Markdown and JSON reports, and exit code 1 on any difference, for CI.

The customer-api example now shows the whole loop: the old client's twelve checks are recorded against v1, then replayed. Against v2 directly, all twelve answers differ. Against v2 through aftermarket adapt, all twelve are the same.

Recorded results are in test/results. The full format is in docs/record.md.

Aftermarket v0.2.0

Choose a tag to compare

@github-actions github-actions released this 20 Oct 07:38
ad87180

Aftermarket 0.2.0 adds its second tool: AfterAPI (aftermarket adapt). It keeps an old client working after its API was replaced, with one mapping per old endpoint.

  • Endpoint mapping. Path and query parameters move into the new URL, the method can change, and query parameters the mapping doesn't use are passed on as the client wrote them.
  • Templates. The new request body is built from the old one, and the old response shape is rebuilt from the new one: $.customer.id-style paths, $params.name for URL parameters, and $each with $item to turn one list into another. Fields the template doesn't name are left out.
  • Status and error mapping. For example, 201 becomes 200, 204 becomes 200 with a body, and {"error": {"message": ...}} becomes {"message": ...}.
  • Header renames. Credentials are never touched.
  • All or nothing. A request or response that can't be translated safely passes through exactly as it was sent and is logged as skipped.
  • The same tools as AfterPatch: dry run, the audit log (with path patterns instead of values), adapt check and adapt test with the shared fixture format.

The new examples/customer-api has a v1 service, a v2 service and the old client's test suite of twelve checks. It passes against v1, fails every check against v2 directly, and passes every check against v2 through adapt.

Two fixes in AfterPatch, found by the review before this release:

  • A dry run no longer turns a slow response body into a 504. It now waits as long as the upstream takes, so it really changes nothing.
  • A client that stalls while sending a body a rule needs now gets 408 after upstream_timeout, where before it could hold a connection open indefinitely.

set values that are numbers too large for JSON readers, such as 1e400, are now rejected when the rule file loads.

Recorded results are in test/results. The full mapping format is in docs/adapt.md.

Aftermarket v0.1.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 16:02
fa9f1da

The first release of Aftermarket, with its first tool: AfterPatch (aftermarket patch), a reverse proxy that repairs HTTP traffic between a client and a service you can't change, using rules you can read.

  • aftermarket patch run: match on method, path, query, headers, status and content type. Set or remove headers, rewrite paths, and rename, copy, set or delete JSON fields in requests and responses.
  • --dry-run: forwards traffic untouched and logs what every rule would change.
  • An audit log of every change, as JSON lines, with no values in it.
  • aftermarket patch check: validates a rule file and points out overlapping rules.
  • aftermarket patch test: runs saved requests and responses through your rules and compares the results.
  • Traffic no rule matches passes through byte for byte and streams. Bodies it can't change safely are passed on unchanged and logged.
  • A single binary with no dependencies, for Linux, macOS and Windows.

Recorded test results and latency are in test/results in the repository. The full rule format is in docs/reference.md.