3.6 KiB
3.6 KiB
M-SQLITE-01..05 — Hardened Sqlite C API Integration & Optional SqliteAsync Pool
- Wave: Wave 7 (
feat/roadmap-p2-wave7, branched frommainat43922d1) - Roadmap reference:
docs/roadmap/modules/Sqlite.md,docs/roadmap/DEPENDENCIES.md - Supported runtime observed: SQLite 3.54.0 via Nix
sqlitepackage
Scope & Ownership
src/Sqlite/module.cmake:INTERNAL_DEPS Functional Time,EXTERNAL_DEPS SQLite3::SQLite3,EXCLUDE_HEADERS Void/Sqlite/AsyncPool.hpp.include/Void/Sqlite/Types.hpp:kSqliteErrorDomain = 21,SqliteErrorCode,JournalMode,SyncMode,BeginMode,CheckpointMode,TransactionState,SqliteLimits,OpenOptions,EffectiveCapabilities,ColumnType,ValueView,OwnedValue,OwnedRow,CheckpointReport,BackupOptions,BackupReport,CheckedMigration,ConnectionHealth,ScopedFaultGuard.include/Void/Sqlite/Sqlite.hpp+src/Sqlite/Sqlite.cpp:- Shared
ConnectionStateheld byDatabase,Statement,Transaction, andSavepointso moving/destroyingDatabasenever leaves dangling pointers. - Preserve 1.x APIs (
Database::open,exec,prepare,begin,last_insert_rowid,changes,user_version,migrate,Statement::bind/step/reset/clear_bindings/column getters,Transaction::commit/rollback,Migration,OpenMode). - Add
open_database(path, OpenOptions)validating limits/pragmas (WAL,FULL,foreign_keys, disabling extension loading by default, querying effective pragma results). - Add checked
bind_checked(positional & named,ValueView,max_value_bytescap), borrowed lifetime-owned bindings,reset_checked,clear_bindings_checked,finalize_checked, strict single-statementprepare(rejecting non-whitespace trailing SQL),RowViewwith expiration generation, strict typed column reads rejecting coercion,query_allwith row/byte caps. - Transaction state machine (
Active,Committed,RolledBack,RecoveryRequired): never markCommittedbeforeCOMMITsucceeds; inspectsqlite3_get_autocommiton error; reject nestedbegin; add RAIISavepoint. - Checked
Database::close()rejecting withbusywhile statements/transactions/savepoints remain open; deferred close in destructor reports errors to optional diagnostic hook. - Validate migration lists before any SQL; add
migrate_checkedrecordingid+checksumin_void_schema_migrationsin the same transaction asPRAGMA user_versionand rejecting newer schemas and checksum drift. - Operational methods:
checkpoint(),backup_to(),restore_from(),health(), WAL write-admission threshold gating, and exception-safecreate_scalar_function/set_authorizeradapters.
- Shared
src/SqliteAsync/module.cmake+include/Void/Sqlite/AsyncPool.hpp+src/SqliteAsync/AsyncPool.cpp:- Optional async leased connection pool (default 4 readers + 1 writer, bounded blocking workers,
max_queued_jobs = 1024,max_pending_input_bytes = 64 MiB). - Leases one connection for the complete read/write/transaction with serialized progress/interrupt cleanup so cancellation never leaks to the next borrower.
- Optional async leased connection pool (default 4 readers + 1 writer, bounded blocking workers,
- Tests & consumers:
tests/standalone/Sqlite/SqliteHardening.cpp,tests/standalone/SqliteAsync/SqliteAsync.cpp,tests/package/SqliteOnly/*,tests/package/SqliteAsyncOnly/*, updatedtests/package/InstalledComponents.cmake.
Verification Criteria
- Standalone
Sqlite;SqliteAsync;TestingRelWithDebInfo-Werror(-p sqlite): allSqlite*tests +ctest2/2 (SqliteOnly,SqliteAsyncOnly). - Full Wave 7 integrated RelWithDebInfo
-Werror, full Debug ASan+UBSan-Werror, and Wave 7 Debug TSan subset.