2.9 KiB
P00-06: SQLite Profile Isolation
- Status: Passed on a disposable SQLite database
- Date recorded: 2026-07-18
- MVP gate: Required before persistent dual-instance data
Objective
Verify schema and repository isolation for multiple saved profiles and two active slots, including collisions in server, conversation, message, cursor, proposal, and transaction identifiers.
Environment
- SQLite implementation: rusqlite 0.40.1 with bundled SQLite
- Rust toolchain: rustc/cargo 1.97.1
- Migration execution: transactional disposable fixture
- Persistent user database: not created
Minimal validation implementation
The Spike is expected to use a disposable database and transactional migrations. Server-derived tables must include profile_id and server_instance_id. Conversation and message keys must remain unique within their profile and server context.
Credential values must never be stored; only opaque credential references are permitted.
Required execution
- Create at least five profiles with only two active slots.
- Store identical conversation_id and message_id values for two different profiles.
- Store independent SSE cursors, unread counts, errors, proposals, and transaction summaries.
- Query each profile and verify no cross-profile result.
- Verify a duplicate within the same composite key is rejected or deterministically updated.
- Verify credential values are absent from all tables.
- Interrupt a transaction and confirm rollback or recovery.
- Reopen the database and repeat isolation checks.
Actual execution result
Passed. Tests created multiple saved profiles with only companion and operations active slots, inserted intentionally colliding server/conversation/message identifiers under different composite profile keys, and verified independent reads.
Tests also covered separate SSE cursors, unread/error state, proposals and file-transaction summaries, duplicate composite-key behavior, transaction rollback, reopen/requery behavior, and schema inspection confirming that credential values are absent.
All database files were disposable test fixtures; no migration touched user data.
Log summary
Command: cargo test --workspace. Result: passed, including SQLite migration and isolation tests. Logs contained test status only and no stored content values.
Known limitations
- Migration backup and recovery behavior remain unverified.
- WAL behavior on abrupt process termination remains unverified.
- Encryption at rest is not provided by ordinary SQLite and does not replace Credential Manager.
Security impact
Incorrect composite keys can mix conversations or local-tool state between companion and operations profiles. Storing credential values would violate the security model.
Recommendation
Use transactional migrations, foreign keys, explicit composite uniqueness, and a disposable database for isolation tests. Any migration with potential data loss requires a separate stop-and-review decision.