Skip to content

Apply overrides during initialization#6157

Merged
gilluminate merged 4 commits intomainfrom
gill/ENG-459/fix-fides-consent-initialization
May 21, 2025
Merged

Apply overrides during initialization#6157
gilluminate merged 4 commits intomainfrom
gill/ENG-459/fix-fides-consent-initialization

Conversation

@gilluminate
Copy link
Copy Markdown
Contributor

@gilluminate gilluminate commented May 19, 2025

Closes ENG-459

Description Of Changes

Fixes issue where Fides.consent wasn't respecting fidesConsentFlagType and fidesConsentNonApplicableFlagMode overrides until after a consent choice. This update ensures that value applies those overrides during initialization as well.

Code Changes

  • Pass the Fides.cookie.consent value through the applyOverridesToConsent method before using it to initialize the Fides.consent value.

Steps to Confirm

  1. Add 6sense to system, which will give a handful of notices. Only enable 1 or 2 of the notices and add them to the US Modal Experience and enable it.
  2. Visit the Privacy Center demo page with both overrides in their non-default state (eg. http://localhost:3001/fides-js-demo.html?geolocation=US-CA&fides_consent_non_applicable_flag_mode=include&fides_consent_flag_type=consent_mechanism)
  3. DO NOT open the modal or make any consent choices.
  4. In the console, type Fides.consent and press enter to get the initialized value of the window.Fides.consent object. (NOTE: this will be reflected on the demo page under Consent JSON section as well).
  5. Validate that the overrides have been applied to the initial value. You should see something like { marketing: "not_applicable", analytics: "not_applicable", ... } depending which notices were left disabled in step 1.

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fides-privacy-center ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 21, 2025 3:11pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview May 21, 2025 3:11pm

fides.experience?.non_applicable_privacy_notices,
fides.experience?.privacy_notices,
options.fidesConsentFlagType ?? undefined,
options.fidesConsentNonApplicableFlagMode ?? undefined,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a test for ensuring the GTM related flags get initialized correctly? We can probably just add an assertion to existing tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Those are no longer just for GTM, and the related tests are in the applyOverridesToConsent section of clients/fides-js/__tests__/lib/consent-utils.test.ts. Is there more you think needs to be done there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh, sorry, I think I see what you mean... On the Cypress tests I've added some assertions for checking the window.option values.

@gilluminate gilluminate force-pushed the gill/ENG-459/fix-fides-consent-initialization branch from b1ca3a5 to c542cfe Compare May 21, 2025 15:10
@gilluminate gilluminate merged commit 78f628b into main May 21, 2025
17 checks passed
@gilluminate gilluminate deleted the gill/ENG-459/fix-fides-consent-initialization branch May 21, 2025 15:20
@cypress
Copy link
Copy Markdown

cypress Bot commented May 21, 2025

fides    Run #12936

Run Properties:  status check passed Passed #12936  •  git commit 78f628bc9f: Apply overrides during initialization (#6157)
Project fides
Branch Review main
Run status status check passed Passed #12936
Run duration 00m 49s
Commit git commit 78f628bc9f: Apply overrides during initialization (#6157)
Committer Jason Gill
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 5
View all changes introduced in this branch ↗︎

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