| 319 | const branch = this.getCurrentBranch(noteId); |
| 320 | const parentId = branch.head_version_id; |
| 321 | const hash = this.contentHash(content); |
| 322 | |
| 323 | const head = parentId ? this.sql.exec( |
| 324 | "SELECT id, kind, storage, data, content_hash, created_at FROM note_versions WHERE id = ?", parentId |
| 325 | ).toArray()[0] as any : null; |
| 326 | |
| 327 | // Identical to head → nothing to record |
| 328 | if (head?.content_hash && head.content_hash === hash) return null; |
| 329 | |
| 330 | // Defense-in-depth: never record an accidental wipe as a version. A |