Read automated consent sources synchronously before FidesInitialized fires#7222
Merged
gilluminate merged 20 commits intomainfrom Jan 27, 2026
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
01d35fb to
11cb907
Compare
…d saveAutomatedPreferencesToApi
Minimal TCF experience combines consent and legitimate interest purposes in tcf_purpose_names. Full experience separates them into tcf_purpose_consents and tcf_purpose_legitimate_interests. Code only used consent array from full experience, causing banner to show different counts depending on load timing.
11cb907 to
06440ce
Compare
Contributor
Greptile SummaryThis PR successfully refactors the automated consent flow to read all sources (GPC, migrated consent, notice consent strings) synchronously before the Key improvements:
Priority handling is correct:
The implementation maintains separation of concerns, follows existing patterns, and includes good test coverage. Confidence Score: 5/5
Important Files Changed
|
speaker-ender
approved these changes
Jan 27, 2026
Contributor
speaker-ender
left a comment
There was a problem hiding this comment.
Tested locally and looks good!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket ENG-2135
Description Of Changes
Read all automated consent sources (GPC, migrated consent from third-party providers, and notice consent strings) synchronously during initialization before the
FidesInitializedevent fires. This ensures that when Fides broadcasts that consent is ready to be read, all automated consent has been fully evaluated and applied.Key changes:
getAutomatedConsentContext()to read all automated consent sources synchronously at the start of initializationcalculateAutomatedConsent()as a pure function that computes consent from the automated contextFidesInitializedfiresCode Changes
consent-context.tsgetAutomatedConsentContext()to gather GPC, migrated consent, and notice consent strings earlycalculateAutomatedConsent) and API persistence (saveAutomatedPreferencesToApi) inautomated-consent.tsinitialize.tsto calculate and apply automated consent before updating cookie/experience and firing eventsbuildConsentPreferencesArray()utility inshared-consent-utils.tsto reduce duplicationfides.ts,fides-headless.ts,fides-tcf.ts) to use the new automated consent flowFidesInitializedfiresSteps to Confirm
Create an experience with the following Notices:
By default, when loading the demo page, the Consent JSON should look like:
Test GPC Automated Consent (Chrome/Non-GPC browsers)
?globalPrivacyControl=truequery parameter)window.Fides.consentcontains the GPC opt-out values (false) as soon asFidesInitializedfiresPATCHto/privacy-preferencewithmethod: "gpc"preference: "opt_out"for GPC-flagged noticesmethod: "accept"for the manual interactionTest Notice Consent String (fidesString)
fides_stringcookie with notice consent encoded (e.g.,",,,eyJhbmFseXRpY3MiOjEsImRhdGFfc2FsZXNfYW5kX3NoYXJpbmciOjEsIm1hcmtldGluZyI6MX0=")window.Fides.consentand the browser cookie contain the decoded consent valuesPATCHto/privacy-preferencewithmethod: "script"Test Migrated Consent (OneTrust → Fides)
otFidesMappingto map OneTrust groups to Fides noticeswindow.Fides.consentcontains the migrated OneTrust valuesfalse(eg. essential)PATCHwith the migrated consent method (e.g.,"onetrust")Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works