Skip to content

Conversation

@matt-livefront
Copy link
Collaborator

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

🎟️ Tracking

PM-28540

📔 Objective

Adds an AuthenticatorSharedMocks target containing the mocks and fixtures used within AuthenticatorShared.

This adds consistency with how we've used BitwardenKitMocks and AuthenticatorBridgeKitMocks and will make it easier to implement Xcodegen templates (#2153).

⏰ 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 21, 2025 19:24
@claude
Copy link

claude bot commented Nov 21, 2025

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


Code Review Complete

This PR successfully adds the AuthenticatorSharedMocks target, creating consistency with BitwardenKitMocks and AuthenticatorBridgeKitMocks. The implementation is clean and follows established patterns.


Summary

The PR introduces a new framework target containing mocks and fixtures from AuthenticatorShared, properly configures dependencies, and updates all test targets to use the new module. This improves modularity and sets the foundation for Xcodegen templates.

Files Changed: 15 files (+73/-89 lines)

  • New target: AuthenticatorSharedMocks
  • Moved fixtures: 5 files (APITestData, ImportTestData, ItemListItem+Fixtures, bundle finder)
  • Updated imports: 7 test files
  • Enhanced fixture: AuthenticatorBridgeItemDataView+Fixtures (added fixtureFilled() and made public)

Good Practices Observed

  • ✅ Consistent with BitwardenKitMocks and AuthenticatorBridgeKitMocks patterns
  • ✅ Proper dependency injection through target dependencies
  • ✅ Net reduction in lines of code (-89 → +73) through deduplication
  • ✅ Bundle finder pattern matches existing implementations
  • swiftlint:disable missing_docs used appropriately for test fixtures
  • ✅ Public access modifiers added consistently
  • ✅ Sourcery-generated mocks included in target sources

Findings

Finding 1: Missing Info.plist file specification in AuthenticatorSharedMocks target

Finding 2: Duplicate fixtureFilled() removed from wrong location


Details

Finding 1: Missing Info.plist file specification in AuthenticatorSharedMocks target (⚠️)

Location: project-bwa.yml:221-238

Issue: The AuthenticatorSharedMocks target uses GENERATE_INFOPLIST_FILE: YES but doesn't specify an explicit INFOPLIST_FILE path, while AuthenticatorBridgeKitMocks does.

Current implementation:

AuthenticatorSharedMocks:
  type: framework
  platform: iOS
  settings:
    base:
      ENABLE_TESTING_SEARCH_PATHS: YES
      GENERATE_INFOPLIST_FILE: YES

Comparison with AuthenticatorBridgeKitMocks (project-bwk.yml:100-116):

AuthenticatorBridgeKitMocks:
  type: framework
  platform: iOS
  settings:
    base:
      ENABLE_TESTING_SEARCH_PATHS: YES
      INFOPLIST_FILE: AuthenticatorBridgeKit/MocksInfo.plist

Why this matters: While GENERATE_INFOPLIST_FILE: YES works, having an explicit Info.plist provides consistency and allows custom configuration if needed later.

Recommendation: Either:

  1. Add an explicit MocksInfo.plist file and reference it (preferred for consistency), OR
  2. Document why GENERATE_INFOPLIST_FILE is sufficient for this target

This is a minor inconsistency rather than a blocker, but consistency with other mocks targets would be ideal.

Finding 2: Duplicate fixtureFilled() removed from wrong location (💭)

Context: The PR correctly removes the duplicate AuthenticatorBridgeItemDataView+Fixtures.swift file from AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/ and enhances the canonical version in AuthenticatorBridgeKit.

What changed:

  • ❌ Deleted: AuthenticatorShared/Core/Vault/Models/Domain/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift (52 lines)
  • ✅ Enhanced: AuthenticatorBridgeKit/Tests/TestHelpers/Fixtures/AuthenticatorBridgeItemDataView+Fixtures.swift (+16 lines)
    • Made extension public
    • Added fixtureFilled() helper (was in deleted file)
    • Added swiftlint:disable missing_docs

Question: Why was this fixture duplicated in AuthenticatorShared originally? Was there a reason it needed to be in both places, or was this always unintended duplication?

Observation: The consolidation is correct - fixtures for AuthenticatorBridgeItemDataView should live in AuthenticatorBridgeKit, not AuthenticatorShared. The new AuthenticatorSharedMocks target properly depends on AuthenticatorBridgeKitMocks to access these fixtures.


Architecture Compliance

Target Structure: Follows established pattern from BitwardenKitMocks and AuthenticatorBridgeKitMocks

  • Framework type with ENABLE_TESTING_SEARCH_PATHS: YES
  • Includes Fixtures and Mocks directories
  • Includes Sourcery-generated AutoMockable.generated.swift
  • Proper dependency chain: AuthenticatorSharedMocksAuthenticatorSharedAuthenticatorBridgeKitMocksBitwardenKit/TestHelpers

Test Target Updates: All three test targets correctly updated

  • AuthenticatorSharedTests (unit tests)
  • AuthenticatorSharedSnapshotTests
  • AuthenticatorSharedViewInspectorTests

Import Statements: All 7 test files correctly add import AuthenticatorSharedMocks

Bundle Access Pattern: Matches established pattern (BitwardenKitMocksBundleFinder)


Test Coverage

No test changes required - this is purely a refactoring/reorganization. Existing tests continue to work with the new module structure.


Security Considerations

No security implications - this is a test-only target that doesn't ship with production code.


Action Items

  • Consider: Add explicit MocksInfo.plist for consistency with AuthenticatorBridgeKitMocks (Finding 1)
  • Verify: CI builds pass with the new target configuration
  • Verify: Xcodegen can successfully generate the project

@github-actions
Copy link
Contributor

Logo
Checkmarx One – Scan Summary & Details525fb494-ac91-4046-a7d5-bb3213261738

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

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.03%. Comparing base (820865c) to head (d6e43a7).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
...vices/API/Fixtures/APITestData+Authenticator.swift 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2159      +/-   ##
==========================================
- Coverage   85.39%   84.03%   -1.36%     
==========================================
  Files        1727     1983     +256     
  Lines      145627   161165   +15538     
==========================================
+ Hits       124352   135439   +11087     
- Misses      21275    25726    +4451     

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

@matt-livefront matt-livefront merged commit ff2b88c into main Nov 25, 2025
18 checks passed
@matt-livefront matt-livefront deleted the matt/PM-28540-authenticator-shared-mocks branch November 25, 2025 23:14
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