Repository navigation
Write initialization guesses through array slice indices - #5143
Merged
ChrisRackauckas merged 2 commits intoOct 16, 2026
Merged
ChrisRackauckas merged 2 commits into
ChrisRackauckas merged 2 commits into
Conversation
Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Codex <[email protected]> Agent-Harness: Codex CLI 0.154.0 Agent-Model: gpt-6-astra Agent-Session: local session ID 01a099aa-308a-7fd3-91bd-9fb2dc357b91
ChrisRackauckas
marked this pull request as ready for review
October 16, 2026 11:34
ChrisRackauckas
referenced
this pull request
Oct 17, 2026
…5284) Bump versions: ModelingToolkitBase 1.77.5, ModelingToolkit 11.45.5 Co-Authored-By: Chris Rackauckas <[email protected]> Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Agent-Harness: Claude Code 2.1.302 Agent-Model: claude-sonnet-5-5 Claude-Session: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq
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.
Initialization guess writes to array slices currently fail because
write_possibly_indexed_array!assumes every indexed variable has a scalar stable index. Assign array-valued guesses through the slice's original indices while retaining the scalar path. Existing parent entries remain intact outside the slice, and numeric versus symbolic values retain the atomic map's existing representation.This is an additional upstream prerequisite for SciML/MethodOfLines.jl#695, reached after fixing derivative naming of interior slices in JuliaSymbolics/Symbolics.jl#1986. It is separate from shaped default derivative guesses in #5132 and the DAE array-unknown constructor work.
Regression evidence
The same regression was run against unmodified master
21814d32cand after applying the helper change:TMPDIR="$PWD/tmp" julia +1.12 --compiled-modules=existing --project=array_slice_guess_env array-slice-guess-regression.jlBefore:
After:
The scratch script contains the same testset added to the official
variable_utils.jl. It covers stepped vector slices and matrix slices, numeric and symbolic replacement arrays, and empty and populated parent maps.Validation
GROUP=InterfaceII julia +1.12 --project=array_slice_guess_env -e 'using Pkg; Pkg.test("ModelingToolkitBase")': 7462 passed, 2 pre-existing broken; exit 0. The official Variable Utils testset passes 165/165, including all 16 added assertions.@matchcodegen #5063. The same reports reproduce on clean master. No QA assertion was changed.git diff --check: pass.No public API, dependency, or documentation changes. GPU and other downstream suites were not run locally.
Please ignore this draft until reviewed by @ChrisRackauckas.
🤖 Generated with Codex CLI 0.154.0 (model: gpt-6-astra; local session ID: 01a099aa-308a-7fd3-91bd-9fb2dc357b91).
Risk assessment (independent review, Claude Code 2.1.301 claude-opus-5-5, reviewed head 572a04b)
write_possibly_indexed_array!(lib/ModelingToolkitBase/src/atomic_array_dict.jl). Only keys withndims(k) > 0take the new branch, and every such key used to throw inget_stable_index. Scalar-index writes run the same code as before. No public API, dependency or version change.test/variable_utils.jl) with Julia 1.12.7. On the PR's MTKBase (head 572a04b) it passed 16/16. On current master's MTKBase (5abac29) it hit 4/4 errors:ArgumentError: Invalid variable a[2:2:4] for get_stable_indexandInvalid variable a[1:2, 2:3]. So the test fails without the fix and passes with it.scripts/t5143.jl) against the PR:m[1, 2:3], anda[:].D(x[2:3])gives a BoundsError, and writing a scalar into a slice gives an ArgumentError. Both threw before the PR too, so neither is a regression.variable_parsing.jl:66with "Variable x must have default of matching size" (job). That is the Symbolics#2041 breakage that fix: array variable defaults in variable_parsing for Symbolics#2041 #5247 fixes.buildfails withUndefVarError: ModelingToolkit not defined. Master shows the identical error (master run).🤖 Posted by an AI agent — harness: Claude Code 2.1.301 · model: claude-opus-5-5 (independent reviewer; appended by Claude Code 2.1.301 · claude-opus-5-5)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq