Skip to content

Make get_cmdstan_flags() robust to noisy make output#1163

Open
jgabry wants to merge 1 commit intomasterfrom
fix-1162-stancflags-make-output
Open

Make get_cmdstan_flags() robust to noisy make output#1163
jgabry wants to merge 1 commit intomasterfrom
fix-1162-stancflags-make-output

Conversation

@jgabry
Copy link
Member

@jgabry jgabry commented Mar 21, 2026

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

Fixes #1162

Parse make print-<FLAG> output line-by-line so cmdstanr ignores unrelated make chatter such as directory-entering messages triggered by MAKEFLAGS=-w. This fixes a failure where get_cmdstan_flags("STANCFLAGS") could return junk tokens, which then caused cmdstan_model() to error when checking local stanc flags.

Also:

  • return character(0) for empty STANCFLAGS
  • use a length-safe check when combining local stanc flags

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Jonah Gabry (codex assisted with debugging, writing test code, and writing the PR summary)

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

Fixes #1162

Parse `make print-<FLAG>` output line-by-line so cmdstanr ignores unrelated `make` chatter such as directory-entering messages triggered by `MAKEFLAGS=-w`.

This fixes a failure where `get_cmdstan_flags("STANCFLAGS")` could return junk tokens, which then caused `cmdstan_model()` to error when checking local stanc flags.

Also:
  - return `character(0)` for empty `STANCFLAGS`
  - use a length-safe check when combining local stanc flags
  - add regression tests for noisy make output, realistic continued `STANCFLAGS`, and the reported `MAKEFLAGS="-w -j 4"` case
@jgabry jgabry added this to the v1.0.0 - release milestone Mar 21, 2026
@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 81.81818% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.85%. Comparing base (418b1c5) to head (8b92b81).

Files with missing lines Patch % Lines
R/utils.R 83.33% 5 Missing ⚠️
R/cpp_opts.R 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1163      +/-   ##
==========================================
- Coverage   90.85%   90.85%   -0.01%     
==========================================
  Files          14       14              
  Lines        5908     5924      +16     
==========================================
+ Hits         5368     5382      +14     
- Misses        540      542       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

cmdstan_model() fails when MAKEFLAGS includes -w

2 participants