Case Study - Rebuilding an Undocumented Service Without a Spec

July 15, 2026

2026· amazon· case-study

One-Line Summary

Reverse-engineered an undocumented legacy service’s URL-generation logic and rebuilt it inside a new delivery platform with 100% test coverage, preserving exact behavior for an average of 8.4M+ daily requests with zero written specification to work from.

Context

The team responsible for Kindle’s content delivery experience was rebuilding its entire delivery stack onto a new platform (“v3”). Manifest Delivery Service (MDS) was a core piece of the legacy stack that generated structured sets of URLs for the manifest that instructed clients where to fetch each piece of ebook content. All downstream clients depended on the highly-specified URL structure, and any variation due to missed edge cases would break content delivery for real customers.

There was no written specification for how MDS generated these URLs due to the 15 year old service having passed through multiple defunct teams over the years. The only source of truth was the legacy code itself, plus whatever could be inferred from observed production behavior.

Constraints

  • Reliability. The correct behavior was defined entirely by legacy code with no documentation. Getting any component wrong meant broken content delivery.
  • Scalability. An average of 8.4M+ daily requests meant even a narrow edge case in URL generation logic could affect a large number of customers.
  • Backward compatibility required. Every existing client needed manifests to look and behave identically post-migration, avoiding any negative customer impact.
  • New platform idioms. The new v3 platform had pre-defined implementation standards that the migrated MDS code would have to adhere to.

Discovery: Reverse-Engineering the Spec to Find a Baseline

Since there was no documentation, the work started by reading through the legacy MDS code end-to-end and mapping every distinct URL-generation pattern it produced, including different content/asset types, different delivery mechanisms, and different edge cases, until there was a complete inventory of behaviors the new service needed to reproduce.

Design: Clean the House or Rip it Down

Option A — Translate the legacy code into v3 with minimal changes. Lower risk of behavioral drift since the logic itself barely changes. This would also be the simplest to implement since it just translates logic from one language to another, but it would be porting a decade of technical debt directly into a brand-new platform.

Option B — Reimplement the logic natively in using idioms defined in v3. Gives the new platform a clean, maintainable implementation, but carries real risk: any subtle misunderstanding during the reverse-engineering could range from silent long-running issues to loud and impactful failures at scale.

I chose Option B and used documentation generated during discovery to build a test suite that covered 100% of the usable code in the legacy implementation. This became the gate for determining success of the migration while enabling the refactor of the underlying logic. Any future change that broke a pattern would be caught immediately rather than surfacing as a production incident.

Execution

The manifest-generation logic was built based on the identified patterns and validated locally with the test suite. An accompanying feature CI/CD pipeline was built to run through different stages of unit and integration testing at different scales to simulate a variety of validation scenarios prior to hooking the pipeline to a main release pipeline. The changes were gated behind A/B test hooks for a scalable handover and to reduce the blast radius of any tangential issues onboarding a new service to a new product. Once metrics had been verified across impacted markets, the service was fully scaled and the legacy implementation was taken offline.

Result

The new service correctly handles an average of 8.4M+ daily manifest requests with 100% test coverage on its new components, and the legacy MDS dependency was fully retired. Because every known behavior pattern is now backed by an explicit test, the service has a full coverage regression safety net going forward, supporting a more focused and streamlined core product.