cleaned package: adversarial review summary

Verdict

The package runs, and its Tier 2 structure follows IPCC. But several defects change headline results by tens of percent, and some by an order of magnitude:

Nine of these were confirmed by unit tests against the IPCC source text (06). Most of them reach the live iCLEANED app (05). Until they are fixed, absolute footprints should not be reported. Enteric CH4 differences between scenarios are the most defensible output.

Reports

File Scope Critical High Medium Low
01_climate_ghg.md IPCC GHG, SOC, N2O, GWP 3 7 9 4
02_livestock.md Energy, intake, herd, N, feed library 2 5 9 8
03_landuse.md Land, water, erosion, N balance, scenarios 2 18 13 3
04_package_code.md R CMD check, design, bugs, tests, docs 4 8 15 5
05_app_relevance_and_workshop.md Findings vs the deployed app, guide vs code, workshop plan 39 Critical/High deduplicated: 28 affect the app, 7 are guarded by the app, 1 unclear, 3 have no runtime effect; 6 new issues
06_critical_tests.md Unit tests vs IPCC, with citations 9 findings tested: 8 fully confirmed, 1 partly confirmed (coefficient check skipped); controls pass
07_fix_log.md Proposed fixes, tested on a temporary copy Each fix turns only its own tests green, with no regressions; all fixes: 23 pass, 1 skipped
08_demo.md Current vs fixed vs IPCC, plus iCLEANED study impact Built by knitting fixes/demo.Rmd

R CMD check --as-cran gives 4 WARNINGs and 4 NOTEs, so CI (error_on = "warning") fails by design. The only existing test file contains no expectations.

Critical findings, deduplicated

# Finding Review ids Unit test (06) Reaches app (05)
1 Net-energy requirements ÷ ME density, with no REM/REG conversion (IPCC Eq. 10.14–10.16) CL F02, LV C-01 FAIL: DMI 0.55–0.63× IPCC Yes
2 N retention in kg N/day, used as a fraction and divided by 365 twice (Eq. 10.31A/10.33) LV C-02, H-04; CL F04; PK F07 FAIL: cow Nex +31% Yes
3 SOC stock-change factors applied every year to the measured stock (Eq. 2.25) CL F01, LU S-02 FAIL: −7 t C/ha/yr on unchanged land Yes, the largest effect: −4.5 t CO2/yr vs 5.1 t emissions in Study_1
4 Burning counts biogenic CO2 and applies the N2O GWP to NOx CL F03, PK F06 FAIL: 24× Yes: 40% of Study_2's total
5 Tree SOC is always 0 (list/data-frame mismatch) PK F02, LU S-01 FAIL Yes
6 Divide-by-zero results silently set to 0 ha LU-01, PK F04 FAIL Yes; the app's default removal = 0 triggers it
7 N leaching is a per-ha value added to farm totals LU N-01 FAIL: 2.6 vs 278 kg N Yes
8 Main inputs fetched from the caller's environment (get(..., parent.frame())) PK F03 FAIL ×2 Guarded: the app passes arguments explicitly
9 Shipped example inputs don't run PK F01, LU D-01, LV H-03 FAIL ×3 Guarded: the app writes the correct column names

Highest-impact High findings

Deployed version

This corrects what I said earlier in the session. The app most likely runs v0.7.0-equivalent code: fork head 4ae5505, which has the same R/ and inst/ as staging (about 65% likely). The alternative is the renv.lock pin 4c44dc9 (about 30%).

For the workshop

05 §6 has a 15-scenario test plan with expected ranges, and §7 has 16 warnings for facilitators. Minimum messages to participants:

  1. Test usability and the direction of change, not absolute numbers.
  2. Ignore the soil carbon and burning figures.
  3. Set a removal fraction for every feed; purchased feeds get no land.
  4. Fill in mature body weight, and weaning and 1-year weights for sheep and goats.
  5. Soil depth is in metres, and water figures are 10× too low.
  6. Run T0 before the session.

Suggested fix order

  1. Fixes that are one line or a few lines each:
  2. Engine changes:
  3. Guards:
  4. Hygiene:

The proposed fixes and their test results are in 07_fix_log.md. The demo is 08_demo.md.

Local artefacts

Comments

Comments are GitHub Discussions on peetmate/cleaned-review; sign in with GitHub to post.