Skip to content

ENG-564 (3/4): Wire up SaaS dataset validation and protected field decorations#7685

Merged
Linker44 merged 171 commits into
mainfrom
ENG-564-node-editor-validations
Apr 30, 2026
Merged

ENG-564 (3/4): Wire up SaaS dataset validation and protected field decorations#7685
Linker44 merged 171 commits into
mainfrom
ENG-564-node-editor-validations

Conversation

@Linker44
Copy link
Copy Markdown
Contributor

Ticket ENG-564

Dependency: Requires #7667 (ENG-564-node-based-dataset-editor) and the backend validation PR to be merged first

Description Of Changes

Wire up the frontend to the backend's SaaS dataset validation. Protected fields and immutable metadata are visually decorated in both the node graph and the YAML editor panel. Saves use the connection-aware PATCH endpoint that enforces structural validation server-side (restoring protected fields/collections if modified). Backend warnings are surfaced to the user after save.

Code Changes

  • datastore-connection.slice.ts - Add patchConnectionDatasets mutation (PATCH) and getDatasetProtectedFields query endpoints
  • DatasetEditorSection.tsx - Fetch protected fields and pass to node editor, use PATCH for SaaS saves, show backend restoration warnings
  • DatasetNodeEditor.tsx - Compute protected YAML line ranges from protectedFields data, apply Monaco decorations (greyed out immutable/protected lines)
  • BulkPutDataset.ts - Add warnings field and DatasetFieldWarning type
  • types/api/index.ts - Export DatasetFieldWarning

How Validation Works

Rule Backend enforcement Frontend UX
Immutable top-level fields (fides_key, name, description) Silently restored on save Greyed out in YAML editor
Collections can't be added/removed Added stripped, removed restored Greyed out in YAML editor
Protected fields can't be deleted Restored on save "protected" badge, delete button hidden in node editor, greyed out in YAML
Non-protected fields can be added/removed Allowed Normal editing
Metadata edits on protected fields Allowed Normal editing

Steps to Confirm

  1. Navigate to a SaaS connection's test-datasets page
  2. Protected fields show "protected" badge and italic styling in node graph
  3. Protected fields cannot be deleted via the detail panel (no delete button)
  4. Open YAML editor → immutable lines and protected field lines are greyed out
  5. Try deleting a protected field in YAML, save → warning toast shown, field restored
  6. Edit a non-protected field → save works normally

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Linker44 added 15 commits March 13, 2026 12:15
Swap the Monaco YAML editor for an interactive React Flow graph where
each collection and field is a node. Clicking a node opens a drawer
to edit its metadata.

- Add DatasetNodeEditor with D3 hierarchy layout (LR tree)
- Add custom node components (root, collection, field) matching the
  taxonomy tree visual style with hover context
- Add DatasetTreeHoverContext for parent/child/inactive highlighting
- Add custom bezier edges that change color on hover
- Add DatasetNodeDetailPanel drawer for editing metadata
- Enable "Edit dataset" button for SaaS connectors
- Remove test results/logs sections for full-canvas layout
…diting to dataset node editor

- Add drill-down: overview shows root→collections, clicking a collection shows its fields
- Add breadcrumb navigation bar with back button when drilled into a collection
- Add/delete collections (via "+" on root node) and fields (via "+" on field nodes for nesting)
- Add AddNodeModal with uniqueness validation for naming new nodes
- Add DatasetEditorActionsContext to provide CRUD callbacks to node components
- Expand detail panel with collapsible fides_meta sections for both collections and fields
- Add delete button with confirmation dialog in detail panel
- Fix node overlap by constraining container width and increasing layout spacing
The node-based dataset editor should only be used for SaaS connections.
DB connectors retain the original Monaco YAML editor with reachability checks.
…down mode

- Add-field modal now includes description, data categories, and full
  fides_meta fields (matching the edit panel) so metadata can be set
  at creation time.
- Remove "+" button from dataset root node (overview mode).
- Show "+" on collection node only when it is the drill-down root.
DRY up duplicated code between AddNodeModal and DatasetNodeDetailPanel:
- FieldMetadataFormItems component for the 8 fides_meta form fields
- buildFieldMeta helper for converting form values to fides_meta
- DATA_TYPE_OPTIONS and REDACT_OPTIONS constants
Use useTaxonomies() to populate the data categories Select with
suggestions from the existing taxonomy, while still allowing free-form
tags input. Extracted as shared DataCategoryTagSelect component.
Only re-fit the viewport when the graph structure changes (node count
or focused collection), not when field metadata is edited.
When a collection or field is added, the new node gets a 1.5s yellow
highlight animation that fades out, making it easy to spot in the graph.
All 6 base types support the [] array suffix per parse_data_type_string
in the backend. Add all 12 variants to the dropdown.
- Replace centered Modal with right-side Drawer matching the edit panel
  style, with a "Create" button in the drawer header.
- Include array data type variants (e.g. string[], object[]) in the
  data type dropdown.
Adds a toggleable YAML code editor at the bottom of the node graph
with two-way sync: graph changes update the YAML and YAML edits
update the graph (debounced 500ms with error display).
- Hoist layout options to module constant to prevent useMemo busting
- Stabilize onMouseEnter with functional state update (removes dep)
- Precompute ancestor/descendant sets per hover instead of per-node
- Export ProtectedFieldsInfo from useDatasetGraph, remove duplicate
- Remove unused DatasetNodeData type export
- Remove no-op onMount from Monaco editor
- Add aria-label to add field/nested field buttons
- Show add buttons on focus-within (keyboard accessibility)
- Derive selectedNodeData from rawNodes via useMemo instead of storing
  a stale snapshot in state. Now always reflects the latest dataset.
- Debounce detail panel onValuesChange (300ms) to avoid triggering
  full dataset/graph recomputes on every keystroke.
- Guard against null/non-array fields and collections from incomplete
  YAML edits (e.g. bare "-" list items, partial typing).
…e editor forms

These advanced fields are better edited directly in YAML.
@Linker44 Linker44 requested a review from a team as a code owner March 18, 2026 14:31
@Linker44 Linker44 requested review from gilluminate and removed request for a team March 18, 2026 14:31
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 18, 2026

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

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Apr 30, 2026 4:16pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Apr 30, 2026 4:16pm

Request Review

Add backend validation for SaaS dataset editing that restores protected
fields instead of rejecting edits. This allows the UI to freely edit
datasets while the backend ensures structural integrity.

Changes:
- SaaS validation step restores immutable top-level fields (fides_key,
  name, description, organization_fides_key) with warnings
- Collections cannot be added/removed; violations are auto-corrected
- Protected fields (referenced by SaaS config) are restored if deleted
- New GET endpoint for protected fields metadata
- DatasetFieldWarning schema and warnings[] on BulkPutDataset response
- get_saas_config_referenced_field_paths utility for full dot-path refs
- Comprehensive unit tests for restore/warning behavior
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 18, 2026

Greptile Summary

This PR wires up the frontend to the backend's SaaS dataset validation by adding a patchConnectionDatasets PATCH mutation and a getDatasetProtectedFields query, then using them in DatasetEditorSection to save SaaS datasets through the validation-aware endpoint and surface backend restoration warnings to the user. DatasetNodeEditor gains Monaco editor decorations that visually grey out immutable top-level fields and protected collection fields.

Key changes:

  • datastore-connection.slice.ts: New patchConnectionDatasets mutation and getDatasetProtectedFields query correctly include invalidatesTags and providesTags respectively. The mutation's datasets parameter is typed as any[] instead of Dataset[], losing type safety.
  • DatasetEditorSection.tsx: SaaS save path correctly uses PATCH, handles failed/warnings responses, and refreshes local state from the server response. The success toast fires unconditionally even when succeeded is empty, and a single-character variable name (w) is used in the warnings loop.
  • DatasetNodeEditor.tsx: Protected-field YAML decorations are computed via a text-parsing heuristic in a useMemo and applied via deltaDecorations — which is deprecated since Monaco v0.33 (prefer createDecorationsCollection). A <style> tag is injected imperatively into document.head on editor mount without a corresponding cleanup on unmount.
  • BulkPutDataset.ts / types/api/index.ts: Clean addition of the DatasetFieldWarning type and its export.

Confidence Score: 3/5

  • Generally safe to merge once the type-safety fix and success-toast edge case are addressed; Monaco deprecation and DOM cleanup are polish items.
  • The core logic — PATCH endpoint wiring, protected-field query, warning surfacing, and decoration computation — is sound and well-structured. The any[] typing is a type-safety regression, and the unconditional success toast on an empty succeeded array is a subtle UX bug. The deprecated deltaDecorations call and un-cleaned <style> injection are lower-severity but worth fixing before merge.
  • DatasetEditorSection.tsx (success toast edge case) and DatasetNodeEditor.tsx (deprecated Monaco API + DOM side-effect) need the most attention.

Important Files Changed

Filename Overview
clients/admin-ui/src/features/datastore-connections/datastore-connection.slice.ts Adds patchConnectionDatasets mutation and getDatasetProtectedFields query. The mutation's datasets parameter is typed as any[] instead of Dataset[], reducing type safety.
clients/admin-ui/src/features/test-datasets/DatasetEditorSection.tsx Wires up SaaS-specific save path using PATCH and displays backend warnings. Contains two issues: single-character variable w, and a success toast that fires unconditionally even when the succeeded array is empty.
clients/admin-ui/src/features/test-datasets/DatasetNodeEditor.tsx Adds protected-field YAML decorations via Monaco. Uses the deprecated deltaDecorations API instead of createDecorationsCollection, and injects a <style> tag into document.head without cleanup on unmount.
clients/admin-ui/src/types/api/models/BulkPutDataset.ts Adds DatasetFieldWarning type and optional warnings field to BulkPutDataset. Clean, well-structured change.
clients/admin-ui/src/types/api/index.ts Exports the new DatasetFieldWarning type. Trivial, correct change.

Last reviewed commit: "Wire up protected fi..."

Comment thread clients/admin-ui/src/features/test-datasets/DatasetEditorSection.tsx Outdated
Comment thread clients/admin-ui/src/features/test-datasets/DatasetNodeEditor.tsx Outdated
Comment thread clients/admin-ui/src/features/test-datasets/DatasetNodeEditor.tsx
@Linker44 Linker44 force-pushed the ENG-564-node-based-dataset-editor branch from 8ae534e to c64b4b0 Compare April 17, 2026 03:27
lucanovera and others added 4 commits April 17, 2026 10:52
Resolved conflict: removed duplicate YAML toggle + standalone Editor
block that was superseded by the Splitter-based layout on the base branch.
Linker44 and others added 3 commits April 24, 2026 11:43
Use var(--fidesui-bg-corinth) canvas background and CSS variable
for dot color to match the taxonomy interactive tree appearance.
Linker44 and others added 5 commits April 27, 2026 12:44
Surface the backend's per-field warning messages (collection, field name,
action) in the toast notification instead of only showing aggregate counts.
Copy link
Copy Markdown
Contributor

@lucanovera lucanovera left a comment

Choose a reason for hiding this comment

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

Nice work! I've just updated two little things:

  1. Updated the span badges to use proper Tag components with a warning color from our palette
Image
  1. The warning errors in the message were hard to read and disappear quickly so I change that to use a Notification component instead.
Image

Linker44 and others added 5 commits April 30, 2026 11:21
The palette.module.scss file was removed in the ENG-3479 migration.
Update the import to use the TypeScript palette module instead.
The inferred type from Parameters<...>[0][number] resolves to unknown
in newer Monaco types. Use an explicit inline type instead.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Title Lines Statements Branches Functions
admin-ui Coverage: 8%
6.29% (2829/44948) 5.54% (1427/25718) 4.42% (588/13276)
fides-js Coverage: 78%
79.39% (2011/2533) 65.99% (1240/1879) 73.09% (345/472)
privacy-center Coverage: 88%
85.97% (331/385) 81.36% (179/220) 78.87% (56/71)

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.

3 participants