Skip to content

TEST - NEW FEATURE - Coverage for Vacuum in-place response, surface extraction, field - #260

Merged
jhalpern30 merged 4 commits into
developfrom
test/vacuum-coverage
Jun 11, 2026
Merged

TEST - NEW FEATURE - Coverage for Vacuum in-place response, surface extraction, field#260
jhalpern30 merged 4 commits into
developfrom
test/vacuum-coverage

Conversation

@logan-nc

@logan-nclogan-nc commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes part of #60 (unit-test coverage). Adds coverage for two public Vacuum entry points not exercised by runtests_vacuum.jl, folded directly into the existing suite.

  • compute_vacuum_response! (in-place) — asserts it populates caller-owned duck-typed (NamedTuple) storage identically to the allocating compute_vacuum_response wrapper, for nowall and conformal walls.
  • extract_plasma_surface_at_psi — physical sanity on a self-contained analytic Solovev equilibrium: correct array lengths, all-finite r/z/ν, R > 0, the surface brackets the magnetic axis in R, and minor-radius extent grows monotonically from ψ=0.2 → 0.8.

Both tests reuse the existing _make_inputs helper and live inside the relevant testsets in runtests_vacuum.jl — no new test file.

Files changed

FileChange
test/runtests_vacuum.jl+40 — two testsets merged into existing blocks
test/runtests.jl−1 — removed the stray coverage include
test/runtests_vacuum_coverage.jldeleted (−127)

Verification

Vacuum.jl Unit Tests | Pass 267 Total 267

Tests-only, no source modified — regression golden values unaffected.

🤖 Generated with Claude Code

…xtraction, field
Addresses #60. Adds test/runtests_vacuum_coverage.jl covering three
previously-untested public Vacuum entry points, kept separate from the large
runtests_vacuum.jl to avoid diff churn:
- compute_vacuum_response!: verifies the in-place entry populates caller-owned,
duck-typed (NamedTuple) storage identically to the allocating wrapper, for
nowall and conformal walls; green_only suppression is tested with a
non-green_only negative control so the zeroed wv assertion is load-bearing.
- extract_plasma_surface_at_psi: physical sanity on a self-contained analytic
Solovev equilibrium (R>0, surface brackets the axis, extent grows with psi).
- compute_vacuum_field: DISCOVERED LATENT BUG — the function is unreachable,
gated by two independent defects (undefined vaccal! at Vacuum.jl:317, and
_pickup_field reading the nonexistent inputs.n at Field.jl:94). Documented
with @test_broken + tripwire assertions; source intentionally NOT modified.
No source modified; full default suite passes (exit 0).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@logan-nc
logan-nc requested a review from jhalpern30June 5, 2026 12:57
@logan-nclogan-nc added the test Tests only label Jun 5, 2026
@logan-nc
logan-nc marked this pull request as ready for review June 5, 2026 12:57

@jhalpern30jhalpern30 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this more or less can just become a small PR adding the compute_vacuum_response and extract_surface_at_psi unit tests to the existing runtests_vacuum..jl file.

Comment threadtest/runtests.jl Outdated
else
include("./runtests_utilities.jl")
include("./runtests_vacuum.jl")
include("./runtests_vacuum_coverage.jl")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this shouldn't be a new file

Comment threadtest/runtests_vacuum_coverage.jl Outdated
Eq = GeneralizedPerturbedEquilibrium.Equilibrium

# A circular plasma boundary; mtheta_eq points define the boundary spline.
_make_inputs(; mtheta=64, mtheta_eq=17, mpert=2, mlow=1, nlow=1, npert=1) = VacuumInput(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

a similar function is already defined in runtests_vacuum.jl - just reuse

Comment threadtest/runtests_vacuum_coverage.jl Outdated
mtheta=mtheta
)

@testset "compute_vacuum_response! matches allocating wrapper" begin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

merge into the existing compute_vacuum_response testset that already exists

Comment threadtest/runtests_vacuum_coverage.jl Outdated
end
end

@testset "compute_vacuum_response! green_only suppresses the response matrix" begin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am going to deprecate this in #190 - I ran tests and it saves like <1% of the computation time and no memory, so no need for the added complexity. I'd just remove this test in anticipation of that unless you have a strong reason for me to keep the functionality

Comment threadtest/runtests_vacuum_coverage.jl Outdated
@test extent(r_out, z_out) > extent(r_in, z_in)
end

@testset "compute_vacuum_field — LATENT BUG (unreachable: vaccal! + inputs.n)" begin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems like a weird unit test to add for placeholder code that isn't working yet. Why not just add in an @error to the beginning of the compute_vacuum_field call? I can see it being annoying when someone implements that and pushes the PR only for their unit tests to break and they have to track down this test. I think the error statement does the same purpose and puts all of the code in the same place

@logan-nc

Copy link
Copy Markdown
CollaboratorAuthor

yeah, do it please. My objective was to provide the impulse for folks to close out low hanging fruit issues. I am not attached to the AI attempt to do so (was trying to spend as many tokens as possible yesterday). I just want he issues closed

Address PR #260 review: drop the standalone runtests_vacuum_coverage.jl
and merge the two useful tests into the existing suite, reusing the
compute_vacuum_response testset's _make_inputs helper.
- compute_vacuum_response! in-place vs. allocating-wrapper equivalence
(nowall + conformal), added inside the existing testset.
- extract_plasma_surface_at_psi physical sanity on a Solovev equilibrium.
Removed the green_only test (functionality being deprecated in #190) and
the compute_vacuum_field latent-bug tripwire (placeholder code).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@logan-nc

Copy link
Copy Markdown
CollaboratorAuthor

@jhalpern30 how about this trimmed version?

@jhalpern30

Copy link
Copy Markdown
Collaborator

Beautiful. Will merge after tests pass

@jhalpern30
jhalpern30 merged commit 3b50293 into developJun 11, 2026
5 checks passed
@jhalpern30
jhalpern30 deleted the test/vacuum-coverage branch June 11, 2026 15:06
viaweber98 pushed a commit that referenced this pull request Jun 11, 2026
Address PR #260 review: drop the standalone runtests_vacuum_coverage.jl
and merge the two useful tests into the existing suite, reusing the
compute_vacuum_response testset's _make_inputs helper.
- compute_vacuum_response! in-place vs. allocating-wrapper equivalence
(nowall + conformal), added inside the existing testset.
- extract_plasma_surface_at_psi physical sanity on a Solovev equilibrium.
Removed the green_only test (functionality being deprecated in #190) and
the compute_vacuum_field latent-bug tripwire (placeholder code).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testTests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@logan-nc@jhalpern30