Bug
The award calculator silently ignores extra operands for fixed-arity expressions. For example, plus, times, comparisons, and if read only their first two or three operands; they reject too few operands in some cases but never reject too many.
Steps to reproduce
-
Build a bill from an award rule containing a fixed-arity expression with an extra operand, for example:
(award (give (plus 1 2 100) "calculation"))
-
Inspect the resulting bill.
Actual result
The bill is calculated as 3; the extra 100 is silently discarded. The same pattern applies to other fixed-arity expressions such as (times 2 3 100) and (if true 1 0 100).
Expected result
A malformed fixed-arity expression should fail with an arity error, rather than silently producing an amount based on only part of the written rule. This is especially important for award rules, where a typo can change the points paid without making the rule appear broken.
Evidence
lib/fbe/award.rb, Fbe::Award::BTerm#calc, indexes fixed-arity operands directly (for example to_val(@operands[0], bill) + to_val(@operands[1], bill)) and does not validate their total count. The if branch checks only @operands.size < 3, so operands after the third are also ignored. The query parser accepts the additional operands, and the custom award calculator handles these expressions itself.
Bug
The award calculator silently ignores extra operands for fixed-arity expressions. For example,
plus,times, comparisons, andifread only their first two or three operands; they reject too few operands in some cases but never reject too many.Steps to reproduce
Build a bill from an award rule containing a fixed-arity expression with an extra operand, for example:
Inspect the resulting bill.
Actual result
The bill is calculated as
3; the extra100is silently discarded. The same pattern applies to other fixed-arity expressions such as(times 2 3 100)and(if true 1 0 100).Expected result
A malformed fixed-arity expression should fail with an arity error, rather than silently producing an amount based on only part of the written rule. This is especially important for award rules, where a typo can change the points paid without making the rule appear broken.
Evidence
lib/fbe/award.rb,Fbe::Award::BTerm#calc, indexes fixed-arity operands directly (for exampleto_val(@operands[0], bill) + to_val(@operands[1], bill)) and does not validate their total count. Theifbranch checks only@operands.size < 3, so operands after the third are also ignored. The query parser accepts the additional operands, and the custom award calculator handles these expressions itself.