Skip to content

fix(engine): reject malformed Remove Duplicates columns - #4286

Open
MMexicann wants to merge 3 commits into
storytold:mainfrom
MMexicann:patch-30
Open

MMexicann wants to merge 3 commits into
storytold:mainfrom
MMexicann:patch-30

Conversation

@MMexicann

@MMexicann MMexicann commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

data.removeDuplicates silently discarded malformed entries from columns. With equal values in B and distinct values in C, columns: ["B", "???"] compared only B and deleted a distinct row. Parse every supplied array entry before editing and return the existing column error if any entry is invalid. Named columns, numeric offsets and the omitted default keep their current behavior.

Validation

Added regressions for mixed malformed entries, unchanged workbook/selection/undo/redo/dirty state after refusal, and valid named or relative columns. Checked current main and competing Remove Duplicates changes, including the earlier empty-column guard in #1308, and reviewed the complete two-file diff.

Neither cargo nor rustc is available in this environment. The regressions and cargo xtask ci were not run locally. Hosted CI passed on e42dbfc4f04d5b8ebdbff7a911b38c88255b67e1: four successful checks and two skipped coverage jobs. CodeRabbit reported no actionable comments.

Summary by CodeRabbit

  • Bug Fixes
    • Duplicate removal now reports an error when a specified column is invalid, rather than silently ignoring it. Invalid column selections leave the workbook, selection, undo/redo history, and dirty state unchanged.
    • Empty column lists and columns outside the compared range are rejected.
    • When columns are specified, duplicate rows are compared using all selected columns. Named, absolute named, and zero-based relative columns are accepted. If no columns are specified, all columns in the selected range are compared.

Parse every requested comparison column before editing the workbook so malformed entries cannot silently narrow the duplicate key and discard distinct rows.
Cover mixed valid and malformed columns without workbook, selection, undo, redo or dirty-state changes. Preserve named columns, relative numeric offsets and the omitted default.
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

remove_duplicates now returns an error if any supplied columns entry cannot be parsed. Tests cover invalid and valid selectors, omitted columns, and unchanged workbook state after invalid input.

Changes: Duplicate removal

Layer / File(s) Summary
Column selector validation
crates/engine/src/cmd/data/tools.rs, crates/engine/src/cmd/data/tests.rs
remove_duplicates rejects unparseable columns entries and retains full-range comparison when columns is absent. Tests cover selector formats, duplicate removal results, and unchanged workbook state on invalid input.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: aiongg, dylanmtaylor

Merge Risk: Minimal · up to e42db

data.removeDuplicates now refuses malformed columns entries instead of silently ignoring them. Valid selectors and the default behavior are unchanged. No actionable merge-blocking risk was found; hosted CI should confirm the new tests pass.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the engine now rejects malformed columns in Remove Duplicates instead of silently skipping them. The title matches the raw summary of tools.rs (rejects unparseable col…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the main change: the engine now rejects malformed columns in Remove Duplicates instead of silently skipping them. The title matches the raw summary of tools.rs (rejects unparseable column entries) and the tests added in tests.rs. It is short, uses the conventional fix(engine) prefix, and needs no further detail.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3e47fec and e42dbfc.

Files selected for processing: 1

  • crates/engine/src/cmd/data/tools.rs
Files skipped from review as they are similar to previous changes: 1

  • crates/engine/src/cmd/data/tools.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Apply the exact formatting correction reported by cargo fmt in the hosted CI gate.
emrahoksak pushed a commit to emrahoksak/girdcraft- that referenced this pull request Nov 18, 2026

This branch has not been deployed

No deployments
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.

1 participant