mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-06-24 20:28:12 +02:00
fix(filesystem): preserve sqlite catalog durability
Remove the synchronous=OFF pragma from PIFS catalog inserts so SQLite remains the durable source of truth.
This commit is contained in:
parent
fe1c4aeb1c
commit
3519adfbd1
2 changed files with 45 additions and 1 deletions
45
tests/test_filesystem_store.py
Normal file
45
tests/test_filesystem_store.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import json
|
||||
|
||||
|
||||
def test_insert_files_does_not_disable_sqlite_synchronous(tmp_path):
|
||||
from pageindex.filesystem.store import SQLiteFileSystemStore
|
||||
|
||||
statements = []
|
||||
|
||||
class RecordingStore(SQLiteFileSystemStore):
|
||||
def connect(self):
|
||||
conn = super().connect()
|
||||
conn.set_trace_callback(statements.append)
|
||||
return conn
|
||||
|
||||
store = RecordingStore(tmp_path / "workspace")
|
||||
statements.clear()
|
||||
|
||||
store.insert_files(
|
||||
[
|
||||
{
|
||||
"file_ref": "ref_report",
|
||||
"external_id": "doc_report",
|
||||
"storage_uri": "file:///tmp/report.pdf",
|
||||
"source_path": "documents/report.pdf",
|
||||
"folder_path": "/documents",
|
||||
"title": "Report",
|
||||
"descriptor": "documents/report.pdf",
|
||||
"content_type": "application/pdf",
|
||||
"source_type": "documents",
|
||||
"fingerprint": "fingerprint",
|
||||
"text_artifact_path": "artifacts/text/ref_report.txt",
|
||||
"raw_artifact_path": None,
|
||||
"metadata": {},
|
||||
"metadata_json": json.dumps({}),
|
||||
"metadata_text": "",
|
||||
"content": "",
|
||||
"skip_fts": True,
|
||||
}
|
||||
]
|
||||
)
|
||||
|
||||
assert not any(
|
||||
statement.upper().replace(" ", "") == "PRAGMASYNCHRONOUS=OFF"
|
||||
for statement in statements
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue