Knowledge that lasts / 18SI · L00P.AI

A partial file and the last valid edition

An export error does not tell you what remains at the file path. Four paths in our own data-handoff trial show when old bytes survive and when they disappear.

2026-11-20 · 1.0 · PL / EN

01 / What remains after an error

An export reports an error. Does the reader still have the previous valid edition? That depends on where the program started writing the new bytes. An export failure message alone does not describe the state of the file intended for reading.

Our small trial compares writing directly to the destination with preparing a separate candidate. We used a fictional JSON record, without client documents. We checked retained bytes and parsed data. We did not interrupt the process or the power supply.

02 / Two editions and a deliberately missing ending

The old record contained edition 1.0 and value 7; the expected new record contained edition 1.1 and value 8. The title remained unchanged. Both complete UTF-8 representations were 65 bytes long. We took only the first 62 bytes of the new representation, through the colon after the field name value. The value, closing brace and final newline were missing.

Each of the four paths had its own destination file, initially containing the old edition. We did not repair one damaged file in successive steps. Expected outcomes were recorded before execution; the script, inputs, remaining temporary files and report were preserved.

03 / Four different outcomes

The direct-write path opened the destination in wb mode, wrote the deliberate prefix and closed the file. JSON parsing rejected the result. That path now held the 62-byte prefix; the previous 65 bytes were gone. The parser error did not restore the old edition.

In the second path, the same prefix went into a separate temporary file in the destination's directory. We closed the candidate before reading it. The parser rejected the data; no replacement was performed. The destination retained the exact old bytes, and the rejected candidate remained available for inspection.

The third path wrote the complete new data into a separate temporary file. After closing it, we read it and compared the entire record with the expected record. Only the matching candidate replaced the destination through os.replace. Reopening the destination confirmed the new bytes and record; the candidate's former pathname no longer existed.

The fourth candidate was syntactically valid JSON but contained edition 9.9. The parser accepted it. Comparison with the expected record rejected it, so the destination still contained the old edition. Valid syntax does not mean the right edition.

Four paths: direct prefix loses old bytes; separate prefix and wrong edition retain 1.0; complete matching candidate yields 1.1. One trial, 29 controls, no power loss.
DEST 1.0 + direct prefix write -> JSON error; old bytes lost
DEST 1.0 + separate prefix     -> reject; DEST still 1.0
DEST 1.0 + complete record 1.1 -> match; replace; DEST 1.1
DEST 1.0 + valid JSON 9.9      -> wrong edition; DEST still 1.0

04 / What acceptance should check

Record the expected edition and data scope before exporting. Prepare the candidate separately, finish writing it, read its actual bytes and check the acceptance conditions. Comparing the entire fictional record was sufficient for our declared protocol. It is not a universal validator for arbitrary JSON.

After replacement, reopen the destination and compare it with the accepted candidate. Record the replacement and verification outcomes. Our trial did not cover failure of os.replace itself, so we do not present that path as accepted.

Batch import examines a database transaction boundary. Here the boundary is handing a file to its reader. HTML, Markdown and JSON parity instead requires comparison across exports. Successfully replacing one file does not confirm agreement across the entire set.

05 / Scope of the result

In one sequential trial performed on 20 November 2026 with Python 3.11.11 on Windows, all 29 recorded controls met their expectations. They cover four paths, not 29 independent experiments. A separate inspection of preserved artifacts compared literal bytes, parsing outcomes and 19 manifest hashes. It was not a second-model review.

Deliberately writing a prefix and closing a file normally do not simulate sudden computer shutdown. No fsync was used. We did not test simultaneous readers and writers, locks, storage resilience or power loss. The result establishes no general Windows atomicity guarantee or post-crash durability. It also does not cover publishing several files as one indivisible edition.

06 / Sources and responsibility

The basis is our ND05 protocol, script and preserved four-path results. Python 3.11 documentation describes the JSON reads, named temporary file and pathname replacement used here. Its current 3.11.18 revision does not change the version used in the trial. The cited sections were checked on 20 November 2026; we do not claim to have read the complete manuals.

The Codex agent prepared the fictional data, PL/EN text and diagram, performing editorial and checking roles. No third-party data or illustrations were used, and no independent second-model review was received. A different outcome under these conditions, a changed contract or extending the scope to crashes and multiple readers requires new acceptance. After your export fails, do you check the message or the actual file contents?