Skip to content

Conversation

@matt-livefront
Copy link
Collaborator

@matt-livefront matt-livefront commented Nov 14, 2025

🎟️ Tracking

PM-26063

📔 Objective

Adds a reusable component to BitwardenKit for the Flight Recorder section within the settings view of the app. This will make it so this component can more easily be shared with the Authenticator.

📸 Screenshots

Screenshot 2025-11-14 at 3 22 11 PM

⏰ 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

@matt-livefront matt-livefront requested a review from a team as a code owner November 14, 2025 21:25
@claude
Copy link

claude bot commented Nov 14, 2025

Claude finished @matt-livefront's task —— View job


Code Review Complete

Summary

This PR successfully refactors Flight Recorder settings into a reusable component in BitwardenKit. The implementation follows the established unidirectional data flow architecture and integrates cleanly with the existing AboutView. The changes reduce code duplication and enable easier sharing with the Authenticator app.

Previous review findings: The 2 access modifier findings from the previous review were not addressed in these commits. Both remain valid concerns (see Findings 2 and 3 below).


Critical Issues

Finding 1: Snapshot tests are disabled and will not run in CI

The snapshot tests have disabletest prefixes instead of test, which prevents them from executing:

// FlightRecorderSettingsSectionView+SnapshotTests.swift:54
func disabletest_snapshot_flightRecorderSettingsSection_disabled() {

// FlightRecorderSettingsSectionView+SnapshotTests.swift:63
func disabletest_snapshot_flightRecorderSettingsSection_enabled() {

This defeats the purpose of snapshot testing for catching visual regressions. The tests should be enabled.


Minor Issues

Finding 2: Store property should be marked as public (from previous review - still not addressed)

BitwardenKit/UI/Platform/Settings/FlightRecorder/FlightRecorderSettingsSection/FlightRecorderSettingsSectionView.swift:30

The store property is internal, but this is a public struct in BitwardenKit meant to be used by other modules. For consistency with the public API and to ensure proper access from BitwardenShared, this should be public.

Comparison with similar components

Looking at other reusable views in BitwardenKit like SectionView and ToastView, internal properties are acceptable when the view is only accessed through its public initializer. However, since this uses @ObservedObject and the store is directly accessed in tests and potentially by consumers, marking it public would be more explicit about the API contract.

Finding 3: Computed property should be marked as public (from previous review - still not addressed)

BitwardenKit/UI/Platform/Settings/FlightRecorder/FlightRecorderSettingsSection/FlightRecorderSettingsSectionState.swift:20

The flightRecorderToggleAccessibilityLabel computed property is internal but is accessed from a public view. While this works due to module boundaries, making it public would clarify that it's part of the public API of this state struct.


Code Quality Improvements

Finding 4: Test coverage gap for accessibility label with active log

FlightRecorderSettingsSectionStateTests.swift only tests the accessibility label in two states (on/off), but doesn't verify the formatted date/time values are correct in the label. Consider adding a test that validates the exact format matches expectations, especially since there's custom DateFormatter logic for VoiceOver.

Finding 5: Missing DocC documentation comment

BitwardenKit/UI/Platform/Settings/FlightRecorder/FlightRecorderSettingsSection/FlightRecorderSettingsSectionView.swift:30

Per the project guidelines in .claude/CLAUDE.md: "Everything in the code requires DocC documentation except for protocol properties/functions implementations." The store property should have a DocC comment explaining its purpose.


Good Practices Observed

  • Clean separation of concerns with dedicated Action, Effect, and State files
  • Proper use of the Store pattern for child state management
  • Comprehensive ViewInspector tests covering toggle interactions
  • Well-documented public API with clear DocC comments
  • Proper integration using store.child() pattern in AboutView

Action Items

  1. Required: Enable snapshot tests by removing disable prefix from test method names
  2. ⚠️ Recommended: Add public modifier to store property in FlightRecorderSettingsSectionView
  3. ⚠️ Recommended: Add public modifier to flightRecorderToggleAccessibilityLabel computed property
  4. ⚠️ Recommended: Add DocC comment for the store property
  5. 🎨 Optional: Add test verifying exact accessibility label format with date/time

@github-actions
Copy link
Contributor

github-actions bot commented Nov 14, 2025

Logo
Checkmarx One – Scan Summary & Details5b43bed4-20e0-42d8-b91c-ba2de5fd266c

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

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

❌ Patch coverage is 77.43590% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.91%. Comparing base (8ecf16a) to head (9f0b3f0).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
...ghtRecorderSettingsSectionView+SnapshotTests.swift 0.00% 38 Missing ⚠️
...ngsSection/FlightRecorderSettingsSectionView.swift 85.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2141      +/-   ##
==========================================
- Coverage   85.23%   83.91%   -1.33%     
==========================================
  Files        1714     1981     +267     
  Lines      145520   160891   +15371     
==========================================
+ Hits       124040   135004   +10964     
- Misses      21480    25887    +4407     

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

@Environment(\.openURL) private var openURL

/// The `Store` for this view.
@ObservedObject var store: FlightRecorderSettingsSectionStore
Copy link

Choose a reason for hiding this comment

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

🎨 Finding 1: Store property should be marked as public

The store property is internal, but this is a public struct in BitwardenKit meant to be used by other modules (like BitwardenShared). For consistency with other public views in the codebase, this property should be marked public.

Suggested change
@ObservedObject var store: FlightRecorderSettingsSectionStore
public var store: FlightRecorderSettingsSectionStore

// MARK: Computed Properties

/// The accessibility label for the Flight Recorder toggle.
var flightRecorderToggleAccessibilityLabel: String {
Copy link

Choose a reason for hiding this comment

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

🎨 Finding 2: Computed property should be marked as public

The flightRecorderToggleAccessibilityLabel computed property is internal, but it's accessed from a public view. For consistency and to make the intent clear that this is part of the public API of this state, it should be marked public.

Suggested change
var flightRecorderToggleAccessibilityLabel: String {
public var flightRecorderToggleAccessibilityLabel: String {

fedemkr
fedemkr previously approved these changes Nov 17, 2025

/// The flight recorder settings section view renders correctly when disabled.
@MainActor
func disabletest_snapshot_flightRecorderSettingsSection_disabled() {
Copy link

Choose a reason for hiding this comment

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

Finding 1: Snapshot tests are disabled

The disabletest prefix prevents these tests from running. They should be named test_snapshot_flightRecorderSettingsSection_disabled to execute in CI and catch visual regressions.

Suggested change
func disabletest_snapshot_flightRecorderSettingsSection_disabled() {
func test_snapshot_flightRecorderSettingsSection_disabled() {


/// The flight recorder settings section view renders correctly when enabled.
@MainActor
func disabletest_snapshot_flightRecorderSettingsSection_enabled() {
Copy link

Choose a reason for hiding this comment

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

Finding 1: Snapshot tests are disabled

The disabletest prefix prevents these tests from running. They should be named test_snapshot_flightRecorderSettingsSection_enabled to execute in CI and catch visual regressions.

Suggested change
func disabletest_snapshot_flightRecorderSettingsSection_enabled() {
func test_snapshot_flightRecorderSettingsSection_enabled() {

@Environment(\.openURL) private var openURL

/// The `Store` for this view.
@ObservedObject var store: FlightRecorderSettingsSectionStore
Copy link

Choose a reason for hiding this comment

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

⚠️ Finding 2: Store property should be marked as public

This property is internal but the struct is public and meant to be used across module boundaries (BitwardenKit → BitwardenShared). Making it public clarifies the API contract.

⚠️ Finding 5: Missing DocC comment

Per project guidelines, all public properties require DocC documentation. Add a comment explaining the store's purpose.

Suggested change
@ObservedObject var store: FlightRecorderSettingsSectionStore
/// The `Store` for this view.
@ObservedObject public var store: FlightRecorderSettingsSectionStore

// MARK: Computed Properties

/// The accessibility label for the Flight Recorder toggle.
var flightRecorderToggleAccessibilityLabel: String {
Copy link

Choose a reason for hiding this comment

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

⚠️ Finding 3: Computed property should be marked as public

This computed property is accessed from a public view and is part of the public API of this state struct. Making it public clarifies this intent and ensures consistent access patterns.

Suggested change
var flightRecorderToggleAccessibilityLabel: String {
public var flightRecorderToggleAccessibilityLabel: String {

@matt-livefront matt-livefront merged commit b8161ee into main Nov 17, 2025
34 of 42 checks passed
@matt-livefront matt-livefront deleted the matt/PM-26063-flight-recorder-settings-section branch November 17, 2025 17:45
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.

4 participants