File snapshots are stale after the ssddata 2.0.0 unit corrections
- Dominant language
- R
- Stars
- 0
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Running `main` (63bd1b8) locally against ssdtools `dev` (2.7.0.9000) with ssddata 2.0.0 gives `FAIL 5 | PASS 853` in 4.4 minutes. All five are `Snapshot of path has changed` on file snapshots:
- `test-averaging.R`: `_snaps/averaging/averaging.csv`
- `test-bcanz-hc.R`: `_snaps/bcanz-hc/bcanz_hc.csv`
- `test-hc5-gm.R`: `_snaps/hc5-gm/hc5_gm.csv`
- `test-lnorm-lnorm.R`: `_snaps/lnorm-lnorm/plot_anonb.png`
- `test-plot.R`: `_snaps/plot/boron_cens_pred_ribbon.png`
The same run against poissonconsulting/ssdtools#196 produces the identical set of failures and byte-identical regenerated snapshot files, so none of this is an ssdtools change; it is the snapshots being stale.
## Cause of the three CSV failures: ssddata 2.0.0 unit corrections
Every changed row (4 in `averaging.csv`, 16 in `bcanz_hc.csv`, 36 in `hc5_gm.csv`) belongs to one of four datasets: `anzg_boron_fresh`, `anzg_nitrate_soft_fresh`, `anzg_nitrate_moderate_fresh`, `anzg_nitrate_hard_fresh`. ssddata 2.0.0 (2026-08-03) corrected exactly those four from mg/L to ug/L (ssddata GitHub #47, "stored in mg/L but documented and treated as ug/L, so their `get_ssddata()` values disagreed with the gazetted `ssd_fits` estimates by ~1000x"). The snapshots were last committed on 2026-07-20 and predate that release.
For three of the four the change is a pure rescaling, ratio 1000.000 on every row, e.g. `averaging.csv`:
```
anzg_boron_fresh,1.13455,1.12824 -> anzg_boron_fresh,1134.55,1128.24
anzg_nitrate_soft_fresh,0.916099,... -> anzg_nitrate_soft_fresh,916.098,...
```
## `anzg_nitrate_hard_fresh` does not rescale cleanly
Its averaged HC5 moves by 951x rather than 1000x (`averaging.csv`: 22.5255 to 21422.3), the `dists` column in `bcanz_hc.csv` loses `lnorm_lnorm`, and the `lnorm_lnorm` row of `hc5_gm.csv` becomes `NA`. The mechanism is in ssdtools rather than in the data: the `lnorm_lnorm` fit converges to a different optimum at the two scales (mg/L: `sdlog1` = 0.019, `pmix` = 0.250; ug/L: `sdlog1` = 0.206, `pmix` = 0.294), so its AICc delta is 11.14 in ug/L, above the `delta = 9.21` cut that `ssd_hc()` applies even with `average = FALSE`, where in mg/L it was under the cut and included. Starting values are deterministic (identical fits under seeds 1, 50 and 99), so this is scale dependence of the optimum, not seed noise.
Accepting the regenerated snapshots bakes that in. Whether the mg/L or the ug/L optimum is the better one is worth its own ssdtools issue on scale invariance of the mixture fit; it should not block regenerating these snapshots, since the ug/L data are now the correct ones.
## The two PNG failures
`plot_anonb.png` and `boron_cens_pred_ribbon.png` differ from the committed files on macOS (the only platform `expect_snapshot_plot()` runs on) and are identical between the two ssdtools builds. Not investigated further; these are the plot snapshots the README already describes as not reproducible across platforms, and most likely reflect the current ggplot2 or graphics device rather than a behaviour change. Related: poissonconsulting/ssdtests#3 records stale `hc` snapshots surfaced by CI standardisation.
## Suggested fix
1. Regenerate with ssddata >= 2.0.0, review with `testthat::snapshot_review()` confirming the four ANZG datasets moved by 1000x (and only those), and commit.
2. Record the ssddata version the snapshots were generated against, either by bumping `Imports: ssddata (>= 2.0.0)` in `DESCRIPTION` or by a `skip_if_not(packageVersion("ssddata") >= "2.0.0")` guard in the affected tests, so the next unit correction fails loudly with a reason rather than a diff.
3. Decide separately whether `anzg_nitrate_hard_fresh` / `lnorm_lnorm` warrants an ssdtools issue.
Environment: macOS (Darwin 25.6.0), R 4.6, ssddata 2.0.0, ssdtools 2.7.0.9000 (`dev` at 5d4be4c8 and poissonconsulting/ssdtools#196 at c60e22cf, identical results), ssdtests `main` 63bd1b8.
Contributor guide
Research direction
Run the five named tests—test-averaging.R, test-bcanz-hc.R, test-hc5-gm.R, test-lnorm-lnorm.R, and test-plot.R—with ssddata 2.0.0, then use testthat::snapshot_review() to inspect the regenerated files under _snaps. Confirm the four ANZG datasets changed as described, handle the PNG snapshots as documented, and record the ssddata version in DESCRIPTION or an affected test guard; done means the intended snapshots are updated and the suite passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100