Skip to content

Add R API symbol drift check#264

Open
CGMossa wants to merge 1 commit into
extendr:masterfrom
CGMossa:check-r-api-symbols
Open

Add R API symbol drift check#264
CGMossa wants to merge 1 commit into
extendr:masterfrom
CGMossa:check-r-api-symbols

Conversation

@CGMossa

@CGMossa CGMossa commented Jun 30, 2026

Copy link
Copy Markdown
Member

TODO: replace this line with your own framing, in your own voice.

AI-written details

Summary

  • Since #250 removed in-tree bindgen, the per-version files in bindings/ are maintained by hand and nothing flags when R's C API surface shifts, so they can silently go stale (no R 4.5 / 4.6 bindings ever landed).
  • Adds a bindgen-free drift watcher:
    • tools/r-symbols.sh lists the C symbols exported by the installed R shared library using nm (macOS libR.dylib, Linux libR.so).
    • .github/workflows/check-r-api.yml runs it weekly against R-devel on macOS + Ubuntu, unions the per-OS lists, and opens a PR whenever the committed r-symbols.txt snapshot changes.
  • It only flags drift, it does not generate bindings. Added symbols (cross-checked against nonAPI.txt) point to new C API the hand-maintained bindings should expose; removed symbols point to breakage.

Test plan

  • tools/r-symbols.sh runs locally against R 4.6.0 on macOS arm64: 2535 symbols, deterministic across runs, key API present (Rf_error, Rf_protect, R_ParseEvalString, REAL, TYPEOF, Rf_allocVector).
  • First scheduled (or manually dispatched) run on master establishes the baseline r-symbols.txt via a PR.
  • A later run after an R-devel C-API change opens a PR showing the symbol diff.

Notes

  • Modeled on the existing non-api-call.yml (same weekly cron + branch + gh pr create pattern), so it reuses machinery the repo already trusts.
  • Windows is intentionally omitted: nm on R.dll needs Rtools on PATH. macOS + Linux catch effectively all API-surface changes, which are platform-independent. Windows-only symbols can be added later if wanted.
  • Stable internal noise (R's vendored ZSTDv07_*, _hershey_* symbols) stays constant across versions, so it never shows up in the version-to-version diff.

Drafted by Claude (claude-opus-4-8). Reviewed by the author.

Since in-tree bindgen was removed (extendr#250), the per-version files in bindings/
are maintained by hand and nothing notices when R's C API surface changes, so
they can silently go stale (no R 4.5 / 4.6 bindings ever landed).

Add a bindgen-free watcher: `tools/r-symbols.sh` lists the C symbols exported
by the installed R shared library (via `nm`, macOS + Linux), and
`check-r-api.yml` runs it weekly against R-devel, unions the per-OS lists, and
opens a PR whenever the snapshot changes. It flags drift only; it does not
generate bindings. The first run establishes the baseline snapshot.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant