Video in progress

Staff 🧪 Testing

You're being asked to copy prod data to test and staging environments. How do you decide?

I'm against a direct copy of prod: the risk from personal data, payment details and legal requirements (Uzbekistan's personal data law, GDPR) is high. Instead I provide synthetic data generation, or, if needed, a subset that has gone through a pipeline with irreversible anonymization.

📖 Answer

Why they ask: testing with the real data volume and its "odd" cases, which is where many bugs come from. The need is real, and just refusing isn't enough.

The risks:

  • access control on staging is weaker than on prod: more people, less auditing;
  • email/SMS from a test environment can end up going to real users;
  • where the data is stored may not meet legal requirements.

Options and trade-offs:

Approach Realism Risk Cost
A full prod copy high very high low
A masked copy high medium (re-identification) medium
Subset + anonymization medium-high low medium
Synthetic generation depends on prod statistics very low high upfront

The combination I pick: for volume and performance tests, a synthetic generator (distributions taken from prod statistics: number of courses, review length, order dynamics). For reproducing edge cases, an automated pipeline: a subset → names, phones, emails and card numbers are replaced with deterministic fake values (the same input gives the same output, so joins don't break) → free-text fields are wiped → an automatic check "no real phone format remains".

An extra control: in test environments, outbound sending (email, SMS, push, payments) goes only through a sandbox or a catcher (like MailHog), enforced at the code level, without relying on configuration that might be wrong.

The decision should be in writing: an ADR agreed with the security and legal teams. This is an organizational decision, not a technical one.