ThinkR-open / ThinkR-open/datadiff
[bug] Retour anticipé « clé introuvable » : structure de résultat incomplète (6 champs au lieu de 8) qui casse les consommateurs aval
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 6
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Contexte
Quand la clé est absente d'un des deux datasets, compare_datasets_from_yaml() fait message("could not find key in both data") puis retourne une liste à 6 champs (all_passed = FALSE, agent/reponse/... = NULL) — sans coverage ni summary (R/compare_datasets_from_yaml.R:405-418), alors que le retour nominal et la vignette en promettent 8.
Conséquences :
res$summary$n_fail→NULLsilencieux dans le code aval ;datadiff_report_html(res)→ erreur (reponseNULL) ;pointblank::all_passed(res$reponse)→ erreur.
Au passage, la condition utilise | scalaire au lieu de || (l.406), et le message ne nomme ni la clé ni le dataset fautif.
Reprex
library(datadiff)
ref <- data.frame(id = 1:2, x = 1:2)
cand <- data.frame(idx = 1:2, x = 1:2) # pas de colonne id
res <- compare_datasets_from_yaml(ref, cand, key = "id")
#> could not find key in both data
names(res) # 6 champs au lieu de 8
res$summary # NULL
datadiff_report_html(res) # Error
Critères de succès
- Comportement décidé et documenté : soit
stop()explicite (« key 'id' not found in data_candidate »), soit structure complète à 8 champs avec un check structurel FAIL danscoverage. - Le message/l'erreur nomme la ou les colonnes clés manquantes et le dataset concerné.
-
||au lieu de|(l.406). -
@returnde la roxygen exact dans tous les cas de sortie. - Tests : shape du retour + comportement de
datadiff_report_html()sur ce cas.
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
Read R/compare_datasets_from_yaml.R around lines 405-418 and reproduce the missing-key case with the supplied reprex. Trace the return contract and datadiff_report_html() before choosing the documented behavior. Done means the selected behavior names the missing key and dataset, uses the corrected condition, preserves the documented return shape, and has tests for the result shape and report handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100