test(idempotency): cleaning twice must be a fixed point in every mode - #479
Merged
Merged
Conversation
Idempotency was asserted for the balanced strategy only. tests/expectations.py
drives {"balanced": {"idempotent": true}} for the fixtures and
test_properties.py:17 covers defaults; nothing checked conservative or
aggressive, any semantic_mode, a compiled context policy, lossy text options,
imputation, outlier clipping, the native engines, or memory replay -- even
though test_compare_matrix.py exercises all three strategies.
It matters because the second pass sees its own output. A repair that is not a
fixed point drifts on every rerun: case folding that re-triggers, a sentinel
that re-matches what the first pass wrote, a dominant-variant vote that flips
once the variants have changed, fences that keep pulling inward on each clip.
A pipeline that cleans on ingest and again on export would keep moving the data.
Fifteen cases: defaults; each of the three strategies; each of the three
semantic modes; a context policy; string_case="lower"; impute="mean";
outliers="clip" against a frame carrying a real outlier; each of pandas, polars
and duckdb; and memory replay.
The engine cases use a uniformly-typed frame on purpose. A mixed-type object
column makes polars and duckdb disclose a fallback to pandas, so the obvious
frame would have quietly tested pandas three times. The test asserts
report.backend == engine and an empty fallback_events, so if that ever changes
the test fails instead of silently testing the wrong thing.
All fifteen already hold, so these are regression guards. No library code
changed.
Full suite 6692 passed / 0 failed, coverage 93.92%; ruff clean repo-wide.
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 |
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.
Why
Idempotency was asserted for the
balancedstrategy only.tests/expectations.pydrives{"balanced": {"idempotent": true}}for the fixtures andtest_properties.py:17covers defaults. Nothing checkedconservativeoraggressive, anysemantic_mode, a compiled context policy, lossy text options, imputation, outlier clipping, the native engines, or memory replay — even thoughtest_compare_matrix.pyexercises all three strategies.It matters because the second pass sees its own output. A repair that is not a fixed point drifts on every rerun:
A pipeline that cleans on ingest and again on export would keep moving the data.
Coverage
15 cases: defaults; each of the three strategies; each of the three semantic modes; a context policy;
string_case="lower";impute="mean";outliers="clip"against a frame carrying a real outlier; each of pandas/polars/duckdb; and memory replay.One deliberate detail
The engine cases use a uniformly-typed frame. A mixed-type object column makes polars and duckdb disclose a fallback to pandas, so the obvious frame would have quietly tested pandas three times.
The test asserts
report.backend == engineand an emptyfallback_events, so if that ever changes it fails instead of silently testing the wrong thing.Verification
main, so these are regression guards rather than bug reports.ruff check .clean repo-wide.