Skip to content

Conversation

@KatherineInCode
Copy link
Contributor

📔 Objective

I have noticed that Claude often generates comments that states that mock files aren't in the BitwardenKitMocks (etc.) target, but are instead in a Mocks folder. This is because Claude has insufficient training data to understand our Xcodegen configurations.

This attempts to update the Claude configurations to specify that we put mock files in Mocks directories, and also to call out our preferred usage of Sourcery for mock generation.

⏰ 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

@KatherineInCode KatherineInCode marked this pull request as ready for review November 12, 2025 17:06
@claude
Copy link

claude bot commented Nov 12, 2025

Claude finished @KatherineInCode's task —— View job


PR Review Complete

This PR successfully addresses the confusion around mock file placement by documenting the Xcodegen auto-inclusion behavior and Sourcery preference. The changes are clear, consistent, and directly aligned with the stated objective.


📝 Summary

Documentation update clarifying mock generation and placement conventions across Claude configuration files and architecture documentation. Changes inform Claude (and developers) about Sourcery-based mock generation preference and the automatic inclusion of Mocks folder files in test targets.


🎨 Suggested Improvements

Finding 1: Inconsistent specificity between CLAUDE.md and Architecture.md regarding "manual" mock implementations

The .claude/CLAUDE.md:41 explicitly states "If a manual mock implementation is needed", but Docs/Architecture.md:61-62 just says "Mock implementations" without the "manual" qualifier. This could cause confusion since Sourcery-generated mocks are also in Mocks folders.

Suggested rewording for Architecture.md
- `BitwardenKitMocks`: Mock implementations for BitwardenKit components. Manual mock files placed in a `Mocks` folder in `BitwardenKit` will be automatically included in this target.
- `AuthenticatorBridgeKitMocks`: Mock implementations for AuthenticatorBridgeKit components. Manual mock files placed in a `Mocks` folder in `AuthenticatorBridgeKit` will be automatically included in this target.

This clarifies that the statement applies specifically to manual mocks (since Sourcery-generated ones are handled differently in the build process).

Finding 2: Potentially ambiguous wording in SKILL.md about Sourcery and Mocks folder relationship

The .claude/skills/reviewing-changes/SKILL.md:39 states "Mocks either rely on Sourcery's AutoMockable annotation or are in a Mocks folder." This could be misinterpreted as mutually exclusive options, when Sourcery-generated mocks may also output to Mocks folders.

Suggested rewording
- Mocks are generated using Sourcery's `AutoMockable` annotation where possible; manual mocks are placed in a `Mocks` folder.

This clarifies the preference hierarchy and relationship more precisely.


✅ Good Practices

  • Consistent terminology across all three modified files
  • Co-locating related documentation updates in a single PR
  • Clear preference hierarchy (Sourcery first, manual in Mocks folder second)

📋 Action Items

  1. Consider adding "manual" qualifier to Architecture.md descriptions (.claude/CLAUDE.md:41 / Docs/Architecture.md:61-62)
  2. Consider clarifying the Sourcery/Mocks folder relationship in SKILL.md (.claude/skills/reviewing-changes/SKILL.md:39)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Logo
Checkmarx One – Scan Summary & Details8521e0ee-9fa0-4976-a40c-0cd852207a3c

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

@codecov
Copy link

codecov bot commented Nov 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.77%. Comparing base (5dc773e) to head (16e8273).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2130      +/-   ##
==========================================
- Coverage   85.23%   83.77%   -1.46%     
==========================================
  Files        1709     1970     +261     
  Lines      145424   160813   +15389     
==========================================
+ Hits       123945   134727   +10782     
- Misses      21479    26086    +4607     

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

1. Follow existing code style in surrounding files
2. Write tests alongside implementation
1. Prefer using Sourcery with the `AutoMockable` attribute for creating mocks.
2. If a manual mock implementation is needed (not using Sourcery), place it in a `Mocks` folder within the appropriate framework directory, as our Xcodegen configuration will automatically include it in the correct test target.
Copy link
Member

Choose a reason for hiding this comment

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

🤔 I think this is true only for mocks that are for BitwardenKit or AuthenticatorBridgeKit targets. However, on other targets like BitwardenShared or AuthenticatorShared we have no Mocks folder; mocks are under TestHelpers folders and belong to their tests targets. Perhaps we should make that explicit here as well as it might create Mocks folders in those targets to follow this rule which would not be the current approach.

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