fix: DH-21820: Sanitize pivot builder config, skip missing columns#1394
Open
vbabich wants to merge 7 commits into
Open
fix: DH-21820: Sanitize pivot builder config, skip missing columns#1394vbabich wants to merge 7 commits into
vbabich wants to merge 7 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Sanitizes stale pivot, rollup, and totals column references to prevent broken grids after schema changes.
Changes:
- Adds schema-aware sanitization and fallback behavior.
- Reports stale configurations through events and toast notifications.
- Marks stale sidebar entries and expands test coverage.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
usePivotBuilderMiddlewareCore.tsx |
Displays stale-column notifications. |
PivotConfigSection.tsx |
Identifies stale card entries. |
pivotConfig/rows/rowParts.tsx |
Adds stale label styling support. |
pivotConfig/rows/rowParts.test.tsx |
Tests stale labels. |
pivotConfig/rows/ColumnRow.tsx |
Propagates stale state. |
pivotConfig/rows/ColumnRow.test.tsx |
Tests stale column rows. |
pivotConfig/rows/aggregateRows.tsx |
Marks missing aggregate columns. |
pivotConfig/rows/aggregateRows.test.tsx |
Tests aggregate stale states. |
pivotBuilderModelApply.test.ts |
Tests sanitization, fallback, and notifications. |
pivotBuilderModel.ts |
Implements sanitization and stale reporting. |
PivotBuilder.scss |
Styles stale column names. |
findStaleColumnRefs.test.ts |
Tests stale-reference detection and sanitizers. |
CreatePivotPage.tsx |
Uses a null-prototype column map. |
buildPivotAggregationsMap.test.ts |
Tests sanitized pivot requests. |
DH-21820-pivot-builder-stale-column-notifications.md |
Documents the design and implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
plugins/pivot-builder/src/js/src/pivotBuilderModel.ts:1384
- Use the applied pivot state here rather than the raw intent. With UI re-derivation,
config.pivot/lastIntent.pivotcan be null whileeffective.pivothas setcurrent; a later UI state that derives totals or flat then skips this clear and leaves the old pivot model active. Checkingcurrentcorrectly reflects whether a pivot must be removed.
if (lastIntent.pivot != null) {
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.
Summary
Fixes DH-21820: a saved pivot/rollup config that references columns which no
longer exist rendered a broken, empty grid on restart (no error, no
notification). We now sanitize stale column references before they reach the
host/service, keep the raw config so the user can still see and fix them.
What changed
groupingColumnsandrollup.aggregationsbefore
rollupConfigis set (drop missing columns and operations invalidfor their column type). If all grouping columns are dropped, fall back to a
flat source instead of an empty rollup.
totals.operationMapbeforegetTotalsTable()(existence + operation/type validity). Diff thesanitized value against what was applied to avoid RPC churn/flicker.
rowKeys/columnKeys. When all keys are stale, revert to a flat table if noaggregations survive, or keep a flat summary if they do.
PIVOT_BUILDER_STALE_COLUMNSevent + stale references are logged (log.warn) and shown struck-through in the sidebar.listener can attach, so the middleware also reads a synchronous
staleColumnReportsnapshot off the proxy once the model is available.storedRollup/storedTotals/lastIntent) is always preserved;only the value sent to the host/service is sanitized.
Testing
findStaleColumnRefs.test.ts,pivotBuilderModelApply.test.ts(incl. the hydration/no-listener repro),
buildPivotAggregationsMap.test.ts.modes (drop a referenced column, restart) now sanitize + notify instead of
rendering broken.