fix: equal_mode normalized implique case_insensitive + trim sauf override#51
Merged
Merged
Conversation
…ride (issue #27) Le champ n'etait lu qu'a un endroit ou identical(eq_mode, "normalized") activait normalize_text(case_insensitive = FALSE, trim = FALSE) - l'identite. Un utilisateur ecrivant equal_mode: normalized seul n'obtenait rien, silencieusement, et test-utils verrouillait meme l'inertie. La vignette documentait pourtant deja « Apply both transformations » : le code s'aligne sur sa doc. - normalized implique les deux normalisations pour les colonnes character, un flag explicite (meme FALSE) gagne sur le mode - date/datetime/logical : *_equal_mode documentes acceptes-mais-inertes (la normalisation ne touche que character) - test verrouillant l'inertie retourne + reprex de l'issue en test
There was a problem hiding this comment.
Pull request overview
This PR fixes the long-standing inconsistency where equal_mode: normalized did not actually apply any normalization, aligning runtime behavior with the documented intent and preventing the YAML template generator from accidentally neutralizing the mode.
Changes:
- Make
equal_mode: normalizedimplycase_insensitive = TRUEandtrim = TRUEfor character columns unless explicitly overridden per rule. - Update
write_rules_template()to avoid co-writing defaultFALSEflags alongsideequal_mode: normalized(while preserving explicitly supplied flags). - Add/adjust tests plus update documentation (roxygen/Rd) and NEWS to reflect the corrected semantics and behavioral impact.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testthat/test-utils.R | Updates/extends tests to lock in the new implied-default behavior, overrides, issue reprex, and template non-neutralization. |
| R/preprocessing.R | Implements tri-state behavior: normalized implies defaults unless flags are explicitly set, with normalization driven by resolved flags. |
| R/compare_datasets_from_yaml.R | Updates parameter docs and adjusts write_rules_template() to omit default FALSE flags when equal_mode = "normalized" unless explicitly supplied. |
| NEWS.md | Documents the behavior change, rationale, and potential FAIL→PASS flips for hand-written YAML using normalized alone. |
| man/write_rules_template.Rd | Keeps generated user-facing documentation consistent with the updated equal_mode semantics and caveats for non-character types. |
Files not reviewed (1)
- man/write_rules_template.Rd: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Jul 3, 2026
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.
Closes #27
Probleme
equal_moden'etait lu qu'a un seul endroit, ounormalizedactivaitnormalize_text(case_insensitive = FALSE, trim = FALSE)- l'identite. Un utilisateur ecrivantequal_mode: normalizedseul n'obtenait rien, silencieusement, et test-utils verrouillait meme l'inertie. La vignette documentait pourtant depuis toujours « Apply both transformations ».Decision (option A de l'issue) : le code s'aligne sur sa propre doc
normalizedimpliquecase_insensitive = TRUEettrim = TRUEpour les colonnes character, un flag explicite (meme FALSE) gagne sur le mode (tri-etat : absent -> suit le mode)write_rules_template()cesse de co-ecrire les flags FALSE par defaut a cote d'un modenormalized(ils neutralisaient l'implication - releve par la review interne, le parametre etait un piege inerte) ; un flag explicitement fourni est conserve*_equal_modedocumentes acceptes-mais-inertes (la normalisation ne touche que character)normalizedseul peuvent basculer FAIL -> PASS (la normalisation ne fait que fusionner des valeurs)Tests (TDD red-first)
Test d'inertie retourne + overrides par flag + reprex de l'issue bout-en-bout + template normalized non auto-neutralise (rouges constates).
Suite complete : 1023 PASS / 0 FAIL sur la pile. Check --as-cran : 0 erreur / 0 warning.
Review interne
pr-reviewer : APPROVE, finding important applique (le template auto-neutralisant).