Plan a Parallel Run to Replace a Critical Function: What to Compare, How to Stay Safe, When to Cut Over

You are a staff engineer helping me plan the replacement of a critical function or module using a parallel run, where the old and new implementations both process real inputs and their outputs are compared before anything switches over. Your job is to design the comparison so that it is trustworthy and cannot hurt production.

I will provide: what the old implementation does, why it is being replaced, the new implementation's approach, the inputs and outputs (with sizes and rates), whether it has side effects, and what the cost of a wrong answer is.

Produce a plan with these sections:

1. What may differ and what must not. List the output fields that must match exactly, those that may differ within a tolerance (state the tolerance), and those expected to differ on purpose (for example, the new version fixes a known bug). Define how each difference is classified: match, expected difference, regression, or unknown.
2. Safety. Explain how the new path is isolated so it cannot affect users: the old result is always the one returned, the new code runs with a timeout, its errors are caught and counted, and any side effect (writes, emails, charges, external calls) is disabled or redirected to a sandbox in the new path. Call out side effects I may have forgotten.
3. Sampling and cost. Recommend whether to compare every request or a sample, how to keep the extra load acceptable, and how to make sure rare input types still appear in the compared set.
4. Recording. Specify what is stored for each mismatch: input (with sensitive data removed), both outputs, versions, and timing. Say how long it is kept.
5. Analysis. Describe how mismatches are grouped to find root causes instead of read one by one, and what mismatch rate and volume of unique input shapes give enough confidence to proceed.
6. Cutover and rollback. Define stages (for example a small percentage serving the new result, then more), the exact metrics that trigger a rollback, and how the old path stays available afterwards and for how long.
7. Limits. State plainly what a parallel run cannot prove, such as behavior on inputs that have not yet occurred, and what other tests are needed.

Ask me up to five clarifying questions first only if the answer would change the plan; otherwise state your assumptions and continue.

--- When to use this ---
Use it for replacing pricing, permission, matching, parsing or scoring logic where the right answer matters and a bug would be silent. It is overkill for code that is easy to test directly.

--- How to adapt it ---
For stateful code, add a section on how state is kept in sync between the two paths. For very high volume, fix the sample rate first and ask the model to size the storage.

--- Example input ---
"Replace our shipping-cost calculator, which has years of special cases, with a rules-engine version. Inputs are cart contents and destination; the output is a price in cents; there are no side effects."

--- What good output looks like ---
It requires price matches to the cent, lists the known special cases as expected differences, groups mismatches by destination and product type, and defines rollback if more than a stated share of mismatches are unexplained.

Sign in to upvote this prompt.