What happens
Fbe.kill_if (lib/fbe/kill_if.rb:20) collects fact IDs with:
When a fact does not have the fid property (the property name is a parameter, fid: '_id' is only the default), f[fid] returns nil and the call crashes:
NoMethodError: undefined method 'first' for nil
A caller who passes a custom fid (or feeds facts that predate the _id-assigning Factbase::Pre decorator, e.g. raw facts in tests) gets a bare NoMethodError from deep inside the loop instead of a meaningful failure. Additionally, if f[fid] were ever an empty array, nil would silently land in ids and later render as (eq _id ) in the delete query — a malformed term.
What should happen
kill_if should either skip facts that lack the fid property or raise a clear Fbe::Error naming the fact and the missing property — anything but a raw NoMethodError on nil.
What happens
Fbe.kill_if(lib/fbe/kill_if.rb:20) collects fact IDs with:When a fact does not have the
fidproperty (the property name is a parameter,fid: '_id'is only the default),f[fid]returnsniland the call crashes:A caller who passes a custom
fid(or feeds facts that predate the_id-assigningFactbase::Predecorator, e.g. raw facts in tests) gets a bareNoMethodErrorfrom deep inside the loop instead of a meaningful failure. Additionally, iff[fid]were ever an empty array,nilwould silently land inidsand later render as(eq _id )in the delete query — a malformed term.What should happen
kill_ifshould either skip facts that lack thefidproperty or raise a clearFbe::Errornaming the fact and the missing property — anything but a rawNoMethodErroronnil.