# K1 access profile SQLite leaf
This leaf owns the concrete SQLite representation of named saved access profiles. Its consumer owns callback/KTO validation, replay, registration, logging, handle policy, and failure fencing.
`ProfileDatabase::open` returns the database and a validated `Snapshot`; `apply` supports compatibility and named creation, replacement, rename, and deletion. Ownership-filtered queries use read-only WAL connections, `clear` atomically removes all rows and resets the cursor, and `rebuild` removes the database and sidecars before one fresh open attempt.
The database is exactly `profiles.sqlite3` beneath the supplied root. It uses WAL, synchronous `FULL`, and a zero busy timeout. Its exact version 1 schema stores canonical non-null profile names, 12-byte IDs, owners, revisions, non-null cursors, and canonical `kcode-k1-access-profile-codec` bytes. This schema was undeployed before names were added, so no legacy schema or row decoding is accepted. Open validates integrity, exact DDL, metadata, field widths, names, canonical encoding, and row/cursor consistency; malformed derived state is `OpenError::Rebuildable`, while ordinary SQLite and filesystem availability failures are fatal. Mutations are single `BEGIN IMMEDIATE` transactions with no retries.