Repository navigation
Make linear_compartment_model ODE print order deterministic - #566
Merged
pogudingleb merged 2 commits intoOct 1, 2026
Merged
pogudingleb merged 2 commits into
pogudingleb merged 2 commits into
Conversation
Pass explicit x_vars/y_vars into the 5-arg ODE constructor so show order follows compartment indices instead of Dict iteration order across Julia versions. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/StructuralIdentifiability.jl/jobs/559-cursor/log.txt on amdci2.julia.csail.mit.edu
Asserts x_vars are x1..xn and show output is in that order. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent CLI 2026.09.28-64d2043 Agent-Model: auto Agent-Session: local session, transcript at /home/crackauc/sandbox/goals/issue-backlog/ibd/StructuralIdentifiability.jl/jobs/559-cursor/log.txt on amdci2.julia.csail.mit.edu
pogudingleb
marked this pull request as ready for review
October 1, 2026 19:30
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ignore until reviewed by @ChrisRackauckas.
Summary
linear_compartment_modelwas building anODEvia the 3-arg constructor, which setsx_vars/y_varsfromDictkey order.show(::ODE)already iteratesx_vars, so the printed (and doctest-pinned) equation order reshuffled across Julia versions. This passes the already-built orderedx_vars/y_varsinto the 5-arg constructor and re-pins the lincomp doctest to compartment index order (x1…x4).Fail before / pass after
Negative control (src reverted to master, same order assertions):
After the fix (3 fresh Julia processes):
test/bodies/linear_compartment.jlwith fix: 12/12 (master baseline was 8/8; +4 order assertions):Doctest expected text matches
sprint(show, ode)(DOCTEST_MATCHon Julia 1.12.7).Commands run
julia +1.12 --project=. scratch/check_order.jl(before, negative control, 3× after)julia +1.12 --project=. -e '… include(\"test/bodies/linear_compartment.jl\")'(master baseline 8/8; with fix 12/12)--check src/lincomp.jl test/bodies/linear_compartment.jl(exit 0)typos src/lincomp.jl test/bodies/linear_compartment.jl(exit 0)Not verified
Pkg.test()/ docs Documenter doctest CI job on Julia 1.13ODEconstructor (still Dict-order forx_vars)Reviewer pushback
ODEconstructor instead of only fixinglinear_compartment_modelcollect(x_vars)vsArray{…}(x_vars)styleFixes #559
Please ignore this draft until reviewed by @ChrisRackauckas.
Risk assessment
Risk: low
Blast radius:
linear_compartment_modelreturn value'sx_vars/y_varsorder and printed equation order only; identifiability results unchanged (existing 8 cases still pass).Evidence: fail-before / pass-after order assertions; linear_compartment body 8→12; doctest text match; Runic/typos clean.
Independent review: Claude Code (Opus 5.5) rated it low, high confidence: order assertions fail on master in 6/6 fresh processes (session-dependent order, e.g. x1,x3,x2,x4) and pass on the PR in 4/4; doctest equals sprint(show) byte-for-byte; assess_identifiability identical on master and PR for a 2-compartment model and the test file's 10 result assertions pass on both; the 5-arg ODE constructor receives exactly the dict keys. Follow-up (not in this PR): other 3-arg
ODE{P}(x_eqs, y_eqs, inputs)call sites inherit Dict order the same way (src/ODE.jl:53-54 root cause; src/ODE.jl:114, src/parametrizations.jl:246).Merge: needs human review (StructuralIdentifiability is excluded from auto-merge).
Harness: Cursor Agent CLI 2026.09.28-64d2043; model: auto; transcript: /home/crackauc/sandbox/goals/issue-backlog/ibd/StructuralIdentifiability.jl/jobs/559-cursor/log.txt on amdci2.julia.csail.mit.edu