Skip to content

Conversation

@be-marc
Copy link
Member

@be-marc be-marc commented Nov 20, 2025

param_set = ps(
  x1 = p_fct(levels = c("a", "b", "c")),
  x2 = p_dbl(lower = 0, upper = 1),
  x3 = p_int(lower = 0, upper = 1, depends = x1 %in% c("a", "b"))
)

param_set$check(list(x1 = "a", x2 = 1, x3 = 0), allow_subset = FALSE) # TRUE
param_set$check(list(x1 = "c", x2 = 1), allow_subset = FALSE) # TRUE
param_set$check(list(x1 = "b", x2 = 1), allow_subset = FALSE) # FALSE

Checks for missing parameters. Parameters are only allowed to be missing if their dependencies are unsatisfied.

@be-marc be-marc requested a review from Copilot November 20, 2025 12:31
Copilot finished reviewing on behalf of be-marc November 20, 2025 12:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new allow_subset parameter to the ParamSet validation methods (check, test, assert, check_dt, test_dt, assert_dt) that enables checking whether all parameters are present in a configuration. When allow_subset = FALSE, all parameters must be present except for dependent parameters whose dependencies are not satisfied. This provides stricter validation for complete parameter configurations.

Key Changes:

  • Added allow_subset parameter (default TRUE for backward compatibility) to all validation methods
  • Implemented logic to verify all parameters are present when allow_subset = FALSE, with proper handling of dependencies
  • Added comprehensive test coverage for single and multi-parent dependency scenarios

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
R/ParamSet.R Implements allow_subset parameter logic in check(), test(), assert(), check_dt(), test_dt(), and assert_dt() methods with dependency satisfaction checking
tests/testthat/test_ParamSet.R Adds comprehensive test cases covering missing parameters, parent parameters, and dependent parameters with satisfied/unsatisfied dependencies
man/ParamSet.Rd Updates documentation for all modified methods to describe the new allow_subset parameter
NEWS.md Documents the new feature in the changelog
DESCRIPTION Updates RoxygenNote version and removes trailing whitespace
.lintr Updates linter configuration (unrelated housekeeping)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants