Skip to content

Fix include paths with spaces and resolve them at model creation - #1226

Merged
jgabry merged 6 commits into
masterfrom
bugfix-issue-820
Jul 25, 2026
Merged

Fix include paths with spaces and resolve them at model creation#1226
jgabry merged 6 commits into
masterfrom
bugfix-issue-820

Conversation

@jgabry

@jgabry jgabry commented Jul 24, 2026

Copy link
Copy Markdown
Member

Submission Checklist

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

Summary

Fixes #820: include directories containing spaces
Fixes #1229: Paths are now resolved where they are stored, via a shared resolve_path() helper that is also used for stan_file_ and exe_file_, which were already stored absolute.

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

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

@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.92%. Comparing base (6508f55) to head (de41f16).
⚠️ Report is 7 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1226      +/-   ##
==========================================
+ Coverage   91.88%   91.92%   +0.04%     
==========================================
  Files          15       15              
  Lines        6244     6267      +23     
==========================================
+ Hits         5737     5761      +24     
+ Misses        507      506       -1     

☔ View full report in Codecov by Harness.
📢 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.

The expected value comes from withr::local_tempdir(), which uses backslashes
on Windows and can contain a doubled slash on macOS, while $include_paths()
comes from dirname(). Repair both sides before comparing.
@jgabry jgabry changed the title Fix include paths with spaces in direct stanc calls Fix include paths with spaces and resolve them at model creation Jul 25, 2026
jgabry added 2 commits July 25, 2026 10:57
Include paths were stored exactly as supplied and resolved to absolute paths
only when stanc was called, so resolution depended on the working directory at
that later point. A model created from a relative stan_file stored "." as its
inferred include path, and assert_dir_exists(".") can never fail, so a change
of working directory either produced a confusing stanc error or silently
resolved #include directives against a same-named file in the new directory.

Paths are now resolved where they are stored, using a shared resolve_path()
helper that also replaces the equivalent inline expressions for stan_file_ and
exe_file_. $include_paths() returns absolute paths.
The existing tests cover an inferred relative path and explicit paths that are
already absolute, so the explicit and $compile() resolution points had no test
that would fail if their paths were left unresolved.
@jgabry
jgabry force-pushed the bugfix-issue-820 branch from 8a322fb to de41f16 Compare July 25, 2026 17:50
@jgabry
jgabry merged commit 9efd39a into master Jul 25, 2026
16 of 30 checks passed
@jgabry
jgabry deleted the bugfix-issue-820 branch July 25, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants