Skip to content

Latest commit

 

History

History
55 lines (41 loc) · 3.18 KB

File metadata and controls

55 lines (41 loc) · 3.18 KB

AGENTS.md — enso

Quick start

# Build & test inside Docker (primary dev workflow)
docker compose build
docker compose run islasgeci make tests
docker compose run islasgeci make coverage

TDD cycle (encoded in Makefile)

The project uses a strict red/green/refactor cycle via make. Each phase applies styler formatting, runs tests with stop_on_failure = TRUE, then auto-commits:

Phase Command Auto-commits On failure
Red (write failing test) make red tests/testthat/*.R git restore .
Green (make pass) make green R/*.R git restore .
Refactor make refactor R/*.R + tests/testthat/*.R git restore .
  • make check — check styler formatting (no auto-fix, used in CI).
  • make format — auto-format R/ and tests/ with styler.
  • make setupclean + install (rebuilds package, regenerates NAMESPACE, runs devtools::check).
  • make tests — run devtools::test(stop_on_failure = TRUE).

Architecture

  • Exported functions (see NAMESPACE — auto-generated by roxygen2):
    • classify_by_season_and_enso_phase() — classify dates by season and ENSO phase.
    • get_domain_specific_options() — define CLI option keys with defaults.
  • Internal functions in R/: compute_season(), compute_enso(), lookup_season_column(), transform_roni_data_to_longer(), lookup_nine_oni_values(), classify_enso_phase(), has_consecutive_threshold_values().
  • src/borrador_codigo_enso.R is scratch/draft code, not part of the package — do not edit or export.
  • Sibling reference: ../bycatch_code/ establishes patterns this project follows (e.g., get_domain_specific_options using gecioptparse). Consult it for implementation conventions.
  • gecioptparse API: Exported functions character_option(), integer_option(), double_option(), and get_options_from_vec() are used to build CLI options. Pattern: define each option with gecioptparse::*_option(), combine into a vector, pass to gecioptparse::get_options_from_vec().
  • The Gold: Defined in TODO.md. Currently: migrate get_domain_specific_options() to use gecioptparse.
  • Only branch is develop (no main).

Testing

  • testthat edition 3, BDD-style with describe()/it().
  • Test fixtures live in tests/data/ (roni_data.csv, transformed_roni_data.csv).
  • Tests read CSVs with readr::read_csv("/workdir/tests/data/...") — path is hardcoded for the Docker container.

Dependencies & toolchain quirks

  • Remote dependencies: IslasGECI/gecioptparse, IslasGECI/testtools (installed via remotes in DESCRIPTION).
  • NAMESPACE is generated by roxygen2 — never edit by hand. Regen with devtools::document() (part of make setup).
  • man/ directory is generated the same way.
  • Coverage uses covr package + Codecov (token in tests/testthat/coverage.R).
  • CI runs inside Docker only: docker buildmake checkmake coveragemake mutants (mutants target is a placeholder: "En espera del doctorado de Evaristo 👾🎉🎓").

Known issues

  • CHANGELOG.md comparison URLs now point to the correct enso repository (was templater — fixed).