Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add input validation to make_intervention()

Open Beginner friendly
#174 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
r
Domain
backend

Research direction

Find the definition of make_intervention() and read its existing sdlog validation alongside the suggested checks in the issue. Run the related tests for this function, then add checks for the listed inputs and verify that invalid values fail with clear errors while valid inputs still work.

Written by the indexing model from the issue text.

Description

Raised by @tbreweric in #142.

make_intervention() currently builds the intervention list without validating its inputs (only sdlog is checked). Many problems are probably caught by downstream functions, but basic checks here would fail earlier, with clearer errors, and reduce the work those functions have to do.

Suggested checks (from Tom):

stopifnot(
    is.character(name),
    length(name) == 1L,
    !is.na(name),
    nzchar(name),

    is.logical(delta_depends_on_baseline_ach),
    length(delta_depends_on_baseline_ach) == 1L,
    !is.na(delta_depends_on_baseline_ach),

    is.function(delta_function),
    is.list(delta_params),

    is.logical(variation),
    length(variation) == 1L,
    !is.na(variation),

    !variation || is.function(variation_function),
    is.list(variation_params),

    is.numeric(coverage),
    length(coverage) == 1L,
    !is.na(coverage),
    is.finite(coverage),
    coverage >= 0,
    coverage <= 1
)
Dominant language
R
Stars
8
Forks
4
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from petal-code/helios

All issues in petal-code/helios

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.