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:
| Ask | Answer | Not asked |
|---|---|---|
| How many invoices, and in which states? | 3 paid, 1 void, 1 draft | Amounts, names |
| Is any currency different from the account's? | Yes, 1 | Which customer |
| Created before the plan change of 2025-03? | Yes | The exact date |
| Longest name, and does it have characters outside ASCII? | 61, yes | The name |
| Any reference to a deleted row? | 1 | The 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 invoice | total | What it shows |
|---|---|---|
| void, USD | NaN | The reported symptom |
| void, EUR | 200 | Void alone is not enough |
| paid, USD | NaN | Void is not needed |
| draft, USD | 100 | A draft is filtered out before its rate is read |
| draft, EUR | 100 | The 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#
| Explanation | Check |
|---|---|
| A condition you have not asked about | Compare the two accounts column by column: is NULL, is empty, length class |
| State outside the database | Cache keys, feature flags, search index, a third party's record |
| History and not state | Data written by an old release that the current code cannot create |
| Time or load | The 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#
- The seed script, and the commit it was run on.
- The minimal conditions, with which of them were removed without effect.
- The expected and the actual result.
- The count of production accounts that match, and who ran the query.
- 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.