Convert negative stock warning to error - #398
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The implementation can terminate on valid small positive snow values, and documentation updates are still needed.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
This PR changes negative stock handling from warnings to fatal errors and documents the behavior change.
Changes:
- Updates
ensureNonNegativeerror handling. - Adds an Unreleased changelog entry.
| File | Summary |
|---|---|
src/sipnet/sipnet.c |
Changes negative stock validation behavior. |
docs/CHANGELOG.md |
Documents the behavior change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| logError("Non-negative stock constraint applied for %s (value %8.5f set " | ||
| "to zero) year %d day %d time %6.3f\n", | ||
| label, *var, climate->year, climate->day, climate->time); | ||
| exit(EXIT_CODE_INTERNAL_ERROR); |
There was a problem hiding this comment.
Ah, the snow case... good catch copilot!
| logError("Non-negative stock constraint applied for %s (value %8.5f set " | ||
| "to zero) year %d day %d time %6.3f\n", | ||
| label, *var, climate->year, climate->day, climate->time); | ||
| exit(EXIT_CODE_INTERNAL_ERROR); |
dlebauer
left a comment
There was a problem hiding this comment.
This looks good to me. deferring approval until Copilot comments about aborting on valid positive snow values is addressed.
|
@dlebauer - I believe this is good to go |


Summary
ensureNonNegativeto an errorHow was this change tested?
All unit and smoke tests pass.
Related issues
Checklist
docs/CHANGELOG.mdupdated with noteworthy changesclang-format(rungit clang-formatif needed)