Skip to content

#1465: require exactly three operands for award conditionals - #1530

Closed
gemshrine wants to merge 1 commit into
zerocracy:masterfrom
gemshrine:1465
Closed

gemshrine wants to merge 1 commit into
zerocracy:masterfrom
gemshrine:1465

Conversation

@gemshrine

Copy link
Copy Markdown
Contributor

Fixes #1465.

The bill evaluator rejected an if term only when it had fewer than three operands. Additional operands were discarded, and the bylaw formatter performed no arity check at all. A malformed rule could therefore produce a payment and description that omitted part of the supplied expression.

Both paths now require exactly three operands and report the number supplied when that requirement is not met. Correct conditionals keep their existing calculation and formatting behavior.

The regression covers zero, one, two and four operands through both billing and bylaw generation. The award, award-logic and between tests passed: 28 tests, 120 assertions. RuboCop passed for both changed files using rubocop-elegant 0.5.1 from the lockfile, and git diff --check passed.

@gemshrine

Copy link
Copy Markdown
Contributor Author

This duplicates the existing fix in #1360, which validates the operand count of if in both calculation and bylaw rendering along with the other fixed-arity expressions. Keeping that existing PR avoids competing fixes for the same behavior.

@gemshrine gemshrine closed this Oct 13, 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.

Award if terms silently ignore extra operands

1 participant