1# Native page-removal references
2
3Eleven synthetic OneNote 2010 cases exercise individual parent, child, grandchild,
4trailing and leading-page removal; explicit multi-page removal; removal of every
5page; permanent removal; and recycling pages containing tables, list controls,
6tags, images, attachments and ink. The two leading cases also contain a nonempty
7page-version graph. These are sequential COM `DeleteHierarchy` calls with frozen
8original page identities. They do not represent keyboard deletion of a collapsed
9selection or an atomic notebook-wide transaction.
10
11Every case retains synchronized before/after section files, full native page XML
12and binary payloads, scripts, requested page indices, and an independent cold
13capture. `provenance.json` records the captured hashes and all 22 clone teardown
14records. Identical files within the capture have one stored copy and relative
15links. All fixtures originate from the public synthetic corpus.
16
17The raw Rust oracle checks retained page/object identities and bodies, page order,
18series reuse, indentation, source tombstones, retained revisions, labeled history,
19and exact cold graphs. Recycled pages are associated by their notebook-management
20GUID, including when titles are identical. Reachable properties, nested property
21sets, ordered references, context relationships and internal file payloads compare
22across identifier remapping. Only identical author records may merge. Current-page
23metadata normalizes to level one; observed modification-time changes must equal
24the copied page's timestamp. Version-page levels and timestamps remain exact.
25Native discards nine old storage revisions in the ink case and eight in the
26feature case; those counts are explicit regression expectations. Removal of
27storage revisions is distinct from losing semantic page versions.
28
29The copy oracle includes negative controls for an ordinary text edit and a
30changed attachment payload. Python independently compares native XML, character
31formatting and media against before, after and cold stores. Empty native section
32hierarchies can contain only an XML declaration after reopening.
33
34```sh
35cargo build -p onestore-notebook --all-features --example document
36cargo test -p onestore --all-features --test page_removal
37python -m unittest discover -s tools -p test_page_removal.py
38```
39
40A fresh owned-clone capture uses `python tools/native_page_removal.py CASE OUTPUT`,
41where `CASE` is a key from `provenance.json` and `OUTPUT` is a new directory. The
42controller removes its clones after use. These fixtures establish reference
43semantics for the page-removal writer; they do not implement that writer.
44
45`sanitizer.json` records 64 initial mutation inputs and the 32 supplemental store
46paths/hashes for the existing `document` fuzz target. With ASan and seed 1993,
4720,000 executions completed in 40 seconds without an invariant or sanitizer
48failure. Decode the input hex into a new writable corpus and set
49`ONESTORE_DOCUMENT_SEEDS` to the recorded repository-relative paths joined with
50the platform path separator, then use `cargo +nightly fuzz run document CORPUS --
51-seed=1993 -max_total_time=120 -timeout=30 -runs=20000`. The target also retains its
52built-in synthetic sources. This is bounded reader testing of these inputs.
53
54`rust-followup` takes four Rust `delete_pages_permanently` outputs (`parent`, `all`,
55`features`, `leading-parent`) and lets OneNote 2010 create a titled page with a bold
56body in each section through COM (`tools/native/page-removal-followup.ps1`), then
57reopens the natively saved section through a fresh cache. The Rust test
58`native_pages_created_after_rust_removal_reopen_cold` requires every surviving page
59to keep its exact active revision through both native phases, the new page to carry
60the native title and body, and the cold reopen to change no object space.
61`tools/test_page_removal.py` compares both captures' native XML with the Rust model
62and finds the native title exactly once in each hierarchy. Regenerate the candidates
63with `ONESTORE_PAGE_REMOVAL_OUTPUT` on the removal reference test, then run the
64runner with `--author` into `followup` and cold into `followup-cold`.