conclude.rb:211 calls @loog.info("#{n.what}: #{n.details}") on every fact produced by draw. However, fill sets n.what and n.details only when the block returns a String:
def fill(fact, prev)
r = yield(fact, prev)
return unless r.is_a?(String)
fact.details = r
fact.what = @judge
end
When the block returns anything else (e.g. nil from $loog.info(...), or an Integer), n.what is never set. Factbase::Fact raises RuntimeError: Can't find 'what' attribute when reading an unset property, causing a crash in roll.
Minimal reproduction:
Fbe.conclude(fb: fb, judge: 'test') do
quota_unaware
on '(always)'
draw do |n, _f|
n.score = 42
# returns Integer — fill does NOT set n.what/n.details → crash
end
end
# => RuntimeError: Can't find 'what' attribute out of [score]
What should happen: roll should not assume n.what and n.details are always set. Either fill should unconditionally set n.what = @judge, or roll should guard the log line against unset attributes.
conclude.rb:211calls@loog.info("#{n.what}: #{n.details}")on every fact produced bydraw. However,fillsetsn.whatandn.detailsonly when the block returns aString:When the block returns anything else (e.g.
nilfrom$loog.info(...), or anInteger),n.whatis never set.Factbase::FactraisesRuntimeError: Can't find 'what' attributewhen reading an unset property, causing a crash inroll.Minimal reproduction:
What should happen:
rollshould not assumen.whatandn.detailsare always set. Eitherfillshould unconditionally setn.what = @judge, orrollshould guard the log line against unset attributes.