Repository navigation
The sympy.diff census guards the flux laws too - #832
Merged
Merged
Conversation
test_no_solver_differentiates_with_plain_sympy_diff (#830) scans petsc_generic_snes_solvers.pyx and systems/*.py. It does not scan constitutive_models.py, which is where its own stated risk is authored: the docstring says a plain sympy.diff site "would pass every other test here until a law put an Abs or a sign of a field in its flux", and a law is written in constitutive_models.py, not in the solvers. Nothing is wrong today -- that file has no sympy.diff( or sympy.derive_by_array( call, only three comments that mention the name without a paren, which the census already discriminates correctly. The gap is that tomorrow's law is unguarded. Shown to fail: appending a commented-out `sympy.diff(_probe, _probe)` call to constitutive_models.py turns the test red, and it is green again once removed. Underworld development team with AI support from Claude Code
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The functional change is correct; the only finding is a non-blocking grammatical issue.
1 open finding
What changed in this PR
Extends the derivative-source census to cover constitutive flux laws.
Changes:
- Adds
constitutive_models.pyto the forbidden plain-SymPy derivative scan.
| File | Description |
|---|---|
tests/test_0023_field_realness_and_derivatives.py |
Expands source coverage for the derivative census. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
| every other test here until a law put an Abs or a sign of a field in its flux.""" | ||
| src = pathlib.Path(__file__).parents[1] / "src" / "underworld3" | ||
| sources = [src / "cython" / "petsc_generic_snes_solvers.pyx", | ||
| # The flux laws, which is where this test's own stated risk gets |
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.

A one-line follow-up to #830, from reviewing it after merge.
test_no_solver_differentiates_with_plain_sympy_diffscanspetsc_generic_snes_solvers.pyxandsystems/*.py. It does not scanconstitutive_models.py— which is where its own stated risk gets written. Its docstring:A law is authored in
constitutive_models.py. The census did not look there.Nothing is wrong today. That file has no
sympy.diff(orsympy.derive_by_array(call — only three comments mentioning the name without a following paren, which the census already discriminates correctly (it matches on the paren, which is why the seven comment mentions across the tree do not trip it). The gap is prospective: the next flux law is unguarded.Shown to fail, since a census that cannot fail is not a census:
Green again once removed. Note the planted line is itself a comment — it trips the test because it contains
sympy.diff(with the paren, which is the right sensitivity for a source census and worth knowing if someone later writes that string in prose.Underworld development team with AI support from Claude Code