Repository navigation
Commit a2e42d1
format/zip: an archive that holds real files, exact to the byte
The fourth format and the first container. The entries are not random bytes -
they are real generated files of another format, each one valid on its own.
Asking for five PDFs of 200 kB inside a 3 MB archive gives exactly 3 145 728
bytes, and every extracted PDF opens.
ZIP is the only Tier 1 format whose padding channel has a ceiling, so it is
the only one that really needs both stages of the size strategy: the archive
comment up to 65 535 bytes, then a stored entry above it. Measured: 7-Zip
reports no warning at any comment size up to the limit, and the entry
overhead is a constant plus twice the name length, with data and comment both
counting one for one. Everything is stored rather than compressed, so the
size is a linear function of the parts and planning computes it exactly.
The interesting part is what was removed rather than added.
This project had designed the engine to inject a child producing function
into the archive generator, so the archive would not reach upwards for the
engine. The reasoning was right that reaching for the engine breaks the
layering. The conclusion was wrong: an archive needs the registry and another
generator, and both already sit on its own layer, where a sideways edge is
allowed. So the injection solved a problem that does not exist. It was
removed before it was written and the architecture note now says so.
An abstraction built ahead of a need is a cost, not a safeguard.
Verified with 7-Zip, Windows Explorer, the built in Expand-Archive, and by
extracting the contents and opening them with a PDF reader.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 133bfc3 commit a2e42d1
4 files changed
Lines changed: 385 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
9 | 36 | | |
10 | 37 | | |
11 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
0 commit comments