ThinkR-open / ThinkR-open/datadiff
[bug] Résolution YAML vs arguments fragile : label écrasé silencieusement, champ « keys » lu par partial matching
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 6
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Contexte
Deux défauts dans la résolution des règles au début de compare_datasets_from_yaml() :
labelignoré dès quepathest fourni :label <- rules$defaults$labelécrase inconditionnellement l'argument (R/compare_datasets_from_yaml.R:304). L'argumentlabeln'est honoré que sur la branche auto-YAML (path = NULL, via le template temporaire). Aucun avertissement.keysvskey:write_rules_template()écritdefaults$keys(l.73) — comme tous les YAML des tests et de la vignette — mais le code litrules$defaults$keyau singulier (l.309). Ça ne fonctionne que grâce au partial matching de$(vérifié sous R 4.3.3 :list(keys = "id")$key→"id", avec warning sousoptions(warnPartialMatchDollar = TRUE)). Casse le jour où on passe à[[, ou si un YAML contient à la foiskeyetkeys. Le Quick Start du README (appel sanskey=) repose entièrement sur ce partial matching.
Reprex
library(datadiff)
ref <- data.frame(id = 1:2, x = 1:2)
path <- tempfile(fileext = ".yaml")
write_rules_template(ref, key = "id", path = path)
# 1. label écrasé
res <- compare_datasets_from_yaml(ref, ref, key = "id", path = path,
label = "Mon label métier")
res$reponse$label # != "Mon label métier"
# 2. partial matching
options(warnPartialMatchDollar = TRUE)
rules <- read_rules(path)
rules$defaults$key
#> Warning: partial match of 'key' to 'keys'
Critères de succès
- Précédence documentée et implémentée : argument explicite > YAML > défaut (
label <- label %||% rules$defaults$label, idemkey). - Lecture explicite de
rules$defaults$keys(avec rétrocompatkeysi souhaité), plus aucun partial matching — la suite de tests passe avecoptions(warnPartialMatchDollar = TRUE)sans warning. - Une table « qui gagne ? » (argument vs YAML) dans la doc de
compare_datasets_from_yaml()et la vignette. - Tests : label explicite conservé avec
pathfourni ; YAML contenantkeyetkeyssimultanément → comportement défini.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in R/compare_datasets_from_yaml.R around lines 304–309, then inspect write_rules_template() and the existing tests and vignette. Run the test suite with warnPartialMatchDollar enabled; done means precedence is covered, keys is read explicitly without warnings, both key forms have defined behavior, and the documentation includes the argument-versus-YAML table.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, yaml
- Domain
- data, documentation, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100