Files
onenote-tools/tests/fixtures/README.md

147 lines
7.5 KiB
Markdown

# Fixture provenance
No private notebook may be committed. Each binary fixture requires a public,
reviewed source, an immutable revision, a redistribution licence, a content
expectation, and a retained hash. Base64 encoding is only a repository transport
and does not change the underlying file's licence.
## `onenote_desktop.one.b64`
- Source: Joplin
[`packages/app-cli/tests/support/onenote/onenote_desktop.one`](https://github.com/laurent22/joplin/blob/28eb53bd9f0cd4ae0dec0c59a08037075a38302b/packages/app-cli/tests/support/onenote/onenote_desktop.one),
introduced at commit
[`28eb53bd9f0cd4ae0dec0c59a08037075a38302b`](https://github.com/laurent22/joplin/commit/28eb53bd9f0cd4ae0dec0c59a08037075a38302b).
- Licence: AGPL-3.0-or-later; full text in `LICENSES/AGPL-3.0.txt`.
- Decoded size: 34,904 bytes.
- Decoded SHA-256:
`7c43e85e2169b4bc3236db73a24c8f20d5c284b74563c07baf1406887d20eb5e`.
- Golden expectation: desktop OneStore section with three pages — `Test`,
`Another page`, and `Page 3` — plus readable text/timestamps and diagnostics
for image, table, and ink content.
## `joplin-test.onepkg.base64`
- Source: Joplin
[`packages/app-cli/tests/support/onenote/test.onepkg`](https://github.com/laurent22/joplin/blob/1e73aad7eb08fde5d9e4cb533df40052a5cd32d7/packages/app-cli/tests/support/onenote/test.onepkg)
at commit `1e73aad7eb08fde5d9e4cb533df40052a5cd32d7`, introduced by
[Joplin PR #14094](https://github.com/laurent22/joplin/pull/14094).
- Licence: AGPL-3.0-or-later; full text in `LICENSES/AGPL-3.0.txt`.
- Decoded size: 11,066 bytes.
- Decoded SHA-256:
`83cb622d40f0ab127038b629553b6926be3e2a6ce642f169df0e2614c13e8469`.
- CAB expectation: one LZX `0x1203` folder, three CFDATA blocks, seven UTF-8
and nested paths, five `.one` sections, and two `.onetoc2` entries.
- Parser expectation: all five sections parse, producing seven pages in total:
`Page 1`, `Page 2`, `Test`, `Test page`, `Testing…`, `A test`, and
`Tuesday, January 13, 2026`.
Tests verify the package hash, all seven paths, the native `.one` magic for
every section, section parse statuses, and representative title/text output.
## `joplin-quick-notes-fsshttp.one.b64`
- Immediate reviewed source: `onenote.rs`
[`crates/parser/tests/samples/joplin/Simple notebook/Quick Notes.one`](https://github.com/msiemens/onenote.rs/blob/5138a39a3f4e72b840932f9872fecde52fa9da60/crates/parser/tests/samples/joplin/Simple%20notebook/Quick%20Notes.one)
at the parser reference revision
`5138a39a3f4e72b840932f9872fecde52fa9da60`; introduced there by commit
`3011a1f0f2a13288aa8ac366f783adc0673e4989` as test data from Joplin.
- Upstream attribution recorded alongside the source fixture: Joplin,
copyright Laurent Cozic, AGPL-3.0-or-later. The full licence is retained in
`LICENSES/AGPL-3.0.txt`.
- Decoded size: 17,197 bytes.
- Decoded SHA-256:
`5e501ef5f539cd2f149786f57659be9d0762913d863a69867deb9c8e8c43efe2`.
- Golden package expectation: FSSHTTPB package-store section with one Storage
Index, one Storage Manifest, four Cell Manifests, nine Revision Manifests,
and nine Object Groups. This fixture contains no Data Element Fragments or
Object Data BLOB elements.
Tests retain the exact hash, validate the package envelope and element counts,
and exercise truncated, malformed, padding, and configured-limit failures.
## Inline rust-cab CAB fixtures
`src/onenote/onepkg/cabinet.test.ts` contains byte-for-byte test arrays copied
from rust-cab `src/cabinet.rs` at commit
[`c5839f5fdfa4c4e7cc9b22f570c79c96af0560e2`](https://github.com/mdsteele/rust-cab/tree/c5839f5fdfa4c4e7cc9b22f570c79c96af0560e2).
They are MIT-licensed; the exact upstream text is in
`LICENSES/rust-cab-MIT.txt`.
The arrays cover an uncompressed single-entry CAB, an uncompressed two-entry
CAB, a single-block MSZIP CAB, and an LZX `0x1303` CAB containing `hi.txt` and
`bye.txt`. They are CAB unit fixtures, not OneNote exports, and are not evidence
of `.onepkg` producer compatibility.
## Inline generated two-block MSZIP fixture
`src/onenote/onepkg/cabinet.test.ts` also contains a generated 593-byte CAB
with one 36,864-byte `history.bin` entry. The input byte at index `i` is
`i % 251`. It is split into a 32,768-byte block and a 4,096-byte block; the
second raw DEFLATE stream uses the first block as its preset 32 KiB dictionary,
so decoding it without folder history fails.
- Generator: CPython 3.13.14 `zlib.compressobj`, zlib 1.3.1, raw DEFLATE
(`wbits=-15`), level 9; the second call uses `zdict=first_block`. Each stream
is prefixed with `CK` and placed in a spec-shaped single-folder CAB with CAB
checksums.
- Generator invocation: `python3` with the documented deterministic input and
CAB layout above; the frozen Base64 bytes, sizes, checksums, and hashes are
asserted by the test. No notebook or third-party content is an input.
- CAB SHA-256:
`9f71b97623395492f401ddc152ca648e8416996b14092b0df42ad712c27f9cb2`.
- Extracted SHA-256:
`cb441d1f6e7d9c5789a306c51a00a654c9b7715c2c3d624e3d2a75bd0af549ff`.
- Licence: original test data under this project's MPL-2.0 licence.
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
`dist`, and the release packager does not add them to the application ZIP. The
release may include this provenance document and licence text so its notices
remain complete.
A copied upstream fixture needs an individual licence and redistribution
review; a repository-level licence must not be assumed to cover every binary.
Generated fixtures must document the generator command/input and must not be
described as real application exports.