Contributing to dseams-r
Source:AGENTS.md
This file is the working contract for anyone changing this repository. The README is for users of the package; this file is for people editing it.
What lives here and what does not
This repository holds the R package dseams on top of the d-SEAMS engine. The engine, the C API (libseams, header include/seams.h), the language ABI (libseams_lang, header bindings/cxx/seams_lang.h), the seams CLI and the C++ reference binding_oracle live in d-SEAMS/seams-core.
- A new analysis, a changed result, a C API or ABI function, a reader for a new file format, or a bug inside the engine: change seams-core first. Bind it here once a seams-core commit carries it, and move the pin.
- An R function, an S3 method, the C/C++ glue in
src/*.candsrc/*.cpp,configure,tools/vendor.sh, docs, examples or tests: change it here. - Do not commit engine sources.
src/seams/andinst/extdata/are written bytools/vendor.shand ignored by git. The copy changes only throughtools/vendor.sh(which strips[[nodiscard]]and routes console output andexitthroughsrc/dseams_r_io.h), never by hand.
Layout
| Path | Contents |
|---|---|
DESCRIPTION, NAMESPACE
|
Package metadata; NAMESPACE and man/ are written by roxygen2 |
R/ |
dseams.R (frames and analyses), capi.R (seams_* C API wrappers), s3.R, dseams-package.R, cpp11.R (generated) |
src/ |
dseams.cpp (cpp11, libseams_lang), seams_call.c (.Call into libseams), dseams_r_io.*, Makevars.in, Makevars.win
|
configure, configure.win, cleanup
|
Make src/Makevars; choose the bundled copy or a linked engine |
tools/seams-core.ref |
SEAMS_CORE_REPO and SEAMS_CORE_REF, the seams-core revision the copy and CI use |
tools/vendor.sh |
Copies the engine sources and example dumps from a seams-core tree, or from the pin |
tools/fetch-engine.R |
Downloads the pinned seams-core source with base R |
tests/testthat/ |
test-api.R, test-ice.R, test-s3.R, test-doc-examples.R
|
inst/examples/ |
Scripts the d-SEAMS site includes; test-doc-examples.R runs them |
vignettes/ |
classifying-ice.Rmd |
docs/ |
API, tutorial and language-task pages for the d-SEAMS site |
pixi.toml, pixi.lock
|
R, compilers and every Suggests package for local checks |
.github/workflows/r-cmd-check.yml |
Bundled checks on Linux, macOS and Windows; a linked check against seams-core built at the pin |
.github/workflows/test-coverage.yml |
covr on the R code, linked against seams-core built at the pin, reported in the job summary |
How the package finds the engine
configure takes the first that applies:
-
SEAMS_LIBDIR: linklibseams_langthere andlibseamsfromSEAMS_SO_DIR(default: thesrc/beside it). Headers come fromSEAMS_INCLUDEandSEAMS_H_DIR, or from the seams-core tree inDSEAMS_ROOT. -
DSEAMS_SYSTEM_ENGINE=1: link theseamsandseams-langpkg-config modules; their version must equalVersioninDESCRIPTION. - Otherwise compile the bundled copy in
src/seams.
In every mode src/seams and inst/extdata must exist. When they do not, tools/vendor.sh writes them from SEAMS_CORE_SRC or DSEAMS_ROOT, else from the revision in tools/seams-core.ref, which it downloads unless DSEAMS_NO_DOWNLOAD=1. A tarball from R CMD build carries the copy and installs with no network.
Build and test
All builds and checks run on a build host, not on a laptop. With a seams-core checkout at the pin built in build/ (meson targets src/libseams.so, bindings/libseams_lang.so, seams, bindings/binding_oracle):
# DSEAMS_ROOT is a seams-core checkout at the pin, already built.
export SEAMS_BIN="$DSEAMS_ROOT/build/seams"
# bundled copy
pixi run sh tools/vendor.sh "$DSEAMS_ROOT"
pixi run R CMD build --no-manual .
pixi run R CMD check --as-cran --no-manual dseams_*.tar.gz
# linked against that build
SEAMS_LIBDIR=$DSEAMS_ROOT/build/bindings \
SEAMS_CPP_ORACLE=$DSEAMS_ROOT/build/bindings/binding_oracle \
pixi run sh -c 'R CMD build --no-manual . && R CMD check --no-manual dseams_*.tar.gz'R CMD check --as-cran needs checkbashisms on PATH. The conda-forge R adds -march=nocona; _R_CHECK_COMPILATION_FLAGS_KNOWN_=-march=nocona names it as a toolchain flag (the pixi run check task sets it).
Every check must pass before a change is called done: no ERROR, no WARNING. The check reports one NOTE, which is expected. Fix the code under test; do not skip, loosen or delete a test to get there. A test changes only when the behavior it pins changes on purpose, and the commit says so. Without DSEAMS_ROOT, SEAMS_BIN and SEAMS_CPP_ORACLE some tests report a skip; CI sets them, and so should a local run that touches an analysis. SEAMS_CPP_ORACLE must come from the build the package links.
When the engine changes
- Move
SEAMS_CORE_REFintools/seams-core.ref. - If the engine gained or lost a translation unit that
libseams_langorseams_api.cppneeds, edit theseams/*.oblock in bothsrc/Makevars.inandsrc/Makevars.win;tools/vendor.shrefuses lists that differ. - Wrap new C API symbols in
src/seams_call.candR/capi.R, document them with roxygen2, regenerateman/andNAMESPACE, and extend the tests.
Commits and changelog
-
Conventional Commits:
feat,fix,docs,test,build,ci,refactor,style,chore, with a scope where it helps (fix(configure): ...). One logical change per commit; formatter-only changes go in their ownstyle:commit. - ASCII punctuation in code, docs and commit messages. Comments say what the code does and why, in the present tense; history belongs in the commit.
- Every user-visible change adds a bullet to
NEWS.mdunder the top heading# dseams (development version), which a release renames to# dseams X.Y.Z.
Releases
The package version is the seams-core version it binds.
- seams-core tags the release (
vX.Y.Zon d-SEAMS/seams-core). - Here: set
SEAMS_CORE_REPO=d-SEAMS/seams-coreandSEAMS_CORE_REF=vX.Y.Zintools/seams-core.ref,Version: X.Y.ZinDESCRIPTION,SEAMS_LANG_VERSIONinsrc/Makevars.win, rename theNEWS.mdheading, updateversioninCITATION.cff,codemeta.jsonandcran-comments.md, and wait for CI on that commit. -
sh tools/vendor.sh,R CMD build ., and submit that tarball. - Tag
vX.Y.Zhere.