Skip to content

Stop run_psa dropping the first parameter column #174

Description

@jurjoroa

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions