Document the dependencies cmdstanr does not track
Part of the design described in #1254. I asked Claude to write the text below based on that.
The build record (#1238) tracks the Stan program, its includes, the user header, make/local and the CmdStan installation. What it leaves untracked is #1254 §6 ("Provenance we cannot complete" and "What no record can fix"): toolchain drift, compiler include-path environment variables, Make variables set in the environment, CmdStan or Stan Math modified in place, a make/local that includes another makefile, and headers the user header includes. force_recompile = TRUE is the remedy for every one of them, and nobody reaches for it without being told.
Checklist
Stage 3 (#1258)
Stage 4
Compiler depfiles: the right mechanism, not in v1
Measured against CmdStan 2.39. CmdStan does not supply a depfile for models: make/program:106-108 sets up -include for one and :68 has a %.d: %.hpp rule, but the model's .hpp is an intermediate CmdStan deletes after linking, so make <model>.d gives No rule to make target.
cmdstanr could produce one itself:
c++ -std=c++17 <cmdstan -D flags> -MM -MG -MP -MF out.d user_header.hpp
About 150 ms warm. -MG makes it self-scoping: real paths are the user's files, <stan/math.hpp> and friends come back as bare names to discard. It would also close the angle-bracket blind spot. Costs: user -I flags must be forwarded or the closure is silently incomplete, an #ifdef on a macro defined inside stan/math evaluates differently during the scan, and .d parsing wants its own tests.
Not in v1 because it couples record validation to compiler flag construction, which can drift quietly, and puts a compiler invocation on a path that today only reads files and runs stanc. A release that adds it decides then whether records written before it still justify reuse.
Also worth documenting
Options that need CmdStan itself rebuilt are not an issue. CmdStan selects flag-specific main objects and precompiled headers by filename (makefile:97-118, :135, make/program:8), so flipping STAN_THREADS, STAN_MPI, STAN_OPENCL or STAN_NO_RANGE_CHECKS builds the right objects on demand.
Document the dependencies cmdstanr does not track
Part of the design described in #1254. I asked Claude to write the text below based on that.
The build record (#1238) tracks the Stan program, its includes, the user header,
make/localand the CmdStan installation. What it leaves untracked is #1254 §6 ("Provenance we cannot complete" and "What no record can fix"): toolchain drift, compiler include-path environment variables, Make variables set in the environment, CmdStan or Stan Math modified in place, amake/localthat includes another makefile, and headers the user header includes.force_recompile = TRUEis the remedy for every one of them, and nobody reaches for it without being told.Checklist
Stage 3 (#1258)
^\s*(?:-?include|sinclude)\bonmake/local,^\s*#\s*include\s*"on the user header. They establish that a gap exists, never that none does, which is why the field isknown_untracked_dependenciesand notprovenance_complete(Design note: v1.0 compilation state and C++ options #1254 §6, "Provenance we cannot complete")Stage 4
-Iis what makes#include <helpers.hpp>work, and the regex is not widened to[<"]because it would fire on<vector>Compiler depfiles: the right mechanism, not in v1
Measured against CmdStan 2.39. CmdStan does not supply a depfile for models:
make/program:106-108sets up-includefor one and:68has a%.d: %.hpprule, but the model's.hppis an intermediate CmdStan deletes after linking, somake <model>.dgivesNo rule to make target.cmdstanr could produce one itself:
About 150 ms warm.
-MGmakes it self-scoping: real paths are the user's files,<stan/math.hpp>and friends come back as bare names to discard. It would also close the angle-bracket blind spot. Costs: user-Iflags must be forwarded or the closure is silently incomplete, an#ifdefon a macro defined inside stan/math evaluates differently during the scan, and.dparsing wants its own tests.Not in v1 because it couples record validation to compiler flag construction, which can drift quietly, and puts a compiler invocation on a path that today only reads files and runs stanc. A release that adds it decides then whether records written before it still justify reuse.
Also worth documenting
Options that need CmdStan itself rebuilt are not an issue. CmdStan selects flag-specific main objects and precompiled headers by filename (
makefile:97-118,:135,make/program:8), so flippingSTAN_THREADS,STAN_MPI,STAN_OPENCLorSTAN_NO_RANGE_CHECKSbuilds the right objects on demand.