Copilot commented on code in PR #50499: URL: https://github.com/apache/arrow/pull/50499#discussion_r3803918830
########## r/tools/contributor_stats.R: ########## @@ -0,0 +1,127 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Contributor statistics for release announcements. +# +# The `print_new_contributors()` helper below is copied from Bryce Mecum's gist: +# https://gist.github.com/amoeba/4e26c064d1a0d0227cd8c2260cf0072a +# +# Usage: launch R from the root of the arrow git repo, then: +# +# source("r/tools/contributor_stats.R") +# release_contributor_stats("apache-arrow-20.0.0", "apache-arrow-21.0.0") +# +# or, for just the list of first-time contributors to a subdirectory: +# +# print_new_contributors("apache-arrow-20.0.0", "apache-arrow-21.0.0", "r") + +#' new_contributors.R +#' +#' Produce a list of names of new contributors between two git refs. The method +#' this uses is to first get the list of unique contrbutors referancable from +#' the first ref, then the second ref, and then compute the set difference and +#' return that. +#' +#' Usage +#' +#' Launch an R session from the directory containing the git repo you want to +#' query against. +#' +#' Run this to get a list of new contributors between the refs +#' "apache-arrow-13.0.0" and "apache-arrow-14.0.0" for commits that touched +#' the "r" subdirectory": +# +#' print_new_contributors( +#' "apache-arrow-13.0.0", +#' "apache-arrow-14.0.0", +#' "r" +#' ) +#' +#' Note that the third argument, subdirectory, is optional. If omitted, it +#' will use the root directory. + +stopunlesscommand <- function(command, arguments) { + out <- tryCatch( + { + system2("git", arguments, stdout = TRUE) + }, + warning = function(w) { + stop(w) + }, + error = function(e) { + stop(e) + } + ) + + TRUE +} Review Comment: stopunlesscommand() ignores the `command` parameter and always returns TRUE without checking the git process exit status. This means stopfinotinrepo()/stopifnotref() won’t actually fail when git errors, making the validation ineffective. ########## r/tools/contributor_stats.R: ########## @@ -0,0 +1,127 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Contributor statistics for release announcements. +# +# The `print_new_contributors()` helper below is copied from Bryce Mecum's gist: +# https://gist.github.com/amoeba/4e26c064d1a0d0227cd8c2260cf0072a +# +# Usage: launch R from the root of the arrow git repo, then: +# +# source("r/tools/contributor_stats.R") +# release_contributor_stats("apache-arrow-20.0.0", "apache-arrow-21.0.0") +# +# or, for just the list of first-time contributors to a subdirectory: +# +# print_new_contributors("apache-arrow-20.0.0", "apache-arrow-21.0.0", "r") + +#' new_contributors.R +#' +#' Produce a list of names of new contributors between two git refs. The method +#' this uses is to first get the list of unique contrbutors referancable from +#' the first ref, then the second ref, and then compute the set difference and +#' return that. +#' +#' Usage +#' +#' Launch an R session from the directory containing the git repo you want to +#' query against. +#' +#' Run this to get a list of new contributors between the refs +#' "apache-arrow-13.0.0" and "apache-arrow-14.0.0" for commits that touched +#' the "r" subdirectory": +# +#' print_new_contributors( +#' "apache-arrow-13.0.0", +#' "apache-arrow-14.0.0", +#' "r" +#' ) +#' +#' Note that the third argument, subdirectory, is optional. If omitted, it +#' will use the root directory. + +stopunlesscommand <- function(command, arguments) { + out <- tryCatch( + { + system2("git", arguments, stdout = TRUE) + }, + warning = function(w) { + stop(w) + }, + error = function(e) { + stop(e) + } + ) + + TRUE +} + +stopfinotinrepo <- function() { + stopunlesscommand("git", "reflog main") +} + +stopifnotref <- function(ref) { + stopifnot(is.character(ref)) + stopifnot(nchar(ref) > 0) + stopunlesscommand("git", paste("reflog", ref)) +} Review Comment: stopfinotinrepo()/stopifnotref() currently use `git reflog ...` and pass arguments as a single string (e.g. "reflog main"). `reflog` also won’t work for tags (your examples use apache-arrow-* tags), so valid refs will be rejected. Use `git rev-parse` with vector args to reliably validate repo/ref existence. ########## r/tools/contributor_stats.R: ########## @@ -0,0 +1,127 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Contributor statistics for release announcements. +# +# The `print_new_contributors()` helper below is copied from Bryce Mecum's gist: +# https://gist.github.com/amoeba/4e26c064d1a0d0227cd8c2260cf0072a +# +# Usage: launch R from the root of the arrow git repo, then: +# +# source("r/tools/contributor_stats.R") +# release_contributor_stats("apache-arrow-20.0.0", "apache-arrow-21.0.0") +# +# or, for just the list of first-time contributors to a subdirectory: +# +# print_new_contributors("apache-arrow-20.0.0", "apache-arrow-21.0.0", "r") + +#' new_contributors.R +#' +#' Produce a list of names of new contributors between two git refs. The method +#' this uses is to first get the list of unique contrbutors referancable from +#' the first ref, then the second ref, and then compute the set difference and +#' return that. Review Comment: The roxygen header looks copied from a different file name ("new_contributors.R") and contains several typos ("contrbutors", "referancable"). Since this is the user-facing usage docs for the helper, it should reflect the actual file name and be readable. ########## r/tools/contributor_stats.R: ########## @@ -0,0 +1,127 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# Contributor statistics for release announcements. +# +# The `print_new_contributors()` helper below is copied from Bryce Mecum's gist: +# https://gist.github.com/amoeba/4e26c064d1a0d0227cd8c2260cf0072a +# +# Usage: launch R from the root of the arrow git repo, then: +# +# source("r/tools/contributor_stats.R") +# release_contributor_stats("apache-arrow-20.0.0", "apache-arrow-21.0.0") +# +# or, for just the list of first-time contributors to a subdirectory: +# +# print_new_contributors("apache-arrow-20.0.0", "apache-arrow-21.0.0", "r") + +#' new_contributors.R +#' +#' Produce a list of names of new contributors between two git refs. The method +#' this uses is to first get the list of unique contrbutors referancable from +#' the first ref, then the second ref, and then compute the set difference and +#' return that. +#' +#' Usage +#' +#' Launch an R session from the directory containing the git repo you want to +#' query against. +#' +#' Run this to get a list of new contributors between the refs +#' "apache-arrow-13.0.0" and "apache-arrow-14.0.0" for commits that touched +#' the "r" subdirectory": +# +#' print_new_contributors( +#' "apache-arrow-13.0.0", +#' "apache-arrow-14.0.0", +#' "r" +#' ) +#' +#' Note that the third argument, subdirectory, is optional. If omitted, it +#' will use the root directory. + +stopunlesscommand <- function(command, arguments) { + out <- tryCatch( + { + system2("git", arguments, stdout = TRUE) + }, + warning = function(w) { + stop(w) + }, + error = function(e) { + stop(e) + } + ) + + TRUE +} + +stopfinotinrepo <- function() { + stopunlesscommand("git", "reflog main") +} + +stopifnotref <- function(ref) { + stopifnot(is.character(ref)) + stopifnot(nchar(ref) > 0) + stopunlesscommand("git", paste("reflog", ref)) +} + +make_git_log_prev_args <- function(ref_from, subdirectory) { + paste0("log --pretty='format: %an' ", ref_from, " ", subdirectory, " | sort | uniq") +} + +make_git_log_next_args <- function(ref_from, ref_to, subdirectory) { + paste0("log --pretty='format: %an' ", ref_from, "..", ref_to, " ", subdirectory, " | sort | uniq") +} + +print_new_contributors <- function(ref_from, ref_to, subdirectory = ".") { + stopfinotinrepo() + stopifnotref(ref_from) + stopifnotref(ref_to) + stopifnot(file.exists(subdirectory)) + + prev_out <- trimws(system2("git", make_git_log_prev_args(ref_from, subdirectory), stdout = TRUE)) + new_out <- trimws(system2("git", make_git_log_next_args(ref_from, ref_to, subdirectory), stdout = TRUE)) + + setdiff(new_out, prev_out) +} + +# Contributors (author names) to `subdirectory` between two refs +contributors_between <- function(ref_from, ref_to, subdirectory = ".") { + trimws(system2("git", make_git_log_next_args(ref_from, ref_to, subdirectory), stdout = TRUE)) +} Review Comment: make_git_log_*() builds a single string containing pipes (`| sort | uniq`) and quotes, and that string is passed to system2() as git arguments. system2() does not invoke a shell, so the pipe/quoting won’t be interpreted and the git command will fail (or produce unsorted/duplicated output). Build argv vectors for git, and do sort/unique in R instead. ########## .claude/skills/r-cran-release/SKILL.md: ########## @@ -0,0 +1,376 @@ +# R CRAN Release + +Guide the R package maintainer through the CRAN release process for the Apache Arrow R package. Only use this skill when explicitly doing a CRAN release. + +Use exactly this sequence of steps. Print a checklist of all steps at the start, and update it as you go. Do not skip ahead. After completing each step, ask the user to confirm before moving on. Once confirmed, update the corresponding checkbox on the tracking issue. Use exactly the commands and approaches specified in each step — do not improvise or substitute alternatives without checking with the user. + +If any earlier step reveals something that needs to be cherry-picked into the release branch, note it as a comment on the tracking issue. When you reach the cherry-pick step later, check the tracking issue comments for anything noted earlier. + +## 1. Create GitHub Tracking Issue + +Ask the user for the release version number. + +```bash +gh issue create --repo apache/arrow \ + --title "[R] CRAN packaging checklist for version <VERSION>" \ + --body "$(cat r/PACKAGING.md | sed -n '/^- \[ \]/,$p')" +``` + +Track the issue number - update checkboxes as you complete each step. + +## 2. Create CRAN Release Branch + +Ask the user which RC number to use (e.g., rc1, rc2), then confirm before creating and pushing. + +```bash +git fetch upstream +git checkout apache-arrow-<VERSION>-rc<N> +git checkout -b maint-<VERSION>-r +git push upstream maint-<VERSION>-r +``` + +All subsequent steps should be done on this branch. + +## 3. Remove Badges from README + +In `r/README.md`, delete everything between `<!-- badges: start -->` and `<!-- badges: end -->` (inclusive): + +```bash +sed -i '/<!-- badges: start -->/,/<!-- badges: end -->/d' r/README.md +``` + +Commit this change to the `maint-<VERSION>-r` branch. + +## 4. Review Deprecated Functions + +Find functions using `.Deprecated()` that may need to advance (deprecated -> defunct/removed): + +```bash +grep -rn "\.Deprecated" r/R/*.R +``` + +Review each match and decide if the deprecation should advance for this release (e.g., remove the function entirely or change to `.Defunct()`). + +## 5. Evaluate Nightly Build Status + +Ask the user to check that R nightly builds were passing around RC time. They can check on Zulip or at https://crossbow.arrow-dev.org/ + +## 6. Check Current CRAN Check Results + +Fetch https://cran.r-project.org/web/checks/check_results_arrow.html and extract the check results table showing platform, version, and status. Also check for any "Additional issues" section. + +All platforms should show OK or NOTE status. NOTEs about package size (e.g., "installed size is 130+ Mb") are expected due to bundled Arrow C++ and can be ignored. Other NOTEs or any ERROR/WARN should be investigated. + +## 7. Ensure README is Accurate + +Read `r/README.md` and verify: +- Installation instructions are current +- Feature descriptions match current functionality +- Version-specific notes (e.g., C++ version requirements) are correct +- No outdated information + +Report any issues found. + +## 8. Run URL Checker + +Confirm on the `maint-<VERSION>-r` branch: + +```bash +git branch --show-current +``` + +Then run: + +```bash +cd r && Rscript -e 'urlchecker::url_check()' +``` + +All URLs should pass (badges were already removed). Fix any broken links. + +## 9. Polish NEWS + +Review `r/NEWS.md` and polish following tidyverse style (see https://style.tidyverse.org/news.html): + +- Use present tense ("X now does Y", not "X did Y") +- Name contributors with `@username` if they're not a listed package author. Listed authors (do not credit): @nealrichardson, @ianmcook, @thisisnic, @paleolimbot, @romainfrancois, @jkeane, @brycemecum, @dragosmg, @jeroenooms, @assignUser Review Comment: The list of “Listed authors (do not credit)” includes `@assignUser`, which looks like an unexpanded placeholder and could confuse the maintainer when following the checklist. ########## .claude/skills/r-cran-release/SKILL.md: ########## @@ -0,0 +1,376 @@ +# R CRAN Release + +Guide the R package maintainer through the CRAN release process for the Apache Arrow R package. Only use this skill when explicitly doing a CRAN release. + +Use exactly this sequence of steps. Print a checklist of all steps at the start, and update it as you go. Do not skip ahead. After completing each step, ask the user to confirm before moving on. Once confirmed, update the corresponding checkbox on the tracking issue. Use exactly the commands and approaches specified in each step — do not improvise or substitute alternatives without checking with the user. + +If any earlier step reveals something that needs to be cherry-picked into the release branch, note it as a comment on the tracking issue. When you reach the cherry-pick step later, check the tracking issue comments for anything noted earlier. + +## 1. Create GitHub Tracking Issue + +Ask the user for the release version number. + +```bash +gh issue create --repo apache/arrow \ + --title "[R] CRAN packaging checklist for version <VERSION>" \ + --body "$(cat r/PACKAGING.md | sed -n '/^- \[ \]/,$p')" +``` + +Track the issue number - update checkboxes as you complete each step. + +## 2. Create CRAN Release Branch + +Ask the user which RC number to use (e.g., rc1, rc2), then confirm before creating and pushing. + +```bash +git fetch upstream +git checkout apache-arrow-<VERSION>-rc<N> +git checkout -b maint-<VERSION>-r +git push upstream maint-<VERSION>-r +``` + +All subsequent steps should be done on this branch. + +## 3. Remove Badges from README + +In `r/README.md`, delete everything between `<!-- badges: start -->` and `<!-- badges: end -->` (inclusive): + +```bash +sed -i '/<!-- badges: start -->/,/<!-- badges: end -->/d' r/README.md Review Comment: The skill uses `sed -i ...` for in-place editing, which is not portable across GNU sed vs BSD/macOS sed. Since this is a release checklist that maintainers may run on macOS, prefer a cross-platform form (e.g., `-i.bak` + cleanup). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
