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 ca4f944 to 48d8493 Compare December 17, 2025 20:54
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.

2 participants