Skip to content

feat(workflows): reusable R-CMD-check for kaefa/nonnest2 - #1716

Merged
seonghobae merged 11 commits into
mainfrom
feat/r-package-check-reusable-workflow
Sep 4, 2026
Merged

feat(workflows): reusable R-CMD-check for kaefa/nonnest2#1716
seonghobae merged 11 commits into
mainfrom
feat/r-package-check-reusable-workflow

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Owner goal

Consolidate the duplicated R-CMD-check implementation in ContextualWisdomLab/kaefa and ContextualWisdomLab/nonnest2 behind one canonical reusable workflow without transferring executable authority from consumers into the trusted central job.

Security RCA and test-first repair

Devin review found a substantive defect in the first design: caller input pre_check_script was interpolated directly into a Bash run: block, so a compromised caller could execute arbitrary commands with the reusable job's repository token.

The canonical owner repair is test-first:

  • RED 5e838ab35d062faa488b03ae78f9f8d84447e223: executable regression forbids pre_check_script / caller-authored shell and requires bounded data inputs.
  • Production 931c8f32a2e5e743ca0fbdee3d6728170ff2b273: replaces arbitrary shell input with install_package_before_pre_check and pre_check_test_file; the workflow owns fixed R commands and validates the path before execution.
  • GREEN-contract alignment 6ca3080326f3498904d6222c60089e35a050b848: updates step/input/path-validation assertions around the repaired source.
  • ADR/doctoring 0747ae12b0ec77f2275e113f9af8630dc8a41bf0 / 8691ac6c7365c1ee99148bbb5bfbd5d609be0c3c: records the trust-boundary decision and keeps ADR-0023 Proposed until protected integration.

The bounded interface now consists of r_matrix, needs_tinytex, extra_packages, check_args, install_package_before_pre_check, and pre_check_test_file. pre_check_test_file must be a repository-relative tests/testthat/*.R path; parent traversal, absolute paths, CR, and LF fail closed. Consumer data is passed through an environment variable to a fixed testthat::test_file(...) command and is never evaluated as shell source.

Current-main reconciliation

Protected main advanced concurrently. The writer was advanced without force-push/destructive rebase to exact head 9ec686e5f6753904ae5eecc1f35aceffb44280c3, a two-parent merge preserving protected main@63bf49835da44aa8257eb76a92368e6485ae6e94 and the repaired writer history. Fresh current-main comparison is ahead-only (behind_by=0) and the effective delta is exactly four files: the reusable workflow, ADR-0023, doctoring, and its executable contract test.

Review and consumer stack

The original arbitrary-shell security finding is resolved on the repaired exact head. Current Devin Review and CodeRabbit commit statuses are successful, and all review threads have been resolved only after the relevant source/contract or dependency-order evidence was present.

  • ContextualWisdomLab/kaefa#84 remains a live dependent and must replace its retired shell input with install_package_before_pre_check: true plus pre_check_test_file: tests/testthat/test-zh-misfit-decision-rule.R.
  • ContextualWisdomLab/nonnest2#119 remains the second live dependent.
  • Neither consumer may use mutable @main or this PR head as production authority. After this owner PR integrates, both caller branches must pin the exact protected-main commit carrying r-package-check.yml and regenerate their own exact-head evidence before either migration merges.

Merge boundary

Ordinary auto-merge is armed, not administrator bypass. Current exact-head security/quality workflow runs are queued/pending in the saturated Actions fleet; predecessor results do not transfer and queued evidence is not GREEN. Merge only when ordinary protected admission is satisfied on the unchanged exact head. The consumer PRs remain open until post-publication immutable-pin repair and their own current-head admission complete.

kaefa and nonnest2 each carried a hand-copied R-CMD-check.yaml generated
from the same upstream r-lib template. Consolidate the shared
checkout -> setup-pandoc -> [setup-tinytex] -> setup-r ->
setup-r-dependencies -> check-r-package sequence into one workflow_call
workflow with inputs for the fields that genuinely vary per repo
(r_matrix, needs_tinytex, extra_packages, check_args, pre_check_script).

See docs/adr/0023-r-cmd-check-reusable-workflow-consolidation.md and
docs/doctoring/r-cmd-check-reusable-workflow-consolidation.md for the
full field-by-field audit, including two non-uniform fields
(extra-packages, check-r-package args) the initial survey missed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 33 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: d8095833-b151-4a72-a55d-2bc22d2661bc

📥 Commits

Reviewing files that changed from the base of the PR and between 22a7073 and e635312.

📒 Files selected for processing (4)
  • .github/workflows/r-package-check.yml
  • docs/adr/0023-r-cmd-check-reusable-workflow-consolidation.md
  • docs/doctoring/r-cmd-check-reusable-workflow-consolidation.md
  • tests/test_r_package_check_reusable_workflow_contract.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

devin-ai-integration[bot]

This comment was marked as resolved.

@seonghobae seonghobae added area: ci-cd CI, GitHub Actions, checks, release, or supply chain enhancement New feature or request priority: medium Normal-priority or P2 work status: needs-review Open pull request requiring current-head review or checks type: feature New or expanded product capability labels Sep 2, 2026 — with ChatGPT Codex Connector
The dependency-review.yml consolidation's caller PRs surfaced a real Devin
security finding: uses: <reusable-workflow>@main runs an unreviewed
central change against every caller's PR checks with no review in the
calling repo. Fixed there (all four callers pinned to a commit SHA); apply
the same correction to this not-yet-merged reusable workflow's own
documented example before any caller PR copies the unsafe pattern. Also
notes the separate required-status-check-name gotcha (converting a job to
uses: renames its published check) to check for in each caller repo before
merging.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 new potential issues.

Devin Review

Comment thread docs/adr/0023-r-cmd-check-reusable-workflow-consolidation.md
Comment thread .github/workflows/r-package-check.yml
@seonghobae
seonghobae merged commit 816e3e4 into main Sep 4, 2026
4 of 17 checks passed
@seonghobae
seonghobae deleted the feat/r-package-check-reusable-workflow branch September 4, 2026 05:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci-cd CI, GitHub Actions, checks, release, or supply chain enhancement New feature or request priority: medium Normal-priority or P2 work status: needs-review Open pull request requiring current-head review or checks type: feature New or expanded product capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant