Skip to content

fix: correct min pressure validation in extend_atmosphere - #1189

Merged
olemke merged 1 commit into
atmtools:mainfrom
olemke:fix-extend-atmosphere-error
Oct 9, 2026
Merged

olemke merged 1 commit into
atmtools:mainfrom
olemke:fix-extend-atmosphere-error

Conversation

@olemke

@olemke olemke commented Oct 9, 2026

Copy link
Copy Markdown
Member

Summary

The minimum-pressure validation in extend_atmosphere was comparing the wrong variable: it checked new_max_pressure against the current minimum instead of new_min_pressure, and the error message printed the wrong atmospheric endpoint. This caused invalid minimum-pressure extension requests to either pass validation silently or produce a misleading error message. This PR fixes the comparison and the reported values so the check behaves as documented.

Changes

  • src/core/lookup/lookup_map.cpp: In extend_atmosphere, the guard for new_min_pressure now correctly tests new_min_pressure >= atm.front().pressure instead of new_max_pressure >= atm.front().pressure, and the error message now reports atm.front().pressure (the current minimum) instead of atm.back().pressure, so the message matches the values actually compared.

No breaking changes — this only corrects validation behavior and error output.

The minimum pressure branch of lookup::extend_atmosphere
compared new_max_pressure against atm.front().pressure and
printed atm.back().pressure in the error message, both copied
from the maximum pressure branch above it.

The guard was therefore useless or wrong in both call shapes:

- With only new_min_pressure set, new_max_pressure is NaN, so
  the comparison was always false and no validation happened
  at all, letting a non-extending minimum pass through to
  Atm::extend_in_pressure.
- With both bounds set, the always-true comparison raised a
  spurious error quoting numbers that contradicted the text.

Check new_min_pressure against atm.front().pressure and report
the current minimum, mirroring the maximum pressure branch and
the contract documented in lookup_map.h.
@olemke
olemke merged commit 83a4287 into atmtools:main Oct 9, 2026
9 checks passed
@olemke
olemke deleted the fix-extend-atmosphere-error branch October 9, 2026 12:01
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