Imagine a tool that takes a long handbook and produces a shorter extract for a reader. On Monday it writes an extract. On Tuesday the source has a chapter the extractor did not expect. The command refuses to produce a new file, but Monday’s extract is still there. Someone who checks only whether the file exists can find a useful artifact and still draw the wrong conclusion about Tuesday’s run. We tested a document extractor with synthetic inputs to see what its output directory and its command result each tell us in cases like this.

Establish what a successful run produces

The extractor uses an explicit inventory of the document structure it expects. It checks the source against that inventory before writing. One local fixture gave it the same synthetic source and date twice. The output bytes matched, and the test also verified the accompanying digest. That gives a reader a concrete result for a repeated run with those inputs. It does not establish that outputs will match across different inputs or that matching bytes prove a new invocation completed.

A second group of fixtures changed the document’s structure. For instance, an extra chapter, a missing chapter, or duplicate or reordered chapters caused a refusal in the cases that exercised those changes. The extractor needs a way to tell an expected document from one whose organization has changed. Otherwise a reader could receive a shortened file without knowing that the source no longer matched the inventory from which the extract was derived. The fixtures demonstrate how this tool responds to specific changes. They do not cover every way a document can depart from its expected structure.

Look at the directory before and after a refusal

One command-line fixture used an invalid synthetic document and an empty output location. The command returned exit code 2 and reported that it wrote nothing. The fixture checked that neither the extract nor its digest appeared. In that case the missing file and the command result point in the same direction. The command refused the input, and the output directory showed no new artifact at the expected path.

The fixture then placed an earlier extract at that same location and tried the invalid input again. The prior extract retained its text. Now the command can refuse the input even though a reader checking the path still finds a file. Preserving that file is useful because the failed attempt did not overwrite its contents. It also means the file’s existence alone cannot establish that the latest attempt wrote it. This part of the fixture checks the previous extract’s text. It does not test what would happen to a preexisting digest, what a reader might see during concurrent writes, or what persists if a process fails during a write.

Match the artifact to the run you mean

The path, digest, and command status answer different questions. The path tells you whether something is there. A digest can help you compare the bytes you have with bytes identified in an earlier record. The command result tells you whether the particular invocation reported a refusal. If an earlier extract survives after a failed run, a matching digest can be useful evidence about that earlier artifact. Even a matching digest cannot, on its own, tell you that the latest invocation succeeded. In the repeatability fixture, two successful runs produced the same bytes. That is exactly why byte identity cannot distinguish those two attempts. That is why a release or handoff that depends on a fresh extract also needs a result attached to the attempt that was supposed to produce it.

The local suite passed 99 tests at the merged tooling revision. That total includes the extraction fixtures and other tooling tests. The hosted tools job was skipped, so the observations about repeated output and refusal come from the local run. We used synthetic documents, and the tests described here leave interrupted writes and concurrent runs open. The small practical distinction is enough to guide the next check. When a reader sees an extract after a failed invocation, they can ask which run produced the file and what the later command actually reported. Both answers are worth keeping.

← All engineering articles