♻️ SQLite state foundation with migrations and full metadata parity#231
♻️ SQLite state foundation with migrations and full metadata parity#231
Conversation
Introduce schema-versioned SQLite migrations for reporter state and metadata.\nPort baseline/hotspot/region/baseline-build metadata and server registry off JSON files with one-time legacy imports.\nUpdate routers, context, handlers, and tests to read/write through the DB-backed state store.
This comment has been minimized.
This comment has been minimized.
PR Review: SQLite state foundation with migrations and full metadata parityOverall this is a solid, well-scoped migration. The schema versioning story is clean, the file/SQLite backends share a coherent interface, and the dependency injection pattern preserves testability throughout. A few things worth addressing before merge: Performance: store opened/closed per HTTP requestIn The events router shows the right pattern — create one store, subscribe, close on disconnect. Dashboard and health should receive the store as a dependency (injected at server startup) the same way the TDD handler does with Per-operation store opening in metadata modules
function withStateStore(workingDir, operation) {
let store = createStateStore({ workingDir });
try { return operation(store); }
finally { store.close(); }
}Every Module-level
|
Break the monolithic state store into a small facade plus dedicated files for schema migrations, sqlite backend, file backend, events, constants, and shared helpers. This keeps DB evolution isolated and gives us a cleaner foundation for future migrations.
This comment has been minimized.
This comment has been minimized.
- remove file state-store fallback and backend toggles\n- tighten registry/event/state utilities for cleaner behavior\n- move handler/service coverage to real sqlite-backed tests
Vizzly - Visual Test Results
|
Why
The filesystem reporter state was hitting scaling limits under heavier local TDD/CLI usage. This switches us to a SQLite-first state model with explicit schema versioning + migrations so we can safely evolve build tracking and related state over time.
What changed
better-sqlite3and implemented a migration-driven state storeschema_migrationstrackingsrc/tdd/state-store.jsinto focused modules undersrc/tdd/state-store/sqlite-store.js(DB backend)file-store.js(legacy/test backend)migrations.js(schema + migration runner)events.js,constants.js,utils.js(shared internals)src/tdd/state-store.jsis now a thin public facadesrc/tdd/server-registry.js~/.vizzly/servers.jsonTest plan
npm run lintnode --test --test-reporter=spec tests/server/handlers/tdd-handler.test.js tests/server/routers/dashboard.test.js tests/server/routers/events.test.js tests/server/routers/health.test.js tests/services/static-report-generator.test.js tests/tdd/metadata/baseline-metadata.test.js tests/tdd/metadata/hotspot-metadata.test.js tests/tdd/metadata/region-metadata.test.js tests/tdd/server-registry.test.js tests/tdd/tdd-service.test.js tests/utils/context.test.js tests/server/http-server.test.jsnpm run buildnpm test