Skip to content

Conversation

@ChrisRackauckas
Copy link
Member

Summary

Fixed UndefVarError: kp1 not defined in BNG Birth-Death Test by resolving a world age issue when accessing parameter variables from a dynamically created module.

Changes Made

  • Modified exprs_to_defs() function signature to accept parameters as a direct argument
  • Replaced getproperty(opmod, psym) with direct parameter lookup using a mapping dictionary
  • Updated the function call in loadrxnetwork() to pass the parameters argument

Root Cause

The error occurred because the code tried to access parameter variables from a dynamically created module using getproperty(opmod, psym), but there was a world age mismatch preventing access to the newly defined variables in the module.

Solution

Instead of trying to retrieve parameters from the module, we now pass the already-created parameter variables directly to the function and use a simple dictionary lookup: psym_to_pvar = Dict(nameof(p) => p for p in ps).

Test Results

  • ✅ BNG Birth-Death Test now passes
  • ✅ All existing tests continue to pass
  • ✅ Code formatted with JuliaFormatter

Test Plan

  • Run specific failing test (test_nullrxs_odes.jl)
  • Run full test suite to ensure no regressions
  • Format code with JuliaFormatter

🤖 Generated with Claude Code

Fixed UndefVarError: `kp1` not defined by avoiding world age issue
when accessing parameter variables from dynamically created module.

- Modified exprs_to_defs() to accept parameters as direct argument
- Replaced getproperty(opmod, psym) with direct parameter lookup
- Updated function call in loadrxnetwork() to pass parameters

Fixes the failing BNG Birth-Death Test in test_nullrxs_odes.jl

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ChrisRackauckas ChrisRackauckas merged commit 1e32e02 into master Aug 2, 2025
11 checks passed
@ChrisRackauckas ChrisRackauckas deleted the fix-world-age-issue branch August 2, 2025 01:38
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.

3 participants