Fix cross-case method contamination when running multiple cases in the same REPL#118
Open
slifer50 wants to merge 1 commit into
Open
Fix cross-case method contamination when running multiple cases in the same REPL#118slifer50 wants to merge 1 commit into
slifer50 wants to merge 1 commit into
Conversation
…e same REPL When a user runs case A then case B in the same Julia session, methods defined in A's user_source.jl/user_primitives.jl persist in the global method table and get called instead of B's methods, causing incorrect results silently. Two-part fix: 1. src/run.jl: Before reloading case files, explicitly delete all methods of user_flux!, user_source!, user_bc_dirichlet!, user_primitives!, user_uout!. These functions have no definitions in src/ — every method comes from a case file — so a full delete-then-reload is safe and sufficient. 2. 108 case files (user_source.jl, user_primitives.jl, user_bc.jl across all problem directories): Replace runtime ET == TOTAL() / ET == PERT() checks with proper ::TOTAL / ::PERT type dispatch, and remove ::TInt / ::Int64 type annotations on the npoin argument. This makes methods unambiguous when reloaded into a clean method table, and ensures Julia dispatches correctly without relying on stale method ordering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
user_source.jl/user_primitives.jl/user_bc.jlpersist in the global method table and silently override B's methods.src/run.jl: Before reloading case files, explicitly delete all methods ofuser_flux!,user_source!,user_bc_dirichlet!,user_primitives!,user_uout!. These functions have no definitions insrc/— every method comes from a case file — so a full delete-then-reload is safe.AdvDiff,Burgers,CompEuler,Elliptic,Helmholtz,ShallowWater,acoustics): replace runtimeET == TOTAL()/ET == PERT()checks with proper::TOTAL/::PERTtype dispatch, and remove::TInt/::Int64type annotations onnpoin. This makes methods unambiguous when reloaded and ensures correct dispatch without relying on stale method ordering.Test plan
theta) in a REPL session, then immediately run case B (e.g.3d) without restarting Julia — verify B uses its ownuser_source!and not A's🤖 Generated with Claude Code