fix: silence sqlcipher logs except for ERROR level#3374
fix: silence sqlcipher logs except for ERROR level#3374xmtp-coder-agent wants to merge 4 commits intomainfrom
Conversation
ApprovabilityVerdict: Needs human review While this is a simple logging configuration change (defaulting sqlcipher logs to ERROR level), the author does not own the modified file which is designated to @xmtp/protocol-sdk. The code owners should verify this logging behavior change aligns with their expectations. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3374 +/- ##
==========================================
- Coverage 82.99% 82.96% -0.04%
==========================================
Files 376 376
Lines 50896 50940 +44
==========================================
+ Hits 42243 42262 +19
- Misses 8653 8678 +25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Update this PR to be up to date with the base branch |
Set default SQLCipher cipher_log_level to ERROR so only error-level messages are emitted. The SQLCIPHER_LOG=true env var still overrides to INFO for debugging purposes. Resolves #3257 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
12dd6c0 to
4cdd2b4
Compare
|
Rebased onto latest main. |
|
Claude finished @xmtp-coder-agent's task —— View job Code Review CompleteReview Date: March 31, 2026 00:42 UTC Tasks
Review FeedbackThe implementation looks solid overall. The changes appropriately address the issue of silencing SQLCipher logs in production while preserving debug capabilities. Here are a few observations: Code Quality✅ Good: The logic is clean and well-structured. The environment variable check at ✅ Good: The test at Test Coverage✅ Comprehensive: The new test
Security✅ No security concerns identified. The change only affects logging configuration and doesn't expose sensitive data. Performance✅ No performance concerns. The environment variable check happens once during connection validation, which is negligible overhead. Implementation DetailsThe logic at
Note: The codecov report indicates 1 line missing coverage. Based on the implementation, this is likely the error path from the SummaryThe PR successfully implements the requested feature with good test coverage. The implementation is clean, secure, and follows Rust best practices. No blocking issues identified. |
|
Can we add some tests to validate that this actually works as expected |
Validates that cipher_log_level defaults to ERROR and can be overridden to INFO via the SQLCIPHER_LOG env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Added a test (
Both cases are tested sequentially in a single test since |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
cipher_log_leveltoERRORso only error-level messages are emitted in productionSQLCIPHER_LOG=trueenvironment variable override for verbose (INFO-level) debuggingNONElog level (unchanged)Resolves #3257
Test plan
cargo clippy -p xmtp_dbpasses with no warnings🤖 Generated with Claude Code
Note
Silence SQLCipher logs below ERROR level by default in
EncryptedConnection.validatevalidate()in sqlcipher_connection.rs now explicitly setscipher_log=stderrandcipher_log_level=ERRORwhen theSQLCIPHER_LOGenv var is not set.SQLCIPHER_LOGistrueor1,cipher_log_levelis set toINFOas before.PRAGMA cipher_log_levelaftervalidate().Macroscope summarized 5bd3193.