Skip to content

Switch to yaml12 for YAML 1.2 compliant parsing#32

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/use-yaml-1-2-parser
Draft

Switch to yaml12 for YAML 1.2 compliant parsing#32
Copilot wants to merge 2 commits into
mainfrom
copilot/use-yaml-1-2-parser

Conversation

Copy link
Copy Markdown

Copilot AI commented May 13, 2026

The yaml package only supports YAML 1.1, requiring a workaround to correctly handle values like yes/no/Y/N as strings rather than booleans. The yaml12 package from posit-dev provides a proper YAML 1.2 parser backed by a Rust crate.

Changes

  • DESCRIPTION: Replace yaml and purrr with yaml12 in Imports
  • R/read_params.R: Replace the read_safe_yaml workaround (custom handlers + purrr::modify_tree) with a direct call to yaml12::read_yaml
  • NAMESPACE: Update imports accordingly
  • tests/testthat/test-read_params.R: Remove library(yaml) dependency and the write/re-parse quote-stripping dance; test directly against YAML 1.2 semantics

Before — complex workaround to coerce YAML 1.1 output into 1.2 behavior:

read_safe_yaml <- function(params_file) {
  yaml::read_yaml(params_file,
    handlers = list(
      "bool#yes" = \(x) { attr(x, "yaml_bool") <- TRUE; x },
      "bool#no"  = \(x) { attr(x, "yaml_bool") <- FALSE; x }
    )
  ) |>
    purrr::modify_tree(leaf = \(x) { ... })
}

After — direct YAML 1.2 parsing:

read_safe_yaml <- function(params_file) {
  yaml12::read_yaml(params_file)
}

With yaml12, yes/no/Y/N are plain strings and only true/false are booleans — correct YAML 1.2 behavior with no workaround needed.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • posit-dev.github.io
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 13, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Use yaml 1.2 parser from posit Switch to yaml12 for YAML 1.2 compliant parsing May 13, 2026
Copilot AI requested a review from grst May 13, 2026 13:13
Copilot finished work on behalf of grst May 13, 2026 13:13
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.

Use yaml 1.2 parser

2 participants