Repository navigation
Handle array symbols in symbolic remake - #1602
ChrisRackauckas merged 1 commit into
Conversation
|
Validation of this PR against a real ModelingToolkit array-unknown problem (
The last row also fails on an independent branch with a different fix for the same bug, so it looks separate from this PR; I did not check plain master. Two further regression tests, written for that independent branch, also pass against this PR: a fake symbolic container whose array unknown has a range 🤖 Posted by an AI agent · harness: Claude Code 2.1.310 · model: claude-sonnet-5-5 |
Expand array parents locally when mapping flat state and parameter indices. Preserve explicit scalar defaults without mutating caller dictionaries. 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
68a5669 to
799f257
Compare
Symbolic
remakenow handles providers that enumerate whole-array variables or parameters while mapping their elements to flat numerical indices. Previouslyfill_varsmapped the array index range to its parent symbol, then looked up individual indices and raisedKeyError: key 1 not found. The fix expands symbols locally, preserves parent and scalar defaults, and copies the defaults dictionary before expansion.This is a prerequisite found while implementing array DAE unknowns for SciML/MethodOfLines.jl#695. Public symbol enumeration is unchanged; no dependencies or public API are added.
Regression evidence
The official
SII_Remakegroup was run with the new vector/matrix regression on clean upstream source and again with the fix:Before (both array cases error before their assertions):
After, with the byte-identical test file:
The isolated array regression passed 26/26.
The cases cover variable and parameter arrays, vector and matrix shapes, parent and indexed keys, array name aliases, partial updates, sibling scalar values, default precedence, and nonmutation of caller defaults.
Validation
Runic confirmed both changed files already formatted. Typos over the diff and
git diff --checkpassed.Full QA passed with the system Python interpreter (the first attempt failed during Conda Python provisioning, before QA completed):
No tests or assertions were disabled. An integration check with local ModelingToolkit array DAE support also passed 24/24 checks, covering initialization, a DFBDF solve, shape-preserving indexing, and symbolic remake.
A second integration run with the completed local ModelingToolkit constructor stack passed on Julia 1.10.12 and the minimum CI dependencies (Symbolics 7.37.0, SymbolicUtils 4.37.0, SymbolicIndexingInterface 0.3.46, NonlinearSolveBase 2.49.4). Only the MTKBase and SciMLBase source paths changed from the copied minimum-dependency manifest:
TMPDIR="$PWD/tmp" JULIA_PKG_PRECOMPILE_AUTO=0 julia +1.10.12 --project=array_constructors_downgrade_env array_constructors_downgrade_tests.jlThe driver uses the official
SafeTestsetsisolation for these three unchanged test files:The constructor stack includes a separate MTK integer-index bound correction exposed by older SII; that correction is not part of this SciMLBase diff. Julia emitted the previously identified Moshi precompilation warning and continued loading; the test process completed with exit 0.
No docs or public API changed. GPU, the full downstream matrix, and prerelease Julia jobs were not run locally. Focused downstream controls are documented below.
Downstream failure investigation
Three downstream failures have independent baseline evidence; no tests were disabled or weakened to hide them.
SciMLSensitivity Core8: the unchanged official
test/Core8/desauty_dae_mwe.jlfails identically on clean SciMLBase base source and this feature. Both use Julia 1.13.0, SciMLSensitivitya5a9b938aeca1eab8009fd35ec33bfea40656f33, ModelingToolkit 11.43.1, ModelingToolkitBase 1.71.1, NonlinearSolve 4.28.0, NonlinearSolveBase 2.49.5, and Enzyme 0.13.203; the manifests differ only in the SciMLBase source path. The sole error isEnzymeNoTypeErrorthroughCacheWriter{Any}during SCC initialization. A separate reduced parent/commit comparison identifies ModelingToolkit's initialization change: its immediate parent passes 2/2, and that commit errors. The reproducer and introduction boundary are tracked in Enzyme SCC initialization regresses at concretize_initializeprob on Julia 1.13 ModelingToolkit.jl#5140. No production fix is claimed here.Exact local commands (the first pins NonlinearSolve to the CI version):
The five broken tests are pre-existing in the unchanged upstream file.
SciMLSensitivity Core1: the same LLVM 20
ClobberWalker/getMatchingValue/loadCSEcrash occurs in the clean-base job and feature job. The standalone LLVM IR already published in Runtime loop unrolling hits a MemorySSA assertion llvm/llvm-project#222852 independently segfaults locally with Julia 1.13's LLVM 20 (exit 139), while LLVM 18 passes; its backtrace matches the leading CI frames. Julia 1.13: segfault in LLVM 20 loop unrolling on!invariant.groupcache loads (tracks llvm/llvm-project#222852) EnzymeAD/Enzyme.jl#3568 tracks that defect. The exact solver-specific crash did not reproduce locally: the unchanged clean-base test prefix through the failing CI assertion passes 1/1 with matching package versions and coverage/check-bounds enabled. No monotonic SciMLBase source regression was established.Catalyst ReleaseTest: both the clean-base job and feature job fail when the registered package's tests try to write
test/extensions/Project.tomlinside its read-only installed source. This was reproduced independently and is tracked with a reproducer in Extension test environment setup writes read-only installed Project.toml on Julia 1.13 Catalyst.jl#1561.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
remake(prob; u0 = [sym => val], p = [...])goes throughfill_vars([remake_pr1602.jl:1827-1894](/remake_pr1602.jl)). That covers MTK, Catalyst, MethodOfLines and any direct SIISymbolCacheuser. The new branch only runs for symbols that areArraySymbolic()and whosevariable_index/parameter_indexis anAbstractArray. In that case the array is split into its elements, and the parent's default is copied down to elements that have no default of their own. MTK's usualParameterIndexpath and scalarized unknowns don't reach the new code. A GitHub code search across the SciML org found no calls tofill_vars/fill_u0/fill_poutside SciMLBase's own tests. The API is internal and there is no SemVer impact. Edge cases the tests don't cover:zip(sym, defval)silently truncates if an array symbol's default is a scalar or has the wrong shape.fill_varsnow returns element keys instead of the parent key.defsis copied once per array symbol that has a default. This costs a little performance on systems with many array parameters.bd19191(CI ran 2026-09-13). All 3 are pre-existing: each fails on all 6 recent master commits (83b4fc3,9cfd9e6,d57a756,4fa7f7f,b7076b5,7013302), and I confirmed the matching log signatures on head and on83b4fc3.SciMLSensitivity.jl/Core8: sameEnzymeNoTypeErroron head and master. It did pass on the PR's merge base573bc6c, so it started failing on master after the branch point. The PR attributes that to an MTK change (tracked in MTK issue 5140).SciMLSensitivity.jl/Core1: same LLVM 20ClobberWalker/getMatchingValuesegfault on head, master and the merge base.Catalyst/All/1: sameSystemError ... Catalyst/tAUzg/test/extensions/Project.toml: Permission deniedon head and master.Catalyst.jl/Allpasses on head.src/remake.jlchanges since the merge base don't touchfill_vars(they touch the function-remake type-erasure code,SteadyStateProblem'slowered_problem, and the SCC eltype), and GitHub reports the PR as MERGEABLE.symbolic_type,ArraySymbolic) plus the localvarmap_get, so no non-public dependency internals.KeyError, it has before/after regression evidence, and every failing check fails identically on current master.zipwould silently truncate.ChrisRackauckas-Claudeaccount, and it lacks the standard UNREVIEWED banner.🤖 Risk assessment posted by an AI agent (fleet master) — harness: Devin CLI / fusion-claude-opus-5-5-high-sidekick-swe-2-medium; dispatched by Claude Code head, model claude-opus-5-5[1m]
Conversation: local Claude Code session 3cd6500a-1f81-46b5-ac0b-c466e15b6a53 (session ID, no URL)
Risk assessment (independent review, Codex Desktop (Codex core 0.164.0-alpha.11.1) gpt-6.1-sol, slot 1, head 68a5669)
Review round 1, written by the reviewer named above (Codex Desktop (Codex core 0.164.0-alpha.11.1) / gpt-6.1-sol) in a session other than the PR author's, and copied here by the posting agent without change to its findings. The posting agent did not re-run the reviewer's commands.
Summary: Expands array symbols to scalar components during symbolic remake and preserves scalar/default precedence without mutating the provider defaults. Vector and matrix regression cases fail on base and pass 26 assertions at the reviewed head.
Blast radius: Symbolic remake of initial states and parameters supplied by unscalarized array-symbol providers.
Evidence: The test covers whole arrays by parent and alias, scalar element updates, untouched values, use_defaults, explicit scalar-default precedence and source-dictionary preservation. Local base errors with KeyError: key 1 not found for both shapes. The same SII downstream failure sites and counts (comprehensive_indexing.jl:127 and :164, 3747 pass/2 error) occur in the sampled default run; this does not establish equivalence of every other failed check.
Blocking findings
None.
Non-blocking findings
None.
What I ran
HEADwas verified equal to68a5669b57700624f8a314f301740faba36ef4c5.git diff --checkexited 0. The diff was compared to the recorded live base through its merge base, not directly against unrelated base-only commits. Root/nested agent instructions and surrounding changed-code callers were inspected. Author metadata above is from the newest non-merge commit only; absent trailers are intentionallyunknown.Local Julia processes ran sequentially with
JULIA_NUM_THREADS=4,OPENBLAS_NUM_THREADS=1, an isolated temporary directory and a task-owned first depot (existing global depot read as a fallback). Commands usedjulia --startup-file=no --compiled-modules=no --project=<isolated-environment>afterPkg.developselected the exact checkout. Focused tests were extracted unchanged from the named committed testset except for explicitly described reviewer probes; full Pkg.test was not run. Machine-specific scratch paths are omitted to follow the review-file rule.Local head, Julia 1.13.0, exit 0:
Local base, Julia 1.13.0, exit 1:
Focused input:
RemakeArraySymbol/RemakeArraySystemand the testsetremake with unscalarized array symbolsfromtest/remake_tests.jl.CI inspection:
gh run view <run-id> --repo SciML/SciMLBase.jl --log-failed, and for selected green jobsgh run view <run-id> --job <job-id> --repo SciML/SciMLBase.jl --log. Default-branch samples usedgh run list --repo SciML/SciMLBase.jl --branch master --event push --limit 5 --json databaseId,conclusion,headSha,url,name; completed failing runs were read rather than assuming equivalence from status alone.67 checks successful/skipped/neutral; 6 checks failed/cancelled/pending at the captured snapshot. These counts include external status checks.
Sampled current default-branch runs (status alone is not used to waive failures):
What I did not verify
No local full SII_Remake/ModelingToolkit/MethodOfLines integration, AD suite, or performance benchmark. The new Any[] normalization adds work to every fill_vars call; scaling was not benchmarked.
This review continues the interrupted Codex session 01a18dad-6f75-7ae1-b6dc-3a84553833ec, retaining its exact-head checkouts, CI logs and sequential test evidence. The continuation session is 01a18db8-25fc-7b72-9d35-a1341e0ae484. Initial risk ratings were saved before author descriptions; those descriptions contained embedded earlier reviews, so complete prior-review blindness was not maintained. The initial findings were frozen before the explicit same-head review comparison; additional corroboration is identified as post-freeze. This limitation is disclosed rather than claiming full blind-first compliance.
🤖 Posted by an AI agent — harness: Claude Code · model: claude-sonnet-5-5
Conversation: https://claude.ai/code/session_01379heiiB35TtywhR7uSU74