The PageIndex blob store (.openkb/files) is append-only across docs — each add creates new {doc_id} blobs and never modifies existing ones — so it is hardlink-safe and must be snapshotted via hardlinks, not copied.
(tmp_path)
| 261 | |
| 262 | |
| 263 | def test_openkb_files_tree_is_hardlinked(tmp_path): |
| 264 | """The PageIndex blob store (.openkb/files) is append-only across docs — |
| 265 | each add creates new {doc_id} blobs and never modifies existing ones — so |
| 266 | it is hardlink-safe and must be snapshotted via hardlinks, not copied. |
| 267 | """ |
| 268 | kb_dir = tmp_path |
| 269 | blobs = kb_dir / ".openkb" / "files" / "col" |
| 270 | blobs.mkdir(parents=True) |
| 271 | existing = blobs / "an-existing-doc.pdf" |
| 272 | existing.write_bytes(b"existing-blob") |
| 273 | live_inode = existing.stat().st_ino |
| 274 | |
| 275 | snapshot = snapshot_paths( |
| 276 | kb_dir, |
| 277 | [kb_dir / ".openkb" / "files"], |
| 278 | operation="add", |
| 279 | details={}, |
| 280 | hardlink_dirs={kb_dir / ".openkb" / "files"}, |
| 281 | ) |
| 282 | try: |
| 283 | backup = snapshot.backup_dir / ".openkb" / "files" / "col" / "an-existing-doc.pdf" |
| 284 | assert backup.stat().st_ino == live_inode |
| 285 | finally: |
| 286 | snapshot.discard_best_effort() |
| 287 | |
| 288 | |
| 289 | def test_concept_writer_is_atomic_so_hardlink_rollback_restores(tmp_path): |
nothing calls this directly
no test coverage detected