side-notes/openspec/changes/sidepanel-ux-improvements/specs/notes-storage/spec.md

16 lines
1.3 KiB
Markdown

## MODIFIED Requirements
### Requirement: Note record data model
Each stored note record SHALL include: a stable unique identifier, the derived URL key, the page title and favicon URL captured at save time, the markdown content, a creation timestamp, a last-updated timestamp, and an optional deletion timestamp. A record MAY additionally include the editor caret position (selection start and end offsets) and the editor scroll offset, captured at save time; these fields are optional and absent on records created before caret persistence existed. Caret/scroll updates MUST NOT modify the content, timestamps, or identity of the record.
#### Scenario: Metadata captured on first save
- **WHEN** a user's edits to a page's note are saved for the first time
- **THEN** the stored record includes a unique id, the derived key, the page's title, its favicon URL, the content, and matching creation and last-updated timestamps
#### Scenario: Caret and scroll captured on save
- **WHEN** a note is saved while the editor has a known caret position and scroll offset
- **THEN** the stored record includes those values alongside the content
#### Scenario: Caret-only update preserves other fields
- **WHEN** a caret/scroll update is persisted without any content change
- **THEN** the record's content, page metadata, and creation timestamp are unchanged