Skip to content

fix: compatibility with primarycensored >= 1.4.0#589

Merged
seabbs merged 5 commits intoepinowcast:mainfrom
seabbs-bot:fix/primarycensored-L-param
Apr 8, 2026
Merged

fix: compatibility with primarycensored >= 1.4.0#589
seabbs merged 5 commits intoepinowcast:mainfrom
seabbs-bot:fix/primarycensored-L-param

Conversation

@seabbs-bot
Copy link
Copy Markdown
Contributor

@seabbs-bot seabbs-bot commented Apr 8, 2026

Summary

  • Adds missing L (left truncation) parameter to the primarycensored_lpmf Stan call in the marginal model template, fixing Stan compilation failures with primarycensored >= 1.4.0
  • Adds primarycensored (>= 1.4.0) version bound to DESCRIPTION
  • Extends check-cmdstan CI workflow to also check marginal model Stan syntax (previously only checked the latent model, which is why this breakage wasn't caught)

Context

primarycensored 1.4.0 added left truncation support via a new L parameter in all Stan function signatures. This changed primarycensored_lpmf from 8 to 9 arguments, breaking epidist's marginal model for all users. This PR hardcodes L = 0 (no left truncation) to restore compatibility. Full left truncation support is tracked in #588.

Closes #583

Test plan

  • Stan code generates successfully with epidist_stancode()
  • Stan code passes rstan::stanc() type checking
  • Unit tests pass (0 failures, 222 passed)
  • Lint clean (no new warnings in changed files)
  • R-side code (dpcens/rpcens calls in gen.R) already uses named arguments so is unaffected

This was opened by a bot. Please ping @seabbs for any questions.

Summary by CodeRabbit

Chores

  • Updated minimum version requirements for external package dependencies to maintain compatibility with the latest available features and improvements.
  • Enhanced continuous integration validation processes with comprehensive consistency checks.

Bug Fixes

  • Fixed a parameter handling issue in core statistical computations that could potentially affect result accuracy.

primarycensored >= 1.4.0 added a left truncation parameter (L) to all
Stan function signatures. The marginal model Stan template was missing
this parameter, causing Stan compilation failures for all users.

Also adds primarycensored >= 1.4.0 version bound to DESCRIPTION and
extends check-cmdstan CI to cover marginal model syntax.

Closes epinowcast#583
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc3f2fdd-d8cb-400c-89b4-a41f9e31ad46

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The PR updates epidist to support the new left-truncation parameter (L) added to the primarycensored package. It bumps the primarycensored dependency to version 1.4.0, inserts an explicit 0 for the L argument in the Stan model's primarycensored_lpmf function call, and separates workflow validation steps for latent and marginal models.

Changes

Cohort / File(s) Summary
Workflow validation
.github/workflows/check-cmdstan.yaml
Renamed "Compile model and check syntax" step to "Check latent model syntax" and added new "Check marginal model syntax" step with separate validation logic for the marginal model variant.
Dependency update
DESCRIPTION
Bumped primarycensored dependency from unversioned to minimum version constraint (>= 1.4.0).
Stan function signature
inst/stan/marginal_model/functions.stan
Added explicit 0 argument to primarycensored_lpmf call after y_upper parameter to accommodate new left-truncation L parameter in primarycensored 1.4.0+.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐰 A parameter hops into the fold,
The L for truncation, brave and bold!
With zero passed and versions set,
Our marginal models safely bet!
Dependencies aligned with care,
The future's truncation, standing fair! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main purpose of the PR: adding compatibility with primarycensored >= 1.4.0 by updating the package to handle the new L parameter.
Linked Issues check ✅ Passed The PR fully addresses the coding requirements from issue #583: updates the Stan call to include the L parameter, updates the DESCRIPTION version constraint, and extends CI checks for marginal model syntax.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #583 requirements: Stan function signature updates, version constraints, and CI workflow enhancements for validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Timed out fetching pipeline failures after 30000ms


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@seabbs seabbs self-requested a review April 8, 2026 14:56
rpcens() no longer warns before erroring on out-of-bounds inputs,
so remove the expect_warning wrapper from the out-of-bounds test.
seabbs
seabbs previously approved these changes Apr 8, 2026
Copy link
Copy Markdown
Contributor

@seabbs seabbs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me but is only a patch fix so we should go on to add support for left truncation for users.

Add explicit return() calls, rename q/ecdf variables to avoid
shadowing base exports, fix implicit assignment in suppressMessages,
and fix line length issues.
@seabbs seabbs enabled auto-merge (squash) April 8, 2026 15:17
@seabbs seabbs merged commit 3d6ee3e into epinowcast:main Apr 8, 2026
10 of 11 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.

Update for primarycensored L parameter (left truncation support)

2 participants