All posts

How to Test an Email Index Without Logging the Email

A litigation-support lead replacing an email index needs to know why search results changed. We tested one message with two delivery dates using a clue from Anthropic’s Rust migration.

A mint shadow route mirrors the bends of a bone route, with a separate checkpoint on each.

Two delivery dates in one message

The email says the delivery is due Friday. It also says Monday. We wrote it that way to test a decision a litigation-support lead has to make when replacing an email index. Should the replacement make Monday searchable when the old index could find only Friday?

We assigned the message one document ID in the test index. The plain-text body says “Delivery is Monday.” The HTML body says “Delivery is Friday.” An email program can choose between the two when it opens the message. The engineer preparing that message for search has a different customer. A reviewer might reasonably want to find either date and see exactly where it appeared.1

Anthropic faced a version of the old-versus-new problem when it moved the service behind Claude’s Messages API from Python to Rust. Its November 25 engineering account describes how the team diagnosed disagreements without putting customer prompts or replies in front of the engineers hunting the bugs. Gergely Orosz put the migration at about five months in his November 25 account of an interview with platform engineering lead Katelyn Lesse. An evidence team could borrow the comparison method and still need to make its own decision about a missing Monday.26

Give both versions the same material

In April the Rust service passed about 98% of its tests. When the team compared inputs on production traffic, only about a quarter matched.2

Those percentages count different things. A test case gets one vote in a suite. On a busy service, a small difference in the treatment of a common character can turn up in request after request. Anthropic gives the example of an emoji that Python escaped when writing a JSON tool call and Rust included literally. A user might see the same character even though the serialized prompts differ by a few bytes.2

Running old and new code side by side has a long history. GitHub described using it for a rewrite of the code that determines who can access a repository. The established version supplies the answer that the user gets. The candidate version runs for comparison. Claude added an awkward complication. Ask a model the same thing twice and it can word its answer differently. Anthropic ran inference once and fed the same stream of model output to Rust. It also had to ensure the extra processing never counted twice toward a customer’s usage.23

For an email processor, the common input can be simpler. Hand both extractors the same original message and give the candidate a separate index. Let the current index answer reviewers’ searches while the candidate earns their confidence. A shadow run that inserts another copy into the live workspace has already changed the result someone came to measure.

The search that tells the two apart

We ran the delivery email through two small indexing policies using Python’s standard email library. The first asked for the preferred body. Python favors HTML over plain text in this message. The second enumerated the two immediate parts. We stripped the paragraph markup from the HTML, split the text into lowercase words, and associated each word with its parent message and the part where it occurred. These are deliberately small rules for a two-part example.4

Try Friday first. Both policies find it. Only the second finds Monday. Now search for the word they share, delivery. Each index returns one email. The old index points to the HTML. The new one also points to the plain text.

The synthetic message contains “delivery” twice. In our test, the search returned one message and identified both parts containing the term.

A team that compares only the number of documents loaded would give both policies a pass. Even a comparison of search counts would miss the change for delivery. Craig Ball explains the distinction in his processing primer. A keyword search consults an index of extracted words and their locations. Opening the resulting document involves a viewer. If that viewer chooses HTML, a reviewer clicking the Monday result needs a route to the plain-text part that supplied the hit.5

What belongs in the bug report

Anthropic recorded the stage at which the two versions first differed, the piece of the prompt involved, the offset where the difference began and information about the lengths. Agents used those clues to invent their own inputs and test a possible explanation. Grouping similar differences gave the engineers a manageable set of problems.2

Our fixture emits a shorter diagnostic. The versions first part company at body selection, the container holds alternatives, the old policy selected one part, and the new one selected two.

That gives an engineer enough information to build a small email and investigate the selection rule. The dates themselves add nothing to this report. In a real matter, the subject and sender would also be unnecessary for diagnosing this selection rule. An authorized reviewer can still inspect the original in the workspace.

There is a limit to that economy. Suppose an error queue includes the exact time of processing, the matter name and the only unusual file type in a small batch. Someone familiar with the batch might recognize a document without seeing a word of its contents. NIST’s guidance on de-identification describes how dates and times can link records to other information. For this fixture the part counts answer the engineering question. Adding the assigned index ID would let someone with access to the lookup table connect the report to a particular item. Keep that link with the people authorized to follow it.7

One disagreement to keep

The mail standard describes alternative parts as representations of the same information. A mail reader has good reason to choose one that it can display. Our fixture deliberately breaks the sender’s side of that bargain. Nothing in its bytes establishes which day the sender intended, what a recipient saw, or when a truck arrived.1

The operator can still settle the search requirement. For this index, a reviewer must be able to find words in either representation, get one result per message, and identify which part supplied each hit. Under that rule the Monday difference is worth keeping. Copying the old behavior would make the disagreement disappear and leave the reviewer unable to find the word. If the assignment had instead been to reproduce the preferred-body view, the very same output would count against the replacement.

A cutover record for this change can be wonderfully short. Keep the synthetic email, the two policy settings and the expected result for each of the three searches. Give the change an owner who can explain why it belongs, and exercise the same checks when either extractor changes. In a real matter, the person carrying yesterday’s searches forward should also hear that their terms can now reach a second representation of a message.

Friday gets the team through a compatibility check. Monday establishes the additional reach it asked for. And delivery confirms that two matching parts still return one message. When the next reviewer opens that email and sees Friday, the litigation-support lead can point to the plain-text part and show exactly why a search for Monday found it.

Sources