Skip to content

ENG-1958: Add TCF version hash history table and model#8200

Merged
reneruck-ethyca merged 1 commit into
mainfrom
eng-1958-tcf-hash-history
May 19, 2026
Merged

ENG-1958: Add TCF version hash history table and model#8200
reneruck-ethyca merged 1 commit into
mainfrom
eng-1958-tcf-hash-history

Conversation

@reneruck-ethyca
Copy link
Copy Markdown
Contributor

Summary

  • Adds TCFVersionHashHistory SQLAlchemy model to track changes to TCF configuration hashes over time
  • Adds Alembic migration to create the tcf_version_hash_history table with columns for id, privacy_config_experience_id, previous_hash, current_hash, changed_at, and trigger_source

Test plan

  • Run migration: alembic upgrade head — verify tcf_version_hash_history table is created
  • Verify model relationships and FK to privacyexperience table
  • Run backend tests: pytest --no-cov tests/ targeting models/migrations

🤖 Generated with Claude Code

@reneruck-ethyca reneruck-ethyca requested a review from a team as a code owner May 15, 2026 14:10
@reneruck-ethyca reneruck-ethyca requested review from dsill-ethyca and removed request for a team May 15, 2026 14:10
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Preview May 19, 2026 4:38pm
fides-privacy-center Ignored Ignored May 19, 2026 4:38pm

Request Review

@reneruck-ethyca reneruck-ethyca force-pushed the eng-1958-tcf-hash-history branch 3 times, most recently from 7b1affb to d9be396 Compare May 15, 2026 15:38
@reneruck-ethyca reneruck-ethyca requested a review from erosselli May 15, 2026 16:21
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.65%. Comparing base (ea2505e) to head (e4d724b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8200      +/-   ##
==========================================
+ Coverage   85.63%   85.65%   +0.02%     
==========================================
  Files         661      662       +1     
  Lines       42942    42969      +27     
  Branches     5027     5027              
==========================================
+ Hits        36773    36805      +32     
+ Misses       5064     5060       -4     
+ Partials     1105     1104       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@reneruck-ethyca reneruck-ethyca enabled auto-merge May 15, 2026 16:31
@reneruck-ethyca reneruck-ethyca force-pushed the eng-1958-tcf-hash-history branch from fd2f7f5 to 1a9ad6d Compare May 18, 2026 08:47
Comment thread src/fides/api/models/tcf_version_hash_history.py Outdated
Comment on lines +22 to +23
previous_hash = Column(String, nullable=True)
current_hash = Column(String, nullable=False, index=True)
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.

How do these work for "global" events like Compass sync? what's the current hash if it's not nullable?

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.

global events like compass sync trigger a re-caching of experiences. The re-caching flow itself already checks if any parts of an experience changed (let me know if that's wrong) and as part of refreshing the cache will re-calculate the hash and track the change per experience config.

Comment thread src/fides/api/models/tcf_version_hash_history.py
@reneruck-ethyca reneruck-ethyca force-pushed the eng-1958-tcf-hash-history branch 4 times, most recently from 1667c19 to de0ac8f Compare May 19, 2026 15:40
Copy link
Copy Markdown
Contributor

@erosselli erosselli left a comment

Choose a reason for hiding this comment

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

ship it!

Adds the tcf_version_hash_history table (migration + ORM model) to record
hash transitions whenever the TCF experience content changes. Tracks
tcf_configuration_id (nullable FK to tcf_configuration, SET NULL on delete)
so per-config and global (Compass sync) history chains are isolated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

refactor: use privacy_config_experience_id in TCFVersionHashHistory

Replaces privacy_experience_id (FK to privacyexperience) with
privacy_config_experience_id (FK to privacyexperienceconfig). Tracking
at the config level is more meaningful — all experiences under a config
get the same TCF hash, so per-config rows avoid duplicates per region.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@reneruck-ethyca reneruck-ethyca force-pushed the eng-1958-tcf-hash-history branch from de0ac8f to e4d724b Compare May 19, 2026 16:38
@reneruck-ethyca reneruck-ethyca added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 6e161b4 May 19, 2026
67 of 69 checks passed
@reneruck-ethyca reneruck-ethyca deleted the eng-1958-tcf-hash-history branch May 19, 2026 17:06
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