Validate tabular CSV imports against required columns#4071
Conversation
Restore the pre-refactor tolerance on CSV imports: a file is accepted as long as every column it contains is an expected one, even when it omits some columns (unselected properties, fewer temporary limits or tap steps than the form declares). Enable CsvPicker's allowMissingColumns on the tabular, limit-sets and tap-changer rule imports. Signed-off-by: Florent MILLOT <75525996+flomillot@users.noreply.github.com>
|
Warning Review limit reached
Next review available in: 40 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Use the requiredColumns option of CsvPicker (dropping the header and allowMissingColumns props): required columns are derived from the form field metadata for tabular and limit-sets modifications, tap-changer rule columns are all optional, and EQUIPMENT_ID is now required for tabular modifications. Boolean cells are only flagged when the field is required. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Let TypeScript infer the requiredColumns memo return type instead of annotating it explicitly. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Florent MILLOT <florent.millot_externe@rte-france.com>
Context
Since #3996 (and gridsuite/commons-ui#1166), CSV imports validated the file header with a strict equality check: the file had to contain exactly the expected columns. This dropped the previous tolerance and caused regressions — e.g. a tabular CSV without the selected-properties columns, or a limit-sets modification CSV with fewer temporary limits than declared, were rejected (both were tolerated up to v2.36.2).
Change
Use the new
requiredColumnsoption ofCsvPicker(gridsuite/commons-ui#1217) so that only the columns flagged as required by the form must be present; optional columns may be omitted and unknown columns are ignored (order irrelevant):tabular-form.tsx) — required columns derived from the field metadata; selected-properties columns are optional;limit-sets-tabular-modification-form.tsx) — temporary-limit columns are optional;import-rule-dialog.tsx) — every column optional.EQUIPMENT_IDis now marked required for tabular modifications so the identifier column stays mandatory. Boolean cells are only flagged when the field is required.Dependency
Requires gridsuite/commons-ui#1217 (
requiredColumnsoption ofCsvPicker) to be merged and released first.