You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(core): Track column name identity mapping deterministically across CleanPlan stages #534
In src/freshdata/_core/stages.py, stage_column_names normalizes column names (e.g. " First Name " -> "first_name").
Subsequent stages (stage_missing, stage_outliers) produce ActionRecord instances keyed to the normalized column names.
If an external user, custom script, or autonomous agent constructs a CleanPlan where an action specifies the original column name (e.g. " First Name "), renames.get resolves it to "first_name".
However, if the action was generated by suggest_plan, a.column is already "first_name". renames.get("first_name", "first_name") resolves to "first_name".
If columns have overlapping or cyclic rename mappings, or if stages are executed selectively without column_names, column resolution becomes non-deterministic and can silently skip actions (if col not in out.columns: continue).
Proposed Solution
Explicitly store rename_map as a top-level field on CleanPlan (as already implemented in polars_engine.CleanPlan).
Provide a deterministic plan.resolve_column(col_name) helper method that maps either original or normalized names to the current active DataFrame column name.
Emit a warning or raise a descriptive KeyError instead of silently continuing when an action's target column cannot be resolved in out.columns.
Acceptance Criteria
Custom plans targeting both original and normalized column names execute reliably.
Actions targeting non-existent columns are not silently ignored without warning or reporting.
Backwards compatibility is preserved for existing CleanPlan instances.
👋 Want to work on this issue?
Comment /assign below to claim it! Check out the First Contribution Guide for setup instructions.
Activity