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

[FeatureToggle] Add new autofill config for partial save trigger #724

Merged
merged 5 commits into from
Dec 18, 2024

Conversation

dbajpeyi
Copy link
Collaborator

@dbajpeyi dbajpeyi commented Dec 17, 2024

Reviewer: @GioSensation
Asana: https://app.asana.com/0/72649045549333/1209005356472261/f

Description

Since Windows and Android are blocked out from regular autofill releases since https://github.com/duckduckgo/duckduckgo-autofill/releases/tag/16.0.0 because, the implementation for partial saves is not ready yet. This PR adds the implementation behind a feature toggle partial_form_saves which will be disabled by default. This way we can continue releasing improvements on Android/Windows without autofill regression.

  1. Added tests for each platform with the feature toggle,
  2. Reverted form and formatters tests to match https://github.com/duckduckgo/duckduckgo-autofill/pull/702/files

Steps to test

Use deviantart.com to test the login and reset password scenario.

@dbajpeyi dbajpeyi marked this pull request as draft December 17, 2024 19:41
@dbajpeyi dbajpeyi marked this pull request as ready for review December 18, 2024 10:05
@dbajpeyi dbajpeyi changed the title [AutofillConfig] Add new autofill config for partial save trigger [FeatureToggle] Add new autofill config for partial save trigger Dec 18, 2024
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/chore/partial-save-feature-toggle branch from 75c0d19 to 5feeeb0 Compare December 18, 2024 10:29
@@ -84,8 +84,8 @@ describe('Test the form class reading values correctly', () => {
<input type="password" value="" autocomplete="new-password" />
<button type="submit">Sign up</button>
</form>`,
expHasValues: true,
expValues: { credentials: { username: 'testUsername' } },
expHasValues: false,
Copy link
Collaborator Author

@dbajpeyi dbajpeyi Dec 18, 2024

Choose a reason for hiding this comment

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

Tests (this and the others) reverted to match https://github.com/duckduckgo/duckduckgo-autofill/pull/702/files so I am confident we're good here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

const values = prepareFormValuesForStorage({
credentials: { username: '[email protected]' },
// @ts-ignore
creditCards: {},
// @ts-ignore
identities: {},
});
expect(values.credentials?.username).toBe('[email protected]');
expect(values.credentials).toBeUndefined();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@dbajpeyi dbajpeyi force-pushed the dbajpeyi/chore/partial-save-feature-toggle branch 4 times, most recently from b0a6fbc to c887cf9 Compare December 18, 2024 10:51
@dbajpeyi
Copy link
Collaborator Author

@GioSensation Looking at the test cases is a good start!

@@ -244,6 +244,7 @@ export function createWebkitMocks(platform = 'macos') {
password_generation: true,
credentials_saving: true,
inlineIcon_credentials: true,
partial_form_saves: true,
Copy link
Collaborator Author

@dbajpeyi dbajpeyi Dec 18, 2024

Choose a reason for hiding this comment

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

Setting this to true means iOS and macOS tests are working as expected, no change needed!

@dbajpeyi dbajpeyi force-pushed the dbajpeyi/chore/partial-save-feature-toggle branch from c887cf9 to 545d9aa Compare December 18, 2024 14:22
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/chore/partial-save-feature-toggle branch from 545d9aa to 29a049b Compare December 18, 2024 14:24
Copy link
Member

@GioSensation GioSensation left a comment

Choose a reason for hiding this comment

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

Just a nit plus a suggestion to use the expected future value on Android integration tests. Otherwise, it's looking good. Thanks for updating as suggested on MM.

@@ -56,6 +56,7 @@ test.describe('Android Save prompts', () => {
androidStringReplacements({
featureToggles: {
credentials_saving: true,
partial_form_saves: false,
Copy link
Member

Choose a reason for hiding this comment

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

In the future this will also be set to true, so I'm inclined to flip this right away and keep the tests working as they are expected to when the feature is actually enabled. Then I see below a test that checks that the feature flag is respected, so we're covered.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, actually the feature toggle is already set to true now https://github.com/duckduckgo/privacy-configuration/pull/2593/files

Comment on lines 804 to 805
Boolean(values?.credentials?.username) &&
Boolean(this.settings.featureToggles.partial_form_saves);
Copy link
Member

Choose a reason for hiding this comment

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

Seems like we don't need to cast to a Boolean. Certainly not for the last one. Let's simplify. 🙂

Copy link
Collaborator Author

@dbajpeyi dbajpeyi Dec 18, 2024

Choose a reason for hiding this comment

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

Personally I don't prefer when the output type is not explicit enough. My reason for doing it this way was that we expect the values to act like boolean.
Screenshot 2024-12-18 at 15 30 20

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But I could've missed something, not arguing there 😄

Copy link
Member

Choose a reason for hiding this comment

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

It's getting philosophical, don't want to argue. My stance is: the language does that Boolean cast for you. You're just adding noise in the source code. Arguably, sometimes it can be useful, but casting a feature flag is just noise IMO. Anyway, don't want to block on this.

Copy link
Collaborator Author

@dbajpeyi dbajpeyi Dec 18, 2024

Choose a reason for hiding this comment

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

Kept Boolean in the username part because during debugging shouldTriggerPartialSave becomes an empty one, and has caught me off guard a couple of times. The last one is fair to change, updated :)

Thanks for the comments.

@dbajpeyi dbajpeyi merged commit 47c26dc into main Dec 18, 2024
1 check passed
@dbajpeyi dbajpeyi deleted the dbajpeyi/chore/partial-save-feature-toggle branch December 18, 2024 14:47
CDRussell pushed a commit to duckduckgo/Android that referenced this pull request Dec 18, 2024
Task/Issue URL:
https://app.asana.com/0/1209009001482464/1209009001482464
Autofill Release:
https://github.com/duckduckgo/duckduckgo-autofill/releases/tag/16.1.0


## Description
Updates Autofill to version
[16.1.0](https://github.com/duckduckgo/duckduckgo-autofill/releases/tag/16.1.0).

### Autofill 16.1.0 release notes
## What's Changed
* [DeviceInterface] Call closeautofillparent only after openManage calls
by @dbajpeyi in
duckduckgo/duckduckgo-autofill#718
* [CredentialsImport] Call credentials flow call first, and then close
parent by @dbajpeyi in
duckduckgo/duckduckgo-autofill#723
* [FeatureToggle] Add new autofill config for partial save trigger by
@dbajpeyi in duckduckgo/duckduckgo-autofill#724


**Full Changelog**:
duckduckgo/duckduckgo-autofill@16.0.0...16.1.0

## Steps to test
This release has been tested during autofill development. For smoke test
steps see [this
task](https://app.asana.com/0/1198964220583541/1200583647142330/f).

Co-authored-by: dbajpeyi <[email protected]>
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