Guard Slurry Ctech/Cseason share formulas against zero-sum input#627
Open
zaucker wants to merge 1 commit into
Open
Guard Slurry Ctech/Cseason share formulas against zero-sum input#627zaucker wants to merge 1 commit into
zaucker wants to merge 1 commit into
Conversation
Each per-tech share output in Application::Slurry::Ctech (5 outputs) and each per-season share output in Application::Slurry::Cseason (2 outputs, non-Kantonal_LU branch) divided an input by the sum of its sibling inputs. When the user hadn't filled the inputs yet — typical for fresh datasets and integration-test fixtures — the sum was 0, division produced a 0/0 Rat that Model.rakumod stores as the literal string `'ERROR: division by 0'`, and any downstream formula reading that output (notably Application::Slurry::Alfam2::er_alfam2*) died trying to coerce that string to a number. Add an explicit `Out(sum) > 0 ? In(x)/Out(sum) : 0` guard. Behavior unchanged when shares actually sum to a positive number; just stops the cascade when they don't. The existing soft `writeLog` warning in share_apptech_sum (when the sum isn't ~100) and the model's validation layer still flag the under-filled state. Application::SolidManure::Cseason already divides by 100 directly, so it's not affected. Verified end-to-end against a dataset with all five Ctech share inputs and both Cseason season inputs at 0: calc previously crashed at er_alfam2_share_bc; now completes with ~97KB of output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Each per-tech share output in Application::Slurry::Ctech (5 outputs) and each per-season share output in Application::Slurry::Cseason (2 outputs, non-Kantonal_LU branch) divided an input by the sum of its sibling inputs. When the user hadn't filled the inputs yet — typical for fresh datasets and integration-test fixtures — the sum was 0, division produced a 0/0 Rat that Model.rakumod stores as the literal string
'ERROR: division by 0', and any downstream formula reading that output (notably Application::Slurry::Alfam2::er_alfam2*) died trying to coerce that string to a number.Add an explicit
Out(sum) > 0 ? In(x)/Out(sum) : 0guard. Behavior unchanged when shares actually sum to a positive number; just stops the cascade when they don't. The existing softwriteLogwarning in share_apptech_sum (when the sum isn't ~100) and the model's validation layer still flag the under-filled state.Application::SolidManure::Cseason already divides by 100 directly, so it's not affected. Verified end-to-end against a dataset with all five Ctech share inputs and both Cseason season inputs at 0: calc previously crashed at er_alfam2_share_bc; now completes with ~97KB of output.