Using spec to Transparently Replace a Legacy System
summary
Replaces a legacy targeting engine by treating it as a black box: parse days of access logs to extract inputs, write Clojure spec that parses and generates thousands of real requests, replay them against a new engine behind Amazon API Gateway, and compare outputs across thousands of samples. Works on a client with ~4,000 properties, tens of millions of members and ~10,000 active offers. Finds subtle mismatches including a bug that served English instead of French, and achieves zero downtime and no client code changes.
AI-written summary · about
chapters (17)
- 0:00Start
- 1:46What the targeting engine does
- 2:59User begins booking a hotel room
- 6:05Finding request data
- 6:30Parsing logs
- 11:15Example response
- 13:04Questions to answer
- 14:16Request rewriting
- 14:56Payload rewriting
- 15:39New architecture
- 15:58Use spec to test the new system
- 17:51Verifying the correctness of booking abandon
- 19:32Example: missing offers
- 21:36Deploying using API gateway
- 22:14Route traffic via the gateway
- 22:32Switch API gateway config to go live
- 23:58Final thoughts
related talks
38mLiving with Spec
24mSpeculative Development
38mAbove and beyond type systems with clojure.spec
30mBreak the API Test Data Bottleneck: Real Scenarios on Real Systems
44mSeamless Upgrades: Mastering API Compatibility
43mspec loves data structures
44mGenerative Integration Tests
34mTesting legacy code when you dislike tests (and legacy code)
