Skip to content

Analyser/Generator: various issues with a variable initialised by another variable - #1489

Open
agarny wants to merge 7 commits into
cellml:mainfrom
agarny:issue1487
Open

agarny wants to merge 7 commits into
cellml:mainfrom
agarny:issue1487

Conversation

@agarny

@agarny agarny commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #1487.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 23:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The NLA validation can falsely classify a globally square system as underconstrained.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Fixes analyser and generator handling of variables initialised from other variables.

Changes:

  • Corrects unit scaling and computed-constant initialisation ordering.
  • Detects cyclic or invalid initialisation dependencies.
  • Adds diagnostics, bindings, generated fixtures, and regression tests.
File Description
src/​analyser.cpp Adds dependency-cycle and NLA validation.
src/​analyser_p.h Declares dependency helpers.
src/​generator.cpp Fixes scaling and generation ordering.
src/​generator_p.h Updates generator helper interfaces.
src/​issue.cpp Registers the new diagnostic rule.
src/​api/​libcellml/​issue.h Adds the public reference rule.
src/​bindings/​python/​__init__.py Exposes the Python enum value.
src/​bindings/​javascript/​issue.cpp Exposes the JavaScript enum value.
tests/​analyser/​analyser.cpp Tests new analyser diagnostics.
tests/​bindings/​python/​test_issue.py Tests the Python binding.
tests/​generator/​generator.cpp Tests computed-constant initialisation.
tests/​generator/​generatorvariabletracker.cpp Tests untracked-variable generation.
tests/​resources/​analyser/​nla_systems_sharing_initialised_variable.cellml Covers shared NLA unknowns.
tests/​resources/​analyser/​variable_initialised_using_itself.cellml Covers cyclic initialisation.
tests/​resources/​analyser/​variable_initialised_using_nla_based_algebraic_variable.cellml Covers invalid algebraic initialisation.
tests/​resources/​generator/​cellml_unit_scaling_constant/​model.c Updates expected C scaling.
tests/​resources/​generator/​cellml_unit_scaling_constant/​model.py Updates expected Python scaling.
tests/​resources/​generator/​constant_initialised_using_computed_constant/​model.cellml Defines ordering regression model.
tests/​resources/​generator/​constant_initialised_using_computed_constant/​model.c Provides expected C output.
tests/​resources/​generator/​constant_initialised_using_computed_constant/​model.h Provides expected C interface.
tests/​resources/​generator/​constant_initialised_using_computed_constant/​model.py Provides expected Python output.
tests/​resources/​generator/​variable_initialised_using_untracked_variable/​model.cellml Defines untracked-variable model.
tests/​resources/​generator/​variable_initialised_using_untracked_variable/​model.c Provides expected C output.
tests/​resources/​generator/​variable_initialised_using_untracked_variable/​model.h Provides expected C interface.
tests/​resources/​generator/​variable_initialised_using_untracked_variable/​model.py Provides expected Python output.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/analyser.cpp Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

NLA-system grouping and overconstraint detection remain incorrect, and case 3 is rejected instead of implementing the linked issue’s expected behavior.

Review effort: Balanced
Findings: 3 Medium severity

Open (3)
Resolved since last review (1)

Comment thread src/analyser.cpp Resolved
Comment thread src/analyser.cpp Resolved
Comment thread tests/analyser/analyser.cpp Resolved
@agarny
agarny requested a balanced review from Copilot October 6, 2026 00:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Analyser/Generator: various issues with a variable initialised by another variable

2 participants