Skip to content

Kill ambient LIBNEO_* env footgun; use LIBNEO_REF cache var only#392

Merged
krystophny merged 7 commits into
mainfrom
ci/libneo-ref-explicit
Jun 15, 2026
Merged

Kill ambient LIBNEO_* env footgun; use LIBNEO_REF cache var only#392
krystophny merged 7 commits into
mainfrom
ci/libneo-ref-explicit

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

  • cmake/Util.cmake: drop $ENV{LIBNEO_BRANCH} read; rename LIBNEO_BRANCH cache var to LIBNEO_REF. The only way to override which libneo ref is fetched is -DLIBNEO_REF=<branch|tag|sha>. When unset, the existing get_branch_or_main default applies unchanged.
  • Makefile: unexport LIBNEO_REF LIBNEO_PATH LIBNEO_BRANCH to stop make from auto-importing them from the shell. Forwards to cmake only when passed explicitly on the make command line via $(origin) check. LIBNEO_PATH=<dir> maps to -DLIBNEO_SOURCE_DIR=<dir>.
  • .github/workflows/main.yml: remove top-level env: LIBNEO_BRANCH: block. Pass LIBNEO_REF explicitly as a make command-line variable in both the test and cgal-wall jobs, only when inputs.libneo_ref is non-empty.
  • README.md: document make LIBNEO_REF= / -DLIBNEO_REF= and the local-checkout equivalent.

Verification

$ENV{LIBNEO_BRANCH} is gone:

$ rg -i '\$ENV\{LIBNEO' cmake/Util.cmake
(no output)

Ambient env is ignored by cmake:

$ LIBNEO_REF=should-not-appear cmake -S . -B /tmp/t -GNinja ...
# falls back to main via get_branch_or_main; "should-not-appear" never appears

Ambient env is ignored by make (env import blocked; command-line value forwarded):

$ LIBNEO_REF=should-not-leak make -n configure BUILD_DIR=/tmp/t
cmake -S . -B/tmp/t -GNinja ... -DCMAKE_COLOR_DIAGNOSTICS=ON
# no -DLIBNEO_REF in output

$ make -n configure BUILD_DIR=/tmp/t LIBNEO_REF=my-branch
cmake -S . -B/tmp/t -GNinja ... -DCMAKE_COLOR_DIAGNOSTICS=ON -DLIBNEO_REF=my-branch

Explicit cache var is honored:

$ cmake -DLIBNEO_REF=main -S . -B /tmp/t -GNinja ...
# no "not found" warning; fetches main

Workflow env: LIBNEO_BRANCH: block is gone; inputs.libneo_ref is forwarded as LIBNEO_REF= on the make command line only when set.

orbit_symplectic_quasi was the sole consumer of the vendored MINPACK
hybrd1. Replace each of the eight hybrd1 calls with fortnum's
multiroot_hybrids (Newton step with a backtracking line search and a
finite-difference Jacobian), which provides the same warm-started,
Jacobian-free root solve the call sites relied on.

Each f_*_quasi residual now conforms to the multiroot_fn_t interface
(assumed-shape x/f, optional ctx, no iflag); state still travels through
the existing module globals f, fs, si. The f_midpoint_quasi double
field evaluation ordering (midpoint stage saved, then endpoint) is
preserved. xtol and ftol are both set to si%rtol to track the former
hybrd1 stopping behavior.

Wire fortnum via CMake FetchContent (GIT_TAG a7faa3c, guarded by
NOT TARGET fortnum) and link it into the simple library. Delete
src/contrib/minpack.f90, minpack_interfaces.f90, and LICENSE.minpack.
fortnum a7faa3c installed its C ABI header from CMAKE_SOURCE_DIR, which
resolves to the consumer tree under FetchContent and failed SIMPLE's
install step. fortnum main now sources the header from PROJECT_SOURCE_DIR
(9595e51); pin to the merge commit that carries the fix.
test_sympl_stell drives the quasi-symplectic steps (timestep_*_quasi),
the only code path that calls the root solver behind the quasi method
(fortnum multiroot_hybrids on this branch, MINPACK hybrd1 on main). The
quasi block sat behind an unconditional stop and the executable had no
add_test, so the solver swap ran zero times in the suite.

Remove the dead stop so the quasi integrators run, set coord_input and
field_input before init_field (now required since the reference-coordinate
init was added), and register test_sympl_stell as an integration test.

Verified on faepop31 deterministic-FP build: the quasi run calls
multiroot_hybrids 359952 times; the run completes in 72 s under ctest.
cmake/Util.cmake: drop $ENV{LIBNEO_BRANCH} read; rename LIBNEO_BRANCH
cache var to LIBNEO_REF. Only -DLIBNEO_REF=<branch|tag|sha> controls
which libneo is fetched. Unset -> existing get_branch_or_main default.

Makefile: unexport LIBNEO_REF LIBNEO_PATH LIBNEO_BRANCH to stop make
from auto-importing them from the shell. Forward to cmake only when
passed explicitly on the make command line ($(origin) == command line).
LIBNEO_PATH maps to -DLIBNEO_SOURCE_DIR for local-checkout overrides.

.github/workflows/main.yml: remove top-level env LIBNEO_BRANCH block.
Pass LIBNEO_REF=${{ inputs.libneo_ref }} explicitly on the make command
line in both the test and cgal-wall jobs, only when the input is set.

README.md: document -DLIBNEO_REF / make LIBNEO_REF= and the local-path
equivalent.
@krystophny krystophny enabled auto-merge (squash) June 15, 2026 21:30
@krystophny krystophny merged commit b3fe016 into main Jun 15, 2026
7 checks passed
@krystophny krystophny deleted the ci/libneo-ref-explicit branch June 15, 2026 21:52
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