Input-validation and edge-case bugs found in the v1.1.0 audit

Abierto
#210 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@feralaes ya está trabajando en esto.

Desde el 13/11/2026.

  • #238 de @feralaes — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
3-5 días
Aptitud para principiantes
15/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
r

Línea de trabajo

This is a bundle of seven separate bugs, and pull request #238 is already open against it, so the work is claimed. Start from R/twsa.R:34 and R/create_sa.R:76-100, which show the outcome matching and the strategy-name checks. Each item needs a failing regression test before its fix. Done means every item has a test and NEWS has matching Bug fixes bullets.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

Suggested owner: Jorge Roa · Plan: Phase 2b

Goal

Several functions give cryptic errors, or silently wrong results, on valid or near-valid input. Fix each item with a regression test.

Scope

  • twsa() on a dsa_twoway object fails with the default outcome. Code-verified.
    • R/twsa.R:34 calls match.arg(outcome) only in the psa branch.
    • The dsa_twoway branch passes the 6-element default straight to calculate_outcome() (R/twsa.R:57).
    • calculate_outcome() matches against a different 8-element choice vector (R/calculate_outcome.R:9-10), so the call errors with "'arg' must be of length 1".
    • Fix: move outcome <- match.arg(outcome) above the branch.
  • make_psa_obj() with the wrong number of strategy names gives "missing value where TRUE/FALSE needed". Reproduced.
    • The comparison loop at R/create_sa.R:76 runs before the length check at R/create_sa.R:88.
    • Move the check first. Shared with #208.
  • other_outcome columns are never renamed to the strategy names. Reproduced: names stay Chemo_Cost Radio_Cost Surg_Cost.
    • R/create_sa.R:94-100 renames cost and effectiveness only.
  • plot.evsi() condition has a misplaced parenthesis. Code-verified.
    • R/evsi.R:324: length(unique(x$WTP > 1)) should be length(unique(x$WTP)) > 1.
  • Dead FUN validity guard in the DSA runners. Code-verified.
    • R/run_dsa.R:77 and R/run_dsa.R:247 use is.na(sum(is.na(jj))), which is always FALSE. This is the same pattern as R/run_psa.R:47 in #174; fix it the same way.
  • plot.exp_loss(col = "bw") ignores lsize. Code-verified.
    • The bw branch at R/exp_loss.R:170-171 calls geom_line(aes(linetype = ...)) without linewidth = lsize.
    • col_aes = c("color", "line") at R/exp_loss.R:175 includes "line", which add_common_aes() does not handle.
  • max.col() random tie-breaking also affects calc_exp_loss(). Code-verified.
    • R/exp_loss.R:60: max.col(-exp_loss) uses the default ties.method = "random".
    • Fix it together with #167 (R/ceac.R:85), using ties.method = "first". See the proposed comment on #167 below.

Acceptance

Each item has a test that fails before the fix. NEWS gets "Bug fixes" bullets.

Lenguaje dominante
R
Estrellas
43
Forks
14
Merge medio
4 h 44 min
PR fusionados (30 d)
15

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DARTH-git/dampack

Todos los issues de DARTH-git/dampack

Issues similares

Más issues de R

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.