| 1 | # Rust attachment authoring |
| 2 | |
| 3 | `plain/candidate` and `icon/candidate` are the page writer's output for |
| 4 | `an_attachment_inserted_on_a_fresh_page_reads_back_and_can_be_removed` in |
| 5 | `crates/onestore/tests/page_attachments.rs`: on a section created in Rust, a |
| 6 | paragraph between two text paragraphs becomes an inserted file |
| 7 | (`notes 🦀.txt`, 28 bytes), stored the way OneNote stores one |
| 8 | (`corpus/native/cold-05-06-attachment`): the payload embedded in the |
| 9 | section's file-data store list, an embedded-file object declaring it by |
| 10 | identity and extension, and an attachment object with the file name, the |
| 11 | 24 pt icon size and the flags every native attachment carries. `icon/` also |
| 12 | embeds the native fixture's 724-byte icon PNG as the preview picture; |
| 13 | `plain/` omits it, which OneNote opens but draws as a broken picture |
| 14 | (`corpus/attachment-insert/without-icon.png`), so the editor always stores one. |
| 15 | OneNote's integrity check refuses an attachment object without |
| 16 | `0x1c001d61` (twenty bytes: 16, 1, zeros), so the writer always stores it. |
| 17 | |
| 18 | `*/cold` are fresh OneNote 2010 reads: the file reads back as an |
| 19 | `InsertedFile` with the preferred name and the exact payload bytes, between |
| 20 | the two text paragraphs. `tools/test_attachment_edit.py` checks both captures |
| 21 | without a VM. Regenerate with `ONESTORE_ATTACHMENT_EXPORT` set to a directory |
| 22 | while running the test (it writes `plain/` and `icon/`), then cold-open each |
| 23 | with `tools/native_runner.py OUTPUT/plain COLD --expected-pages 1 |
| 24 | --collect-notebook`. |
| 25 | |
| 26 | ## Renaming a stored attachment |
| 27 | |
| 28 | `renamed/candidate` is the writer's output for |
| 29 | `attachments_need_a_file_name_and_stored_ones_are_renamed_in_place` in |
| 30 | `crates/onestore/tests/page_attachments.rs`: the native attachment of |
| 31 | `corpus/native/cold-05-06-attachment` with its shown name and recorded source |
| 32 | path changed in place (properties `0x1c001c22`, `0x1c001d9c` and |
| 33 | `0x1c001d9d` on the attachment node), payload and preview untouched. |
| 34 | `renamed/cold` is its cold read: `preferredName` and `pathSource` carry the |
| 35 | new values. Regenerate with `ONESTORE_ATTACHMENT_RENAME_EXPORT` and cold-open |
| 36 | with `--expected-pages 1`. |