Learning center

Hand over a bug that needs one production account's state

Describe the account as conditions, build a synthetic account that satisfies them, and change one at a time. The receiver gets a seed script, and no customer row leaves production.

Conditions, not a copy#

A copy of the account reproduces the bug and tells nobody which part matters. It also moves personal data into places with weaker protection. Conditions are smaller than a copy and easier to reason about.

Ask questions whose answers are counts, flags and shapes:

AskAnswerNot asked
How many invoices, and in which states?3 paid, 1 void, 1 draftAmounts, names
Is any currency different from the account's?Yes, 1Which customer
Created before the plan change of 2025-03?YesThe exact date
Longest name, and does it have characters outside ASCII?61, yesThe name
Any reference to a deleted row?1The row

Whoever has read access runs the queries. Count aggregates over one account can still identify it, so the answers stay in the ticket's access group.

Change conditions one at a time#

The fixture is a function that sums invoices in an account's currency:

function total(account) {
  return account.invoices
    .filter((i) => i.state !== 'draft')
    .reduce((sum, i) => sum + i.cents * account.rates[i.currency], 0);
}
const base = { rates: { EUR: 1 }, invoices: [{ state: 'paid', currency: 'EUR', cents: 100 }] };
const add = (state, currency) =>
  total({ ...base, invoices: [...base.invoices, { state, currency, cents: 100 }] });

The account has a void invoice in USD. Change one condition at a time:

Added invoicetotalWhat it shows
void, USDNaNThe reported symptom
void, EUR200Void alone is not enough
paid, USDNaNVoid is not needed
draft, USD100A draft is filtered out before its rate is read
draft, EUR100The control for the row above

Without the third row, the first two suggest that void and USD must occur together. A control that changes the state and the currency at once, such as comparing the paid EUR invoice with the draft USD one, cannot tell which of them mattered.

The condition is an invoice that is not a draft, in a currency without a rate. That is the description of the bug, and it also finds the other affected accounts: a query for those invoices counts them. A query for void ones would have missed every paid one. The void EUR row adds a second question, whether void invoices belong in the sum.

When the synthetic account does not fail#

ExplanationCheck
A condition you have not asked aboutCompare the two accounts column by column: is NULL, is empty, length class
State outside the databaseCache keys, feature flags, search index, a third party's record
History and not stateData written by an old release that the current code cannot create
Time or loadThe same account fails only at certain hours

The third row matters for seeding. If you build the account through the current user interface, you cannot create what an old version wrote. Insert the rows directly, and record which release could have written them.

What to hand over#

  1. The seed script, and the commit it was run on.
  2. The minimal conditions, with which of them were removed without effect.
  3. The expected and the actual result.
  4. The count of production accounts that match, and who ran the query.
  5. What you could not compare.

Worked example#

This example is fictional. Support asks for a copy of one account to debug a blank total. Ana answers with five questions instead. The seed with the condition above fails at once. The count query returns 41 accounts, so the priority changes before anyone has seen a customer's name. Ben fixes the missing rate, and then asks the product owner whether void invoices should be in the sum at all.

For browser state, see replaying a signed-in state. Return to handing over evidence.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading