experiments in a post-browser web
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(schema): add schema codegen with full test coverage

- Canonical schema definition (schema/v1.json)
- Code generator for SQLite, TypeScript, Rust
- 26 fidelity tests verifying backend consistency
- Runtime validation in Server and Electron
- Build integration (yarn build runs codegen)
- Fixed compiled JS path for schema loading
- Mobile drift documented as priority TODO

+8 -8
+4 -4
backend/electron/datastore.ts
··· 38 38 import { addDeviceMetadata } from './device.js'; 39 39 40 40 // Load canonical schema for validation 41 + // Path is relative to compiled JS in dist/backend/electron/ 41 42 const __filename = fileURLToPath(import.meta.url); 42 43 const __dirname = dirname(__filename); 43 44 const SCHEMA = JSON.parse( 44 - readFileSync(join(__dirname, '../../schema/v1.json'), 'utf-8') 45 + readFileSync(join(__dirname, '../../../schema/v1.json'), 'utf-8') 45 46 ); 46 47 const REQUIRED_SYNC_COLUMNS: Record<string, string[]> = SCHEMA.validation.required_sync_columns; 47 48 ··· 361 362 const missing: string[] = []; 362 363 363 364 for (const [table, cols] of Object.entries(REQUIRED_SYNC_COLUMNS)) { 364 - const actual = new Set( 365 - db.prepare(`PRAGMA table_info(${table})`).all().map((c: { name: string }) => c.name) 366 - ); 365 + const rows = db.prepare(`PRAGMA table_info(${table})`).all() as { name: string }[]; 366 + const actual = new Set(rows.map(c => c.name)); 367 367 for (const col of cols) { 368 368 if (!actual.has(col)) { 369 369 missing.push(`${table}.${col}`);
+1 -1
schema/generated/sqlite-full.sql
··· 1 1 -- Generated by schema/codegen.js 2 2 -- Schema version: 1 3 - -- Generated: 2026-01-29T14:56:38.795Z 3 + -- Generated: 2026-01-29T19:55:59.961Z 4 4 -- DO NOT EDIT - regenerate with: yarn schema:codegen 5 5 6 6 -- Unified content storage - URLs, text notes, tagsets, and images
+1 -1
schema/generated/sqlite-sync.sql
··· 1 1 -- Generated by schema/codegen.js 2 2 -- Schema version: 1 3 - -- Generated: 2026-01-29T14:56:38.796Z 3 + -- Generated: 2026-01-29T19:55:59.962Z 4 4 -- DO NOT EDIT - regenerate with: yarn schema:codegen 5 5 6 6 -- Unified content storage - URLs, text notes, tagsets, and images
+1 -1
schema/generated/types.rs
··· 1 1 // Generated by schema/codegen.js 2 2 // Schema version: 1 3 - // Generated: 2026-01-29T14:56:38.796Z 3 + // Generated: 2026-01-29T19:55:59.963Z 4 4 // DO NOT EDIT - regenerate with: yarn schema:codegen 5 5 6 6 use serde::{Deserialize, Serialize};
+1 -1
schema/generated/types.ts
··· 1 1 /** 2 2 * Generated by schema/codegen.js 3 3 * Schema version: 1 4 - * Generated: 2026-01-29T14:56:38.796Z 4 + * Generated: 2026-01-29T19:55:59.962Z 5 5 * DO NOT EDIT - regenerate with: yarn schema:codegen 6 6 */ 7 7