Skip to content

Conversation

@david-livefront
Copy link
Collaborator

@david-livefront david-livefront commented Dec 17, 2025

🎟️ Tracking

PM-29912

📔 Objective

This PR Moves as much logic as possible into a central location and exposes it via the app-specific SettingsRepositorys.

⏰ 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

) : BaseDiskSource(sharedPreferences = sharedPreferences),
SettingsDiskSource {
SettingsDiskSource,
FlightRecorderDiskSource by flightRecorderDiskSource {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a little torn with this.

On one hand, this centralizes a decent bit of logic but it is a nit cumbersome in the these places.

@claude
Copy link
Contributor

claude bot commented Dec 17, 2025

Claude finished @david-livefront's task in 2m 48s —— View job


Code Review Complete

I've reviewed the PR changes. Here are my findings:


❌ Critical Issue - Test Data Invalid JSON

File: data/src/test/kotlin/com/bitwarden/data/datasource/disk/FlightRecorderDiskSourceTest.kt:30

Missing comma after "id" field will cause test failures:

"id": "51"  // ← Missing comma here
"fileName": "flight_recorder_2025-04-03_14-22-40",

Should be:

"id": "51",
"fileName": "flight_recorder_2025-04-03_14-22-40",

Same issue appears around line 63.


✅ Architecture Review

Strengths:

  • Proper separation of concerns - moving FlightRecorderDiskSource to :data module centralizes logic
  • Clean delegation pattern in both SettingsDiskSourceImpl classes using Kotlin's by keyword
  • Consistent pattern across architectural layers (disk source → repository)
  • Comprehensive test coverage for new implementation
  • Correct DI setup across all modules
  • Clean removal of deprecated factory method and duplicate code

Module Organization:

  • :data module correctly owns flight recorder persistence
  • :app and :authenticator delegate appropriately
  • No circular dependencies introduced

Implementation Quality:

  • Extends BaseDiskSource properly
  • Uses bufferedMutableSharedFlow with correct Flow semantics
  • Type-safe JSON serialization
  • Properly scoped as internal

Regarding the "cumbersomeness" concern:
The slight additional constructor parameters are a reasonable trade-off for:

  • Single responsibility principle
  • Independent testability
  • Reusability across apps
  • Clear dependency graph

📝 Recommendations

  1. Fix the JSON syntax error in test data
  2. Verify tests pass after fix
  3. Consider adding interface documentation explaining FlightRecorderDiskSource extension

Overall: Well-executed refactoring following Bitwarden architectural patterns. Only blocking issue is the test data JSON syntax.

@david-livefront david-livefront force-pushed the PM-29912-flight-recorder-disk-source branch from 48d8493 to 705cbff Compare January 2, 2026 16:16
@github-actions
Copy link
Contributor

github-actions bot commented Jan 2, 2026

Logo
Checkmarx One – Scan Summary & Detailsff394fcf-a26b-4f68-84db-cd318bed571a

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

@david-livefront david-livefront force-pushed the PM-29912-flight-recorder-disk-source branch 2 times, most recently from 494d2e1 to d0a1aca Compare January 2, 2026 17:07
@david-livefront david-livefront force-pushed the PM-29912-flight-recorder-disk-source branch from d0a1aca to 2394949 Compare January 2, 2026 17:21
@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.51%. Comparing base (674cde9) to head (2394949).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6281      +/-   ##
==========================================
+ Coverage   84.93%   85.51%   +0.57%     
==========================================
  Files         876      763     -113     
  Lines       56942    54599    -2343     
  Branches     7900     7855      -45     
==========================================
- Hits        48366    46688    -1678     
+ Misses       5833     5183     -650     
+ Partials     2743     2728      -15     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants