feat: add bounded Quantum cabinet extraction

This commit is contained in:
2026-07-22 19:23:00 +02:00
parent 531612829d
commit a7b1cd7d16
20 changed files with 1099 additions and 66 deletions

View File

@@ -96,6 +96,43 @@ so decoding it without folder history fails.
This fixture establishes block-history behavior only. It is not a OneNote
export and is not evidence of `.onepkg` producer compatibility.
## Inline compcol Quantum fixtures
`src/onenote/onepkg/quantum/decoder.test.ts` copies two small Quantum payloads
from compcol
[`tests/quantum.rs`](https://github.com/KarpelesLab/compcol/blob/04a6db2aa7bd487a89c559631d79d1b384139f50/tests/quantum.rs)
at commit `04a6db2aa7bd487a89c559631d79d1b384139f50`. The 48-byte
`qtm.txt` payload decodes with an 18-bit window to the 59-byte ASCII string
`If you can read this, the Quantum decompressor is working!` followed by a
line feed. The first two compressed blocks of compcol's multi-frame zero-run
fixture are 14 and 6 bytes and decode to two 32,768-byte zero frames. Tests
exercise arithmetic-model and LZ-window continuity, per-block synthetic
sentinels, malformed trailers, truncation, cancellation, and operation limits.
The immediate reviewed compcol source is MIT-licensed; its exact licence is in
`LICENSES/compcol-MIT.txt`. The compcol comments record that the payloads were
originally extracted from libmspack CAB test files. This repository copies only
the small arrays published in the pinned compcol test source, not those CAB
files.
`src/onenote/onepkg/cabinet.test.ts` wraps the 48-byte payload in a generated,
single-folder CAB so the actual CAB enumeration, checksum, and extraction path
is covered:
- CAB compression type: `0x1222` (Quantum level 2, 18-bit/256 KiB window).
- CFDATA sizes/checksum: 48 compressed bytes, 59 output bytes, checksum
`0x4bec2dfd`.
- CAB size: 124 bytes.
- CAB SHA-256:
`f622c5a8f5a000dfaddc5569750344f5a6e35d0de9fbd3c4f0c8720c7d94d291`.
- Wrapper/header/filename licence: original test data under this project's
MPL-2.0 licence; embedded payload licence: compcol MIT as above.
The frozen CAB contains only the compressed payload; the decoder appends the
required `0xFF` byte after each CFDATA block in memory. These are CAB-level
codec fixtures, not OneNote exports, and do not establish producer-specific
`.onepkg` compatibility.
## Distribution policy
The decoded fixture bytes are used only by tests. Vite does not copy them into