Add full audit export: JSON, SQLite, and PDF - #12
Merged
Conversation
Product Hunt feature request: a way to audit/back up the full graph
data (entities, trust scores, conflict candidates), not just memories.
The existing "Data Management" export and "Backup & Restore" only ever
covered memories (+ sessions for backup) — the entity graph, trust
scores, and conflict candidates were only reachable via individual
paginated REST reads.
Adds server/core/full_export.py with three outputs sharing one data
pass (build_full_export):
- GET /api/export/full.json — raw machine-readable bundle
- GET /api/export/full.sqlite — a consistent copy of the live DB via
SQLite's online backup API (Database.create_safety_backup)
- GET /api/export/full.pdf — human-readable summary report (fpdf2,
optional dependency, added as the `pdf` extra)
Also: `levh export-full --format {json,sqlite,pdf}` CLI command, three
buttons in Settings -> Data Management, and TrustService.list_all_trust
to fetch every stored trust breakdown (not just below-threshold ones).
CI installs pip install -e ".[dev]" only; the PDF export test needs fpdf2, which was previously only in the separate `pdf` extra and never installed in CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
server/core/full_export.pywith one data-gathering pass (build_full_export) shared by three outputs:GET /api/export/full.json— raw machine-readable bundle (memories + entities + trust + conflicts)GET /api/export/full.sqlite— a consistent copy of the live DB via SQLite's online backup API (reusesDatabase.create_safety_backup, so WAL pages are captured correctly)GET /api/export/full.pdf— human-readable summary report (new optional dependencyfpdf2, added as thepdfextra so core installs stay light; a clear error is raised if it's missing, JSON/SQLite work without it)levh export-full --format {json,sqlite,pdf} [--out PATH]TrustService.list_all_trust()/Database.list_all_trust()added to fetch every stored trust breakdown (the existinglist_low_trustis threshold-filtered only)Test plan
python -m pytest tests/test_full_export.py tests/test_backup.py tests/test_entity_graph.py -q— 37 passedpython -m pytest tests/ -q— full suite, 603 passedlevh export-full --format json/sqlite/pdfmanually verified against a live local DB — SQLite output opens as a valid DB, PDF starts with%PDF-npm run build(Next.js static export) succeedsGenerated by Claude Code