ENG-3386: schema for regulatory reporting templates#7999
Draft
ENG-3386: schema for regulatory reporting templates#7999
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
9 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7999 +/- ##
==========================================
+ Coverage 84.95% 84.97% +0.01%
==========================================
Files 631 631
Lines 41185 41245 +60
Branches 4781 4787 +6
==========================================
+ Hits 34989 35047 +58
- Misses 5110 5113 +3
+ Partials 1086 1085 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1e20083 to
3f4eb00
Compare
Adds the columns and association table needed for the location-gated
regulatory reporting templates feature in fidesplus:
- CustomFieldDefinition.system_managed — boolean marker for field
definitions owned by a platform flow (e.g. the reporting-templates
reconciler). User-created fields default to False.
- CustomReport.system_template_key — stable template identifier
("ico", "dpc", "cnil") populated by the reconciler.
- CustomReport.location_code — fides location that gates the template
("gb", "ie", "fr"). Both columns are NULL for user-created reports.
- plus_reporting_template_custom_field — M:N association linking
system-managed CustomReports to the CustomFieldDefinitions they
reference. Cascades on delete so tearing down a template cleans up
association rows.
Revises d71c7d274c04 (the true head on main — the correspondence
migrations chain extends through 4738e3e3e850 up to d71c7d274c04).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3f4eb00 to
26aaefc
Compare
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-3386
Description Of Changes
Schema-only PR that adds the columns and association table needed to support the location-gated regulatory reporting templates feature implemented in fidesplus#3407. The business logic (reconciler, location-change hook, route guards) lives in fidesplus; this PR only extends the shared data model.
Code Changes
Model (
src/fides/api/models/)sql_models.py:CustomFieldDefinition— addssystem_managed: bool(NOT NULL, defaultFalse). Marks field definitions whose lifecycle is controlled by a platform flow (the fidesplus reporting-templates reconciler). User-created fields default toFalseand are untouched by that flow.custom_report.py:CustomReport— addssystem_template_key: Optional[str]andlocation_code: Optional[str], both indexed, both NULL for user-created reports. The reconciler populates them for the system-owned ICO/DPC/CNIL templates.custom_report.py:reporting_template_custom_field— new M:N association table betweenCustomReportandCustomFieldDefinition, cascade-delete on both sides. Exposed on the ORM viaCustomReport.custom_field_definitions. Used by the reconciler to track "which gap fields does this template reference" and to drive the orphan-deactivation pass when a location is deselected.Migration
xx_2026_04_22_1600_c8e9d3f7a2b4_reporting_templates_schema.py— revisesd71c7d274c04(current head on main). Adds the three columns, the two indexes, and the association table.downgrade()is a clean reverse.Tests
tests/ctl/core/test_custom_field_models.py— two tests:system_manageddefaults toFalse,system_managedis settable toTruevia the creation API. The broader semantics (lifecycle, reconciliation) are covered in fidesplus.Steps to Confirm
Run the unit tests:
Expected: existing tests + two new
system_managedtests pass.Apply migrations against a fresh DB and confirm schema:
Expected:
system_managed boolean NOT NULL DEFAULT false, both new CustomReport columns (nullable, indexed), association table with composite PK + CASCADE FKs.Confirm
alembic headsreturns a single head after upgrade:Expected:
c8e9d3f7a2b4 (head).Pre-Merge Checklist
CHANGELOG.md— changelog fragment added atchangelog/system-managed-custom-field-definition.yaml🤖 Generated with Claude Code