|
| 1 | +# Release v0.3.x - SQLite Storage Layer & Migration Framework |
| 2 | + |
| 3 | +Released: YYYY-MM-DD |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Major architectural upgrade introducing SQLite as a high-performance index layer while maintaining JSON files as the source of truth. This release adds canonical ULID-based identities, full-text search via FTS5, recursive CTEs for path finding, and a comprehensive data migration framework. |
| 8 | + |
| 9 | +## 🎉 New Features |
| 10 | + |
| 11 | +### SQLite Storage Layer |
| 12 | +- Added SQLite database (`data/sparsetree.db`) as fast query index |
| 13 | +- FTS5 full-text search for person names, bios, and occupations |
| 14 | +- Recursive CTEs for efficient ancestor/descendant path finding |
| 15 | +- WAL mode for better read concurrency |
| 16 | +- Auto-enables when database exists with data, falls back to JSON otherwise |
| 17 | + |
| 18 | +### Canonical Identity System |
| 19 | +- ULID-based canonical IDs (26-char, sortable, collision-resistant) |
| 20 | +- External identity mappings for multiple providers (FamilySearch, Ancestry, WikiTree, 23andMe) |
| 21 | +- Bidirectional ID lookup with in-memory LRU cache |
| 22 | +- Confidence scoring for identity assertions |
| 23 | + |
| 24 | +### Content-Addressed Blob Storage |
| 25 | +- SHA-256 hash-based media storage (`data/blobs/{hash[:2]}/{hash}.{ext}`) |
| 26 | +- Automatic deduplication of duplicate photos |
| 27 | +- Media records linked to persons with primary photo support |
| 28 | + |
| 29 | +### Data Migration Framework |
| 30 | +- Automatic schema and data migrations on update |
| 31 | +- Migration tracking in `data/.data-version` and SQLite `migration` table |
| 32 | +- Dry-run mode for previewing changes |
| 33 | +- Rollback support for reversible migrations |
| 34 | +- Commands: `npm run migrate`, `npm run migrate:status`, `npm run migrate:dry-run` |
| 35 | + |
| 36 | +### Update Script |
| 37 | +- New `./update.sh` for one-command updates |
| 38 | +- Pulls latest code, installs deps, builds, migrates, restarts |
| 39 | +- Supports `--dry-run`, `--no-restart`, `--branch=NAME` options |
| 40 | +- Safe: checks for uncommitted changes before updating |
| 41 | + |
| 42 | +### Simplified Genealogy Provider UI (v0.3.10) |
| 43 | +- Consolidated genealogy provider management to a single `/providers/genealogy` page |
| 44 | +- Removed over-engineered `/providers/scraper` and `/providers/genealogy/:id/edit` routes |
| 45 | +- Simplified `BrowserSettingsPage` to focus on CDP connection settings only |
| 46 | +- Added "Login with Google" SSO option for FamilySearch |
| 47 | +- Browser connection controls now available directly on the providers page |
| 48 | +- Provider credentials and auto-login moved to the consolidated page |
| 49 | + |
| 50 | +### Fixed Database Refresh Hang (v0.3.11) |
| 51 | +- Fixed refresh button hanging the server on large trees (138k+ persons) |
| 52 | +- Changed recursive CTE query to use database_membership table when available |
| 53 | +- Added hard limit (50 generations, 500k persons) to prevent runaway queries |
| 54 | +- Converted refresh to SSE-based background task to avoid HTTP timeouts |
| 55 | +- Client now uses EventSource for non-blocking refresh with progress updates |
| 56 | + |
| 57 | +### Documentation Restructure (v0.3.12) |
| 58 | +- Created `docs/` folder with modular documentation: |
| 59 | + - `architecture.md` - Data model, storage, identity system |
| 60 | + - `api.md` - API endpoint reference |
| 61 | + - `cli.md` - CLI command reference |
| 62 | + - `development.md` - Development setup guide |
| 63 | + - `providers.md` - Genealogy provider configuration |
| 64 | + - `roadmap.md` - Detailed phase documentation |
| 65 | +- Simplified `PLAN.md` to high-level summary with links |
| 66 | +- Streamlined `CLAUDE.md` with quick reference format |
| 67 | +- Simplified `README.md` with user-focused content |
| 68 | +- Added Phase 17 (Socket.IO real-time event system) to roadmap |
| 69 | + |
| 70 | +### Project Structure Consolidation (v0.3.13) |
| 71 | +- Moved root `lib/` directory into `server/src/lib/`: |
| 72 | + - `lib/config.ts` - Application configuration with TypeScript types |
| 73 | + - `lib/graph/` - Path finding algorithms (shortest, longest, random) |
| 74 | + - `lib/familysearch/` - FamilySearch API client, fetcher, and transformer |
| 75 | + - `lib/sqlite-writer.ts` - SQLite dual-write logic during indexing |
| 76 | +- Moved root CLI scripts to `scripts/`: |
| 77 | + - `index.ts` - Main ancestry indexer |
| 78 | + - `find.ts` - Path finder |
| 79 | + - `print.ts` - Chronological print |
| 80 | + - `purge.ts` - Purge cached records |
| 81 | + - `prune.ts` - Prune orphan files |
| 82 | + - `rebuild.ts` - Rebuild databases |
| 83 | + - `migrate-favorites.ts` - Favorites migration |
| 84 | +- Added `server/src/utils/sleep.ts` and `randInt.ts` utilities |
| 85 | +- Updated indexer.service.ts to spawn `npx tsx scripts/index.ts` |
| 86 | +- Removed deprecated `tsv.js` (redundant with `/api/export/:dbId/tsv`) |
| 87 | +- All scripts now run via `npx tsx` for TypeScript support |
| 88 | + |
| 89 | +### Socket.IO Real-Time Events (v0.3.14) |
| 90 | +- Implemented Socket.IO for bidirectional real-time communication |
| 91 | +- Added `server/src/services/socket.service.ts` with room-based event broadcasting |
| 92 | +- Added `client/src/services/socket.ts` singleton socket client |
| 93 | +- Added `client/src/hooks/useSocket.ts` with React hooks for socket events: |
| 94 | + - `useSocketConnection()` - Manage socket connection lifecycle |
| 95 | + - `useSocketEvent()` - Subscribe to specific socket events |
| 96 | + - `useDatabaseEvents()` - Database refresh notifications |
| 97 | + - `useBrowserEvents()` - Browser status updates |
| 98 | + - `useIndexerEvents()` - Indexing progress |
| 99 | +- Converted database refresh from SSE to Socket.IO events |
| 100 | +- Browser status broadcasts via Socket.IO in addition to SSE (backwards compatible) |
| 101 | +- Added in-memory LRU cache for SQL queries (`server/src/services/cache.service.ts`): |
| 102 | + - Configurable TTL and max size |
| 103 | + - Separate caches for queries, persons, and lists |
| 104 | + - Cache invalidation per database or person |
| 105 | + - Cache statistics for monitoring |
| 106 | +- Optimized `/api/favorites` endpoint: |
| 107 | + - Replaced N+1 queries with single JOIN query |
| 108 | + - Removed loading of entire database contents |
| 109 | + - Added index on `favorite.added_at` for faster sorting |
| 110 | + - Added `person_count` column to `database_info` table |
| 111 | + |
| 112 | +## 🔧 Improvements |
| 113 | + |
| 114 | +### Service Layer Updates |
| 115 | +- `database.service.ts` - Queries from SQLite with JSON fallback |
| 116 | +- `search.service.ts` - Uses FTS5 for text search, supports cross-database global search |
| 117 | +- `path.service.ts` - Recursive CTEs for shortest/longest/random paths |
| 118 | +- `favorites.service.ts` - SQLite storage with JSON backup |
| 119 | +- `augmentation.service.ts` - External identity registration |
| 120 | + |
| 121 | +### Schema Design |
| 122 | +- Normalized tables: `person`, `external_identity`, `parent_edge`, `spouse_edge` |
| 123 | +- Extensible claims system for facts with provenance |
| 124 | +- Vital events with date parsing (supports BC notation) |
| 125 | +- Database membership for multi-tree support |
| 126 | +- Full schema in `server/src/db/schema.sql` |
| 127 | + |
| 128 | +### Developer Experience |
| 129 | +- Updated CLAUDE.md with comprehensive migration documentation |
| 130 | +- Added npm scripts for migration management |
| 131 | +- Better error messages for ID resolution failures |
| 132 | + |
| 133 | +## 📦 Installation |
| 134 | + |
| 135 | +```bash |
| 136 | +git clone https://github.com/atomantic/SparseTree.git |
| 137 | +cd SparseTree |
| 138 | +npm run install:all |
| 139 | +npm run migrate |
| 140 | +pm2 start ecosystem.config.cjs |
| 141 | +``` |
| 142 | + |
| 143 | +## 🔄 Upgrading from v0.2.x |
| 144 | + |
| 145 | +Run the update script to automatically migrate: |
| 146 | + |
| 147 | +```bash |
| 148 | +./update.sh |
| 149 | +``` |
| 150 | + |
| 151 | +Or manually: |
| 152 | + |
| 153 | +```bash |
| 154 | +git pull origin main |
| 155 | +npm install |
| 156 | +npm run build |
| 157 | +npm run migrate |
| 158 | +pm2 restart ecosystem.config.cjs |
| 159 | +``` |
| 160 | + |
| 161 | +## 🔗 Full Changelog |
| 162 | + |
| 163 | +**Full Diff**: https://github.com/atomantic/SparseTree/compare/v0.2.11...v0.3.x |
0 commit comments