Imagine importing three fictional reference notes. Two are accepted, and one is refused because it exceeds a size limit. The command has useful work to report, but the three inputs did not all reach the same outcome. An operator looking at a nonzero exit status still has a decision to make. Would repeating the same import address any of the outstanding items? We examined an importer that gives a temporary error and a refusal different exit codes. In a local fixture that combined both, the code changed on the second attempt even though one item still remained refused.

Distinguish a refusal from a failed attempt

The importer summarizes the outcomes it has for individual items into one exit status. In a fixture with two created items and one refused item, the fake transport recorded the two creates and the command exited with code 4. The positive count answers how many items the fixture recorded as created. The exit status tells the caller that at least one refusal remains. Repeating the same input is outside the remedy this code describes. In the fictional size example, the item itself would need attention before the operator could expect a different result.

A separate set of inputs produced only refusals. With the fake transport, nothing was created, the command still returned 4, and the report described refusals without a retry hint. Comparing these cases gives the status a precise meaning. An exit code of 4 can accompany two successful creates or no creates at all. A caller that needs to know which work is already accounted for has to read the item report. The same code cannot encode every item’s result and still serve as a simple signal for the batch.

Give a retryable item priority

Now add a temporary error to the example. A second note reaches the importer but the attempt to save it fails in a way the command classifies as retryable. The oversized note is still refused. In the checked-in fixture for this combination, a fake transport supplies a refusal and an error that it emits only once. The first attempt returns code 3. The fixture then invokes the command again with the same run key. The scripted error clears on that attempt and the command returns 4 because the refusal remains.

The change in code describes a change in what remains to address. On the first attempt the command has an item classified as eligible for another attempt. After that condition clears, the remaining outcome calls for inspecting the refused input. Code 3 does not promise that a rerun will work. Code 4 after a rerun does not imply that the original refusal got worse. Both interpretations would give the code more meaning than the fixture supplies. The fake transport controls the error and its resolution, so the test measures the importer’s response to those outcomes.

Read the code alongside the mode

Zero also needs context. The tests exercised a successful apply and a rerun in which the items were already present. Both returned zero. The classifier also returned zero for a fixture containing only a deliberately skipped item. A successful exit can therefore describe a completed invocation that had no items to create. An offline planning run returned zero as well, even though its purpose was to prepare a plan without writing anything. A separate check-only fixture went the other way. Its simulated plan reported a predicted refusal and the command returned 4. The mode tells us whether a result came from applying changes, planning them locally, or checking what a simulated plan would report.

The unit suite passed 55 tests locally on the merged importer revision. A hosted tools job separately reported 66 passing tests across the importer’s unit and integration suites. The examples here come from the inspected fixtures, including the scripted transition from 3 to 4. They do not tell us how often real errors clear or what happens when several callers rerun an import at once. When reading a result, start with the command’s mode, then use the exit status to see which class of outcome still needs attention. The item report is where the remaining work becomes specific enough to act on.

← All engineering articles