Skip to content

Read an integer save_planes as a count of planes over grid.length (#533) - #843

Closed
jtravs wants to merge 3 commits into
mainfrom
fix/save-planes-count-533
Closed

jtravs wants to merge 3 commits into
mainfrom
fix/save-planes-count-533

Conversation

@jtravs

@jtravs jtravs commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Draft: two public-API points for the maintainer to confirm (see the end).

On the radial, free and planar routes, a recipe's save_planes = 80 used to pass check() and mean one plane at z = 80 m. The maintainer decided that an integer is a count of planes over grid.length.

  • Placement: the planes are placed exactly as n_save places them, linspace(0, length, count)[1:]. The count includes z = 0, the last plane is at grid.length, and the minimum is 2. A new counted_save_planes(length, count) in solprop.driver.settings holds the rule, and n_save now uses it too, so the two cannot drift apart.
  • Recipe build: SimulationSettings declares save_planes as a counted keyword (Factory.counts), so a bare TOML integer there is placed over context.grid.length. A bad count is a RecipeError at settings.save_planes.
  • Python settings: SimulationSettings(save_planes=80) now refuses a bare integer or bool, and the message points at counted_save_planes. A lone float is still one position in metres, as before.
  • check(): Recipe.check() warns, rather than refuses, when a listed last plane differs from grid.length (relative tolerance 1e-9).
  • Round trip: TOML keeps 80 as written. The Python export writes counted_save_planes(grid.length, 80).
  • Docs: the metadata's integer form now has minimum 2 and describes the count. running.md and recipes.md document both forms, and there is a changelog fragment.

Tests: the regression (80 planes ending exactly at grid.length, hashing like the Python call), the refusals, the warning, the missing-grid case and the round trip. Settings and recipe modules plus the three object-route driver tests: 751 passed, with runtime type checks on and off.

To confirm before marking ready:

  1. New public name: counted_save_planes is added to solprop.driver.settings.__all__.
  2. Python settings refuse an int instead of placing it later. Placing it later would widen the field's type to int, which basedpyright flags at 35 call sites. Python code passing save_planes=2 to mean 2 m now errors; none was found in src, tests or docs.

Known gap: the GUI's "Saved planes" field (even_planes) counts positions without the entrance, and it shows an integer recipe as missing. It doesn't crash, and it is unchanged here.

Closes #533

🤖 Generated with Claude Code

https://claude.ai/code/session_01XGENPwwkUUG9KSAwneHjgH

jtravs and others added 3 commits November 15, 2026 19:09
SimulationSettings read save_planes=80 as one plane at z = 80 m. A bare
integer is now refused with a pointer to counted_save_planes, the new
public helper that places a count as n_save does (z = 0 counted, the
end included); n_save uses it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGENPwwkUUG9KSAwneHjgH
On the object routes a settings table's save_planes = 80 is now 80
planes over grid.length, counting the entrance, placed with
counted_save_planes; check() warns when a listed last plane is not
grid.length. TOML keeps the count as written and the Python export
writes counted_save_planes(grid.length, 80) (#533).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XGENPwwkUUG9KSAwneHjgH
@codecov

codecov Bot commented Nov 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jtravs

jtravs commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by SEP 51 (accepted in #847), implemented in #851, which closes #533.

@jtravs jtravs closed this Nov 15, 2026
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.

On the object routes, save_planes = 80 means one plane at z = 80 m

1 participant