| 286 | for (const cond of conditions) { |
| 287 | // An unknown condition name fails closed rather than crashing: the name |
| 288 | // can come from user input (the `Condition` operator's second operand), |
| 289 | // and an unguarded lookup threw `CONDITIONS[cond] is not a function` out |
| 290 | // of `evaluate()` for e.g. `Condition(x, "fuzz")`. |
| 291 | const predicate = CONDITIONS[cond as keyof typeof CONDITIONS]; |
| 292 | if (predicate === undefined || predicate(x) !== true) return false; |
| 293 | } |
| 294 | return true; |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * Evaluate a rule-condition predicate and report whether it discharges. |
| 299 | * |
| 300 | * Rule guards must be *fail-closed*: an unprovable predicate (e.g. `w ≠ 0` for |
| 301 | * an unconstrained `w`) must NOT satisfy the guard. Plain `.evaluate()` applies |