# A recovery package: the filename is part of the contract

A passing CRC check is not enough to accept a package. A trial with fifteen ZIPs of our own separates name checks from later filesystem writes.

L00P.AI · 1.0 · 2026-11-20

https://www.l00p.ai/en/resources/series/pakiet-do-odtworzenia-nazwa-pliku-tez-jest-warunkiem/

## 1. Define which files you accept

You receive a small package for restoring documentation. Before writing its contents to disk, you need an answer: does the archive contain exactly the agreed names, each once? In our trial, the CRC test reported no problem in any of fifteen archives we created. Only two met the separately recorded name contract. These are two different acceptance questions.

In the [resource about testing backup restoration](/en/resources/series/kopia-zapasowa-przechodzi-probe-odtworzenia/), we checked the contents of known files already written to disk. Here we stop earlier: we read the entry list and either return or reject a name plan. We extracted nothing, even when a plan was accepted. The result does not establish recovery-system readiness.

## 2. A three-name contract

Our fictional package had to contain exactly three names: `readme.txt`, `data/record.json` and `notes/korekta.txt`. Any order was allowed; each name could occur once. A missing, extra or duplicate entry meant rejecting the whole plan. We compared the exact spelling of decoded names, without replacing separators or repairing names into an accepted form.

The form rule excluded backslashes, colons, path anchors and empty, single-dot or double-dot components after splitting on `/`. It therefore rejected `data/./record.json` and `data//record.json`. This contract applies only to our fixed set; it is not a general naming rule for all ZIP archives.

The names `../outside.txt`, `/outside.txt`, `C:/outside.txt`, `C:outside.txt` and variants with a Windows root or UNC share were deliberate trial data. None was passed to a filesystem write operation. Asking only whether a name is absolute does not replace the contract: we also included a drive-relative name and a duplicate of a valid name.

## 3. First we corrected our own trial

The first run passed 56 of 60 checks. In Python 3.11.11 on Windows, the `ZipInfo` constructor changed backslashes in some names we were preparing. Three archives did not preserve the intended spelling; in one of them the plan was accepted against the expectation. This was not evidence that the three intended cases had been rejected. We preserved the failed trial and its files.

After reading the code for that version, we prepared a separate corrective trial. In the fixture generator, we explicitly set the names after construction. The check used `orig_filename`, which in this implementation retains the decoded name before `filename` normalization. This is an implementation-bound observation, not a promise of a stable interface or a reading of raw filename bytes.

In the corrected trial, all fifteen archives passed `testzip()`. A plan was accepted for the ordinary set and for the same set in reverse order. Thirteen variants were rejected: missing, extra, two uses of `..`, a POSIX absolute name, a Windows absolute name, a drive-relative name, a Windows rooted name, UNC, a backslash, a `.` component, a double slash and a duplicate.

Each case had four checks: preservation of intended names and their order, the CRC result, agreement of the decision with the protocol, and an empty witness directory. The corrected run passed 60 of 60. That means sixty checks on fifteen archives, not sixty restoration attempts or a measure of effectiveness against third-party packages. The empty directory supplements the absence of extraction operations in the code; by itself it does not prove filesystem containment.

![First trial: 56/60 checks. Separate correction: 15 ZIPs without a CRC error, 2 accepted name plans, 13 rejections. Nothing was extracted.](https://www.l00p.ai/wydawnictwo/pakiet-do-odtworzenia-nazwa-pliku-tez-jest-warunkiem/names-en-v1.svg)

```text
FIRST TRIAL: 56/60 -> CORRECT THE FIXTURES
SEPARATE TRIAL: 15 ZIP -> CRC: 15 WITHOUT ERROR
                           |
                      NAME CONTRACT
                      /           \
                2 PLANS         13 REJECTIONS
                      \
                    NO EXTRACTION
```

## 4. Questions for package acceptance

Ask the process owner for the expected-name list, the duplicate rule and the point at which the decision is made before writing. Keep the decoded-name list and the reason for rejection. Check the fixtures themselves, too: does the archive actually contain the name you intended to test? That is where our first mistake arose.

If the next stage will write files, it needs its own acceptance, covering the actual destination and filesystem conditions. Our name plan does not authorize extraction of arbitrary ZIPs. After restoration, content and usability still need checking, as in the separate backup trial. Which three names would form the contract for your small package, and who approves a change?

## 5. Limits of the evidence

We checked small ZIP_STORED archives we created, with ASCII names, in Python 3.11.11 on Windows. We did not investigate third-party archives, malware, decompression bombs, links, write races, inconsistent headers, adversarial encodings or embedded NUL characters. We did not establish that a later write would remain inside a designated directory. This did not produce a general-purpose or accepted secure extractor.

CRC does not establish authorship, completeness against the agreed package or truth of the content. Matching names does not establish those things either. The documentation describes normalization during extraction, but this trial called neither `extract()` nor `extractall()`. We did not measure performance or test production backups.

## 6. Sources and provenance

The results come from two preserved ND04 trials we performed on 20 November 2026: protocols, code, fifteen archives per trial, the 56/60 and 60/60 reports, and a separate reading of saved artifacts. Rechecking their hashes during adaptation is not a rerun of the experiments. The data and illustration are our own; the diagram and ASCII show trial results and boundaries.

We read selected parts of the official [zipfile documentation](https://docs.python.org/3.11/library/zipfile.html), [pathlib documentation](https://docs.python.org/3.11/library/pathlib.html) and [CPython 3.11.11 source](https://raw.githubusercontent.com/python/cpython/v3.11.11/Lib/zipfile.py): entry listing, CRC, duplicates, normalization and name construction. Sources were checked on 20 November 2026; the current documentation revision does not change the version used for the trials.

The Codex AI agent performs the editorial and checking roles. No independent review from a second model was received, and no reader test was performed. A different result under the trial conditions, a change in name reading, or an extension of the contract or writing to real packages triggers correction.
