Add use_criteria() for customizable root-finding criteria#169
Draft
Add use_criteria() for customizable root-finding criteria#169
Conversation
…ng criteria - New use_criteria() function accepts character vector of criterion names or root_criterion objects to customize root-finding behavior - New default_criteria() returns the default criterion names - Support here.criteria option for pre-load configuration - Fix local_here() test helper to properly save/restore state - Add comprehensive tests for criteria customization - Update NEWS.md with new features Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix here v1.0.2 Quarto project detection issue
Add use_criteria() for customizable root-finding criteria
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v1.0.2 added
is_quarto_projectto default root-finding criteria, which breaks users with Quarto projects nested inside larger repos —here()finds the nested_quarto.ymlbefore the repo root.Changes
R/criteria.R— New exported functions:use_criteria()— set active criteria via character vector of names orroot_criterionobjectdefault_criteria()— returns default criterion names as character vectorresolve_criteria()/names_to_criterion()for name-to-object resolutionR/zzz.R—.onLoad()checks"here.criteria"option before falling back to defaultstests/testthat/helper-local.R— Fixlocal_here()bug: was capturing env reference (old_root <- .root_env) instead of root list (old_root <- .root_env$root), causing state leakage between test filestests/testthat/test-criteria.R— 15 tests including the nested Quarto scenarioUsage
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.