Goal
run_psa calls make_psa_obj(parameters = psa_samp[, -1]) unconditionally, so a hand-built psa_samp silently loses its first real parameter from $parameters and $parnames even though that parameter still drives FUN and the computed outcomes. Separately, the FUN-validity guard in the same file is dead code — is.na(sum(is.na(x))) is always FALSE, so the intended friendly error never fires.
Scope
- At
R/run_psa.R:121, drop the leading column only when it is the nsamp index column that gen_psa_samp() prepends
- At
R/run_psa.R:47, replace the inert guard with a tryCatch success flag so FUN is not well defined is actually raised
- Add regression tests in
tests/testthat/test_run_psa.R for a hand-built psa_samp and for a misdefined FUN
- Re-verify the audit repro on-branch before applying the proposed diff — this fix was reasoned from root cause, not re-run to green
Version: #172
Goal
run_psacallsmake_psa_obj(parameters = psa_samp[, -1])unconditionally, so a hand-builtpsa_sampsilently loses its first real parameter from$parametersand$parnameseven though that parameter still drivesFUNand the computed outcomes. Separately, theFUN-validity guard in the same file is dead code —is.na(sum(is.na(x)))is alwaysFALSE, so the intended friendly error never fires.Scope
R/run_psa.R:121, drop the leading column only when it is thensampindex column thatgen_psa_samp()prependsR/run_psa.R:47, replace the inert guard with atryCatchsuccess flag soFUN is not well definedis actually raisedtests/testthat/test_run_psa.Rfor a hand-builtpsa_sampand for a misdefinedFUNVersion: #172