Repository navigation
fix(context): quoted allowed values, dotted names, explicit confidence phrases, strict protection after resolution - #369
Merged
Conversation
…e phrases, strict protection after schema resolution
- split_value_list no longer splits on "/" and keeps quoted values whole.
When a list has "," or ";", only those separate values; the last item may
still split once on a trailing "and"/"or", and a leading "and"/"or" is
dropped. Without commas, "and"/"or" still separate values ("dedupe by email
and phone"). "Trinidad and Tobago, Chile" and "N/A, OK" now compile to the
real values instead of fragments. The docstring and context docs say that
ambiguous values need quoting.
- The sentence splitter ends a sentence at "." only before whitespace or end
of line, so "file.name is unique." is no longer split into "file" and a
rule bound to the unrelated "name" column. Decimals are unaffected.
- parse_confidence accepts a number only after a confidence word
(confidence, certainty, probability, sure) or with "%"/"percent". Before,
any bare number counted ("3 neighbours" became 0.03, "age > 50" became
0.5). Those conditions are now unparsed and raise under strict.
- resolve_policy re-runs restatement and protection checks once it resolves
constraints from a schema-free policy, and merges new issues without
duplicates. fd.clean(policy=..., strict=True) now raises
protection_conflict like the schema-bound flows; non-strict mode records
the issue and demotes the repair.
Closes #301
Closes #302
Closes #303
Closes #304
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 |
FreshData benchmark report —
|
| fixture | n_rows | n_cols | p50 s | p95 s | peak MB | repair % | false-repair % | preserve % | trust | monotonic | export % |
|---|
Authored-code reduction (Metric 6)
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 four context-compiler parsing and compile bugs.
split_value_listkeeps quoted values whole and never splits on/. When,or;is present, only those separate values;and/orsplit only the last item (a, b or c). Without commas,and/orstill separate values (Deduplicate by email and phone).Trinidad and Tobago, ChileandN/A, OKnow compile correctly, andfd.validateno longer reports those values as violations. The docs say ambiguous values need quoting..only before whitespace or end of line, sofile.name is unique.binds tofile.nameinstead of splitting and attaching the rule toname. Decimals andU.S., U.K.,stay in one sentence.parse_confidenceaccepts a number only after a confidence word (confidence, certainty, probability, sure) or with%/percent.only if 3 neighbours agreeandwhen age > 50are now unparsed (and raise understrict) instead of becoming gates of 0.03 and 0.5.resolve_policyre-runs the restated-rule and protection-conflict checks after resolving a schema-free policy, merging new issues without duplicates.fd.clean(df, policy=schema_free_policy, strict=True)now raisesprotection_conflict, like thecolumns=andcontext=flows. Non-strict mode records the issue and demotes the repair.Behaviour notes:
/no longer splits dedup keys either; sentences with no space after a period are no longer split; unquoted abbreviations in value lists lose their final period (quote them to keep it).Tests
New
tests/context/test_compiler_parsing_fixes.py:;, brackets,CA, OR, WA, quotes, apostrophes);Verification
ruff check .: cleanmypy src/freshdata: no issues (202 files)Closes #301
Closes #302
Closes #303
Closes #304