google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.21k stars 278 forks source link

`validateHaveSettingsChanged` Should Be Updated To Align With Existing Semantic Convention #8904

Open zutigrm opened 3 weeks ago

zutigrm commented 3 weeks ago

Feature Description

validateHaveSettingsChanged should be used with createValidationSelector so it can be properly validated agains functions throw, and also test coverage for this utility should be added. More details in the comment here


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

binnieshah commented 3 weeks ago

@tofumatt any chance you can review this one please?

tofumatt commented 3 weeks ago

@zutigrm Which instances of validateHaveSettingsChanged should be changed here?

I see at least two separate instances:

  1. This one in the Ads datastore: https://github.com/google/site-kit-wp/blob/81fdd2fb31d7d9bd529bfcde292754db1d01c00a/assets/js/modules/ads/datastore/settings.js#L97
  2. This one in the Analytics datastore: https://github.com/google/site-kit-wp/blob/81fdd2fb31d7d9bd529bfcde292754db1d01c00a/assets/js/modules/analytics-4/datastore/settings.js#L304

There's the default created for this argument: https://github.com/google/site-kit-wp/blob/81fdd2fb31d7d9bd529bfcde292754db1d01c00a/assets/js/googlesitekit/data/create-settings-store.js#L85, but I don't think that is relevant here.

properly validate selector for function throw, and use returned selectors

What does this mean exactly? It seems like it means that it should try/catch a callback and return its value if it doesn't catch, but I'm not clear on what this means. Are there other functions you can supply as examples?

zutigrm commented 3 weeks ago

@tofumatt I see your point, I will make it clearer, it is basically about how the function is used in the store. Will update the AC

zutigrm commented 3 weeks ago

@tofumatt AC updated

tofumatt commented 2 weeks ago

The ACs needed more clarity around what the outcome should be here, so mentioning the explicit selector names and where they'd come from I think clears things up.

Moving to IB 🙂

tofumatt commented 2 weeks ago

switching the conversion tracking toggle on edit settings screen of Ads and Analytics module should change be detected in the save button

Can you rephrase this? I don't understand what this means specifically.


The IB here doesn't go into any details about what should change really, aside from what's already outlined in the ACs. Can you go into at least a bit of conceptual detail on how this would be implemented/how it should function? Right now the IB just reads like "implement the ACs", which isn't specific enough to review.

For example, what should be tested in the tests for these selectors? What is the behaviour we want to test? That would be good to outline in the IB.

zutigrm commented 2 weeks ago

@tofumatt Thanks. Since it straightforward and AC covered good part of the details with pointing to the example, I thought it won't need much details in IB as well. I updated IB now to have more info and expanded on test section, let me know what you think

tofumatt commented 2 weeks ago

IB ✅

mohitwp commented 1 week ago

QA Update ⚠️

@zutigrm I completed QA according to QAB but AC of this ticket is more technical. Should we tag QA:Eng to verify points mentioned under AC ?

**Analytics module** https://github.com/google/site-kit-wp/assets/94359491/4cd61e80-3daa-41ae-9434-b8f337f0725c **Ads module** https://github.com/google/site-kit-wp/assets/94359491/57bdffd8-fd0f-4fab-90f8-ba3ebb1f8244 **Conversion tracking Toggle** https://github.com/google/site-kit-wp/assets/94359491/d820759c-123d-43d7-b821-15cc3bfd3361
mohitwp commented 1 week ago

QA Update ✅

**Analytics module** https://github.com/google/site-kit-wp/assets/94359491/4cd61e80-3daa-41ae-9434-b8f337f0725c **Ads module** https://github.com/google/site-kit-wp/assets/94359491/57bdffd8-fd0f-4fab-90f8-ba3ebb1f8244 **Conversion tracking Toggle** https://github.com/google/site-kit-wp/assets/94359491/d820759c-123d-43d7-b821-15cc3bfd3361