Testing and Validation
Purpose
Define the canonical testing and validation workflow for DSAMbayes v1.3.3, from local pre-merge checks through release-quality gates.
Audience
- Engineers running local checks before merge
- Maintainers preparing release candidates
- Reviewers validating release evidence
Validation layers
| Layer | Objective | Primary command(s) | Output proof |
|---|---|---|---|
| Lint | Catch style and static issues early | Rscript scripts/check.R --lint |
Exit code 0, no lint failures |
| Style | Enforce formatting compliance on changed files | Rscript scripts/check.R --style |
Exit code 0, no reformat-required files |
| Unit tests | Catch behavioural regressions in package logic | Rscript scripts/check.R --test |
Exit code 0, no test failures |
| Minimal smoke | Keep a cheap Stan-backed safety check in the routine local loop | Rscript scripts/check.R --smoke |
Exit code 0, fast unit tests plus minimal Stan smoke pass |
| Stan smoke | Exercise the broader compiled Stan suite beyond the minimal smoke tier | Rscript scripts/check.R --stan-smoke |
Exit code 0, Stan smoke tests enabled |
| Stan recovery evidence | Re-run the full coefficient-recovery file under the nightly Stan gate | Rscript scripts/check.R --stan-recovery |
Exit code 0, full-Stan DGP recovery tests pass |
| Stan release evidence | Re-run high-budget pooled and hierarchical evidence checks for release candidates | Rscript scripts/check.R --stan-release-evidence |
Exit code 0, targeted high-budget Stan evidence passes diagnostic thresholds |
| Docs sanity | Catch local docs-link breakage and high-value contract drift | Rscript scripts/check.R --docs |
Exit code 0, docs sanity checks pass |
| Package check | Validate package-level install and check behaviour | R -q -e 'rcmdcheck::rcmdcheck(...)' |
No ERROR; no unresolved WARNING |
| Runner validate | Validate config and data contracts without fitting | Rscript scripts/dsambayes.R validate ... |
Exit code 0, metadata artefacts |
| Runner run | Validate end-to-end runner execution and artefacts | Rscript scripts/dsambayes.R run ... |
Exit code 0, core run artefacts |
| Docs build | Validate docs-site/Hugo buildability | python3 docs-site/build_content.py && (cd docs-site && hugo --cleanDestinationDir) |
Exit code 0, successful site build |
Environment setup
Run all commands from repository root:
Expected outcome: checks run in a repo-scoped environment with reproducible library and cache paths.
Dependency source portability
Before a release candidate is signed off, verify all non-CRAN dependency
sources in renv.lock and DESCRIPTION.
The preferred release path is a pinned private GitHub remote for optional decomposition dependencies. A local fallback may restore those dependencies from sibling checkouts:
If any entries remain as file:// sources in renv.lock, release evidence
must record the required local paths and pinned commit hashes. For an external
release or clone-portable handoff, prefer reachable pinned remotes before
sign-off.
When validating either dependency source path, use telemetry-disabled restores:
Expected outcome: teller and DSAMdecomp restore and load from the recorded
sources. If private GitHub authentication is unavailable, or a local fallback
path is missing, hold the release until dependency sources are reproducible in
the release environment.
Local validation workflows
Developer fast path (pre-merge)
Use the explicit local ladder:
Expected outcomes:
--teststays fast and runs the unit path only.--smokeruns the unit path plus a minimal Stan-backed subset: one cheap BLM MCMC smoke, one pooled deployment-artifact smoke on a real pooled fit, and tinyrun_from_yaml()runner smokes including pooleddeployment_model.rdsroundtrip coverage.--docsruns the local docs/link sanity helper against README and the tracked docs surfaces.--releaseruns lint, style, unit tests, minimal Stan smoke, docs sanity, and coverage as a broader local code gate.
Implementation note:
scripts/check.R --allremains a legacy convenience gate for lint, style, tests, and coverage only.scripts/check.R --docsis the explicit docs/link drift check.scripts/check.R --releaseis the clearer code-focused local release profile.- Neither profile replaces
rcmdcheck, runner smoke checks, or docs build.
Stan-specific note:
- use
Rscript scripts/check.R --stan-smokefor the broader opt-in compiled Stan suite - use
--stan-smoke-fullfor the fuller nightly variant - use
--stan-recoverywhen you need a targeted rerun of the DGP recovery evidence without invoking the rest of the full Stan suite - use
--stan-release-evidencefor the high-budget release-candidate lane covering the warning-prone pooled and hierarchical paths
Release-candidate full path
Run mandatory gates in this exact order:
Expected outcome: all gates complete with exit code 0, with no unresolved release blockers.
Local package-check note:
DSAMdecompremains an optional Suggests dependency. Canonical localrcmdcheckruns set_R_CHECK_FORCE_SUGGESTS_=falseso release gates do not depend on installing a telemetry-enabled decomposition package.
Runner smoke-test expectations
Minimum release smoke expectations:
scripts/check.R --smokesucceeds, proving at least one cheap Stan MCMC path, pooled deployment-artifact coverage on a real pooled fit, and tiny runner fit paths.validatecommand succeeds and writes metadata artefacts.runcommand succeeds and writes model, fitted/observed output, and diagnostics artefacts.- Required runner artefact paths exist under
results/quality_gate_validate/andresults/quality_gate_run/.
For matrix and exact artefact paths, use Runner Smoke Tests.
Evidence capture requirements
Before sign-off, capture:
- Full command logs and exit codes for all mandatory gates.
- Runner smoke artefacts from validate and run directories.
- Candidate commit hash and top changelog section.
Use Release Evidence Pack as the authoritative bundle contract.
Failure handling
- Any gate failure is a release blocker until resolved.
- Re-run the full failed gate after remediation.
- If
rcmdcheckemitsNOTE, record reviewer rationale explicitly. - If runner artefacts are missing, inspect resolved config and
outputs.*flags.