Skip to content

Fix selective_delete! on arrays of structures; promote plain-float expression results in non-Float64 IDSs - #114

Merged
tomneiser merged 3 commits into
masterfrom
forward-ad-plasma
Nov 14, 2026
Merged

tomneiser merged 3 commits into
masterfrom
forward-ad-plasma

Conversation

@tomneiser

Copy link
Copy Markdown
Member

Two independent fixes. Both came out of running whole-plasma FUSE workflows on a dd whose element type is a ForwardDiff dual.

1. selective_delete! only processed the first element of an array of structures

The array method had return inside its for loop:

for k in 1:length(h_in)
    return selective_delete!(getindex(h_in, k), path[2:end])
end

so a path such as core_profiles.profiles_1d[:].ion[:].density was deleted on the first ion of the first time slice only. The method could also return nothing instead of a Bool.

Now every element is visited and the function returns true if anything was deleted, false otherwise. New test file test/runtests_selective_delete.jl (there was no test of this function).

Behaviour change downstream. The only caller I found is FUSE.restore_init_expressions!. With one time slice the difference is limited to the second and later ions or sources. With time-dependent input, every listed field is now turned back into an expression on every slice, as the caller intends. A companion FUSE change (same branch name, PR to follow) keeps a stored main-ion density and a stored ion rotation through that step; without it, time-dependent runs that replay rotation change. The two should be merged together.

2. Expressions returning plain floats in a non-Float64 IDS

An expression that returns a literal 0.0 or zeros(n) failed the return-type assertion when the IDS element type is not Float64 (dual numbers, measurements). Such results are now converted to the element type of the IDS. Float64 IDSs keep the strict check, so nothing changes for them.

Tests

Pkg.test() passes locally on Julia 1.11.7, including the new selective_delete! test (15 assertions) and the test added for the expression promotion.

🤖 Generated with Claude Code

tomneiser and others added 3 commits November 9, 2026 21:42
…loat64 IDSs

An expression that returns a literal 0.0 or zeros(n) failed the return-type
assertion in an IDS whose element type is not Float64 (dual numbers,
measurements). Float64 IDSs keep the strict check.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…not Float64

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The loop over an array of structures returned after its first element, so
only the first element was processed. All elements are now visited and the
function always returns a Bool (true if anything was deleted).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 44.02%. Comparing base (3574519) to head (50c3828).

Files with missing lines Patch % Lines
src/expressions.jl 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #114      +/-   ##
==========================================
+ Coverage   43.93%   44.02%   +0.08%     
==========================================
  Files          16       16              
  Lines       31551    31556       +5     
==========================================
+ Hits        13862    13891      +29     
+ Misses      17689    17665      -24     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant