-
Notifications
You must be signed in to change notification settings - Fork 72
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
Reduce size of tcf_consent
payload in fides_consent
cookie
#4480
Conversation
Cypress13 upgrades to webpack5 which is needed to parse the IAB lib's JS class files
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Passing run #5499 ↗︎
Details:
Review all test suite changes for PR #4480 ↗︎ |
I've updated tests to no longer expect a There are two tests which are failing but which once we implement this ticket should pass. They're labeled with "TODO: CURRENTLY FAILING!!". That said, I wouldn't be surprised if more things came up during implementation that we need to tweak the tests for! |
…es into prod-1413/tcf-cookie-refactor
@@ -484,165 +444,6 @@ describe("updateExperienceFromCookieConsent", () => { | |||
]); | |||
}); | |||
}); | |||
|
|||
describe("tcf", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to remove these tests because updateExperienceFromCookieConsent
actually needs to use the new updateExperienceFromCookieConsentTcf
method.
I had some issues with jest / preact exporting it from fides-tcf.ts
, but decided to remove it as a) this is already covered by our e2e tests and b) updateExperienceFromCookieConsentTcf
exists in fides-tcf.ts
and is therefore not a candidate for a cookie.ts
unit test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
implemented @allisonking 's suggestion to we could also move that function to one of the tcf/lib files (or a new one) and then move that test to a different test file (not cookie.test.ts)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice... let's ship it.
if (fidesString) { | ||
try { | ||
// Make sure TC string is valid before we assign it | ||
const { tc: tcString } = decodeFidesString(fidesString); | ||
TCString.decode(tcString); | ||
const updatedCookie: Partial<FidesCookie> = { | ||
fides_string: fidesString, | ||
tcf_version_hash: | ||
overrides.consentPrefsOverrides?.version_hash ?? | ||
cookie.tcf_version_hash, | ||
}; | ||
Object.assign(cookie, updatedCookie); | ||
} catch (error) { | ||
debugLog( | ||
config.options.debug, | ||
`Could not decode tcString from ${fidesString}, it may be invalid. ${error}` | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this got... a lot simpler! That's actually a pretty good sign 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I agree! was a pleasant surprise 😄
debugLog( | ||
config.options.debug, | ||
"fides_string was missing from cookie, so it has been generated based on tcf_consent", | ||
cookie.fides_string | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally makes sense that this case is removed now. Nice.
Closes https://ethyca.atlassian.net/browse/PROD-1413
Description Of Changes
This PR refactors core TCF logic to rely on Fides str (in
cookie.fides_string
) for most TCF consent preferences instead of using ourtcf_consent
obj in the cookie. This reduces the size of ourtcf_consent
payload we send in every HTTP req between client <---> server which reduces risk for any slowdown due to cookie size.Code Changes
tcf_consent
, refactor usages to rely on the fides string instead.Steps to Confirm
Pre-Merge Checklist
CHANGELOG.md