Skip to content

Make fitted tests backend-neutral (#311, #328) - #349

Merged
beckyfisher merged 3 commits into
devfrom
issue-311-328-test-infrastructure
Sep 15, 2026
Merged

beckyfisher merged 3 commits into
devfrom
issue-311-328-test-infrastructure

Conversation

@beckyfisher

@beckyfisher beckyfisher commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Addresses #311 and #328.

What

Twelve fitted tests no longer pass open_progress = FALSE through bnec() or
bnec_hurdle(). The argument is specific to the rstan backend. Omitting it
lets the same tests run when brms is configured to use cmdstanr.

The branch is based on dev after #331 merged the #328 fixture reuse. That
change builds five Stan programs where the affected files previously built
fourteen. This pull request completes the combined test-infrastructure batch
with #311. It also corrects stale descriptions of #328's withdrawn worker-count
policy and prevents a manually dispatched timing run from truncating a
fractional worker count.

Why it matters

The test suite previously failed when a contributor had
options(brms.backend = "cmdstanr") in the session or profile. The failure was
reported as a model that did not fit, although the model and data were valid.
The retained fixture reuse removes nine repeated compilations without changing
an assertion.

Evidence

On R 4.6.1 with brms 2.23.0, cmdstanr 0.9.0 and CmdStan 2.39.0, a revised
nec4param test fit compiled and sampled through the cmdstanr backend. Both
chains completed and bnec() returned a bayesnecfit. All eight edited test
files parse, no open_progress call remains under tests/, and
R CMD build --no-build-vignettes succeeds.

The workflow parses as YAML. Direct tests of its worker-input rule accept
positive integral counts and reject fractional, non-finite, out-of-range and
non-positive values.

The fixture reuse merged in #331 was measured directly: the affected files
compiled five Stan programs rather than fourteen with assertion counts unchanged
at 71 and 36. Its four-platform R CMD check matrix passed. This pull request's
matrix tests the combined state.

Implementation detail

open_progress defaults to interactive() for the rstan sampling path, which
is already false in non-interactive test runs. The cmdstanr path does not
accept the argument. Deleting it therefore changes no model equation, family,
prior, seed, chain count, iteration count or assertion.

#328's addendum withdrew the proposed CI worker-count change after paired runs
could not distinguish its effect from runner variance. This branch does not
restore that setting. It retains only #331's deterministic fixture reuse and
the workflow instrumentation that already merged to dev. A blank dispatch
input leaves TESTTHAT_CPUS unset, and a supplied value must represent a
positive integer before conversion.

No scientific judgement was required for either part.

@beckyfisher

Copy link
Copy Markdown
Collaborator Author

The pull request body now includes the corrected #328 worker-count description and validation of manually supplied worker counts. The latter rejects fractional, non-finite, out-of-range and non-positive values before integer conversion.

@beckyfisher

Copy link
Copy Markdown
Collaborator Author

Independent review completed after three cycles. No defect was found in the
test changes or their scientific behaviour.

The review identified and corrected these maintenance problems:

The reviewer accepted the corrections and found no remaining actionable issue
at 99ad0115.

@beckyfisher
beckyfisher merged commit f54e4bd into dev Sep 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant