Skip to content

Conversation

@neuronull
Copy link
Contributor

@neuronull neuronull commented Nov 19, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-26932

📔 Objective

Cascading the standardization of tracing crate from clients repo into the SDK, that was started per bitwarden/clients#16321

, this change updates the bitwarden-uniffi crate to use tracing.

android:

Screenshot 2025-11-21 at 10 15 51

ios:

Screenshot 2025-11-20 at 09 17 53

🚨 Breaking Changes

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@neuronull neuronull self-assigned this Nov 19, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

Logo
Checkmarx One – Scan Summary & Details5dc239bd-8220-4b77-add1-7bbc8a00a36c

Great job! No new security vulnerabilities introduced in this pull request

@github-actions
Copy link
Contributor

github-actions bot commented Nov 19, 2025

🔍 SDK Breaking Change Detection Results

SDK Version: autofill/pm-26932/use-tracing-in-uniffi-ios-android (42a81e8)
Completed: 2025-11-21 17:42:19 UTC
Total Time: 215s

Client Status Details
typescript ✅ No breaking changes detected TypeScript compilation passed with new SDK version - View Details

Breaking change detection completed. View SDK workflow

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 0% with 54 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.54%. Comparing base (4921d8a) to head (42a81e8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/bitwarden-uniffi/src/lib.rs 0.00% 54 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #566      +/-   ##
==========================================
- Coverage   79.63%   79.54%   -0.10%     
==========================================
  Files         302      302              
  Lines       32256    32295      +39     
==========================================
  Hits        25688    25688              
- Misses       6568     6607      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@neuronull neuronull force-pushed the autofill/pm-26932/use-tracing-in-uniffi-ios-android branch from 84c195c to 063b63d Compare November 21, 2025 17:23
@neuronull neuronull force-pushed the autofill/pm-26932/use-tracing-in-uniffi-ios-android branch from 063b63d to 42a81e8 Compare November 21, 2025 17:32
@neuronull neuronull marked this pull request as ready for review November 21, 2025 17:53
@neuronull neuronull requested a review from a team as a code owner November 21, 2025 17:53
@neuronull neuronull requested a review from dereknance November 21, 2025 17:53
@claude
Copy link

claude bot commented Nov 21, 2025

Claude finished @neuronull's task —— View job


Code Review Complete

Summary

This PR successfully migrates the bitwarden-uniffi crate from the log crate ecosystem (log, env_logger, android_logger, oslog) to the tracing crate ecosystem (tracing, tracing-subscriber, tracing-android, tracing-oslog). The migration is technically sound and aligns with the broader standardization effort initiated in the clients repository.

Findings

Finding 1: PR title contains a typo

❌ The PR title "Relplace log with tracing" should be "Replace log with tracing"

Suggested correction
Replace `log` with `tracing` for ios and android uniffi

Finding 2: Test coverage gap is expected

💭 Codecov reports 0% patch coverage with 54 lines missing coverage in lib.rs:116-173. This is expected since:

  • The init_logger() function contains platform-specific initialization code with conditional compilation
  • This code executes once at SDK initialization and primarily configures external logging infrastructure
  • Unit testing logger initialization is typically not practical and provides limited value
  • The screenshots in the PR demonstrate the logging is working correctly on both platforms

Consider documenting in the PR description that the coverage gap is intentional for initialization code.

Finding 3: Enhanced structured logging capability

👍 The migration to tracing provides significant improvements:

  • Structured logging with field interpolation (e.g., error!(%error, "message") in android_support.rs:40)
  • Better context propagation and filtering capabilities
  • Consistent logging infrastructure across all platform targets
  • More detailed formatting with file, line number, and target information

Finding 4: Breaking change from android_logger behavior

⚠️ The old android_logger was initialized with init_once() which would silently ignore subsequent initialization attempts. The new implementation uses std::sync::Once which provides the same guarantee, but the tracing layer initialization could panic if called multiple times in edge cases. However, the Once::call_once wrapper ensures this cannot happen, so this is correctly implemented.

Finding 5: Logger configuration is more comprehensive

👍 The new init_logger() implementation provides better configuration:

  • Three-tier log level prioritization (runtime RUST_LOG → compile-time RUST_LOG → default INFO)
  • Consistent formatting across all platforms with file/line/target information
  • Pretty-printing enabled for better readability during development

Good Practices Observed

  • Proper use of Once to ensure single initialization
  • Platform-specific dependencies correctly scoped with cfg(target_os = "...")
  • Consistent tag naming across platforms
  • Error handling maintained in Android support initialization

Action Items

  1. Fix the typo in the PR title (can be done via GitHub UI)
  2. (Optional) Add a note in the PR description explaining that the coverage gap is expected for initialization code

@neuronull neuronull changed the title Relplace log with tracing for ios and android uniffi Replace log with tracing for ios and android uniffi Nov 21, 2025
@neuronull neuronull merged commit f118570 into main Nov 21, 2025
62 checks passed
@neuronull neuronull deleted the autofill/pm-26932/use-tracing-in-uniffi-ios-android branch November 21, 2025 20:26
bw-ghapp bot pushed a commit to bitwarden/sdk-swift that referenced this pull request Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants