Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-6819] add legacyUsernameGenerationService to dependency injection #8606

Closed

Conversation

audrey-jensen
Copy link
Contributor

@audrey-jensen audrey-jensen commented Apr 3, 2024

Type of change

- [ ] Bug fix
- [X] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Depends on #8596 and #8706

Objective

Integrate username generator adapter into bitwarden clients.

Code changes

Updates dependency injection of all clients from the state provider backed password generator service to MV3 backed password generator adapter:

  • apps/browser/src/background/main.background.ts
  • libs/angular/src/services/jslib-services.module.ts

Data migration:

  • libs/common/src/state-migrations/migrations/56-migrate-forwarder-settings.ts - migration proper
  • libs/common/src/state-migrations/migrations/56-migrate-forwarder-settings.spec.ts - unit tests
  • libs/common/src/tools/generator/key-definitions.ts - add keys for temporary migration buffers; these are necessary b/c API keys are encrypted
  • libs/common/src/tools/generator/username/forwarder-generator-strategy.ts - introduce rollover buffers during state initialization
  • libs/common/src/tools/generator/username/forwarder-generator-strategy.spec.ts unit tests

Add rollover keys to generator strategies:

  • libs/common/src/tools/generator/username/forwarders/addy-io.ts
  • libs/common/src/tools/generator/username/forwarders/duck-duck-go.ts
  • libs/common/src/tools/generator/username/forwarders/fastmail.ts
  • libs/common/src/tools/generator/username/forwarders/firefox-relay.ts
  • libs/common/src/tools/generator/username/forwarders/forward-email.ts
  • libs/common/src/tools/generator/username/forwarders/simple-login.ts

Publish adapter factory from generator module:

  • libs/common/src/tools/generator/index.ts

Fix missing default navigation settings:

  • libs/common/src/tools/generator/legacy-username-generation.service.ts

@github-actions github-actions bot added the needs-qa Marks a PR as requiring QA approval label Apr 3, 2024
@audrey-jensen audrey-jensen changed the title replace UsernameGeneratorService with `legacyUsernameGenerationServ… [PM-6819] replace UsernameGeneratorService with legacyUsernameGenerationService Apr 3, 2024
@audrey-jensen audrey-jensen changed the title [PM-6819] replace UsernameGeneratorService with legacyUsernameGenerationService [PM-6819] add legacyUsernameGenerationService to dependency injection Apr 3, 2024
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 71.23288% with 21 lines in your changes are missing coverage. Please review.

Project coverage is 27.70%. Comparing base (1e67014) to head (bd36bed).
Report is 1 commits behind head on main.

Files Patch % Lines
libs/common/src/tools/generator/key-definitions.ts 53.84% 6 Missing ⚠️
apps/browser/src/background/main.background.ts 0.00% 2 Missing ⚠️
libs/angular/src/services/jslib-services.module.ts 0.00% 2 Missing ⚠️
...ations/migrations/56-migrate-forwarder-settings.ts 92.30% 0 Missing and 2 partials ⚠️
...generator/username/forwarder-generator-strategy.ts 81.81% 2 Missing ⚠️
...ls/generator/legacy-username-generation.service.ts 83.33% 0 Missing and 1 partial ⚠️
...src/tools/generator/username/forwarders/addy-io.ts 50.00% 1 Missing ⚠️
...ools/generator/username/forwarders/duck-duck-go.ts 50.00% 1 Missing ⚠️
...rc/tools/generator/username/forwarders/fastmail.ts 50.00% 1 Missing ⚠️
...ols/generator/username/forwarders/firefox-relay.ts 50.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8606      +/-   ##
==========================================
+ Coverage   27.67%   27.70%   +0.03%     
==========================================
  Files        2369     2370       +1     
  Lines       69048    69102      +54     
  Branches    12918    12921       +3     
==========================================
+ Hits        19108    19145      +37     
- Misses      48506    48520      +14     
- Partials     1434     1437       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This comment was marked as off-topic.

@audrey-jensen

This comment was marked as resolved.

@audrey-jensen audrey-jensen marked this pull request as ready for review April 10, 2024 22:31
@audrey-jensen audrey-jensen requested review from a team as code owners April 10, 2024 22:31
@dani-garcia dani-garcia requested review from justindbaur and removed request for dani-garcia April 11, 2024 10:06
audrey-jensen

This comment was marked as resolved.

Copy link
Contributor

@aj-rosado aj-rosado left a comment

Choose a reason for hiding this comment

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

Great work!
Just a question regarding when to clear the state.
Will hold the approval until #8706 is merged

"addyIoBuffer",
{
deserializer: (value) => value,
clearOn: ["lock"],
Copy link
Contributor

Choose a reason for hiding this comment

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

is ClearOn lock correct? If it is, should it also clear on logout?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you're right, and this should only occur on logout. Technically, it should rarely matter. Those buffers clear themselves automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in e40d57c

@audrey-jensen

This comment was marked as outdated.

Copy link
Member

@justindbaur justindbaur left a comment

Choose a reason for hiding this comment

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

Such an improved way of storing this data!

@audrey-jensen
Copy link
Contributor Author

audrey-jensen commented Apr 15, 2024

Such an improved way of storing this data!

Props to @djsmith85 for doing the v1 iteration of the options types. His version made one options type per service. I might go back to it since the destructured approach isn't actually used by the forwarders, which makes it kind of noisy. Either way, splitting it out into forwarder-specific states is 100% a boon.

Copy link
Contributor

@aj-rosado aj-rosado left a comment

Choose a reason for hiding this comment

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

Great work on this!

@audrey-jensen
Copy link
Contributor Author

Withdrawing this PR because the generator UI needs to be fully reactive. This branch will be merged into a single branch that includes it, #8605, and reactive UI updates for the password generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-qa Marks a PR as requiring QA approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants