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

未关闭
#210 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@feralaes 已经在做这个了。

开始于 2026年11月13日。

  • #238 来自 @feralaes —— 未关闭

评估

难度
3/5
预计耗时
3-5 天
新手友好度
15/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
r

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
R
星标
43
派生
14
平均合并
4 小时 44 分钟
30 天内合并 PR
15

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DARTH-git/dampack 的其他 Issue

查看 DARTH-git/dampack 的全部 Issue

相似的 Issue

更多 R Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。