What Happens
Fbe.regularly (lib/fbe/regularly.rb, lines 38-60) looks up the project's PMP fact for a given area with a query constrained to also require the interval property (p_every_days) to exist:
pmp = fb.query("(and (eq what 'pmp') (eq area '#{area}') (exists #{p_every_days}))").each.first
interval = pmp.nil? ? 7 : pmp[p_every_days].first
...
days = pmp.nil? || pmp[p_since_days].nil? ? 28 : pmp[p_since_days].first
since = Time.now - (days * 24 * 60 * 60)
If a project configures only the since window (for example qos_days) and leaves the interval property (qos_interval) unset, pmp comes back nil because the exists clause in the query never matches, and days silently falls back to the hardcoded default of 28, even though the actual qos_days value is sitting on that same fact and Fbe.pmp reads it without any trouble. Adding the unrelated qos_interval property to the same fact is what makes the since lookup start working, which is the confusing part.
I confirmed this with two factbases:
- A
pmp fact for area quality carrying only qos_days = 99: Fbe.regularly used since = 28 days ago, while Fbe.pmp.quality.qos_days correctly returned 99.
- The same fact with
qos_interval = 3 added: Fbe.regularly then used since = 99 days ago, as expected.
Related, same root cause: when pmp is nil at all, regularly.rb and repeatedly.rb (line 41) fall back to hardcoded 7 days / 24 hours instead of consulting the defaults already declared in assets/pmp.xml. On an empty factbase, Fbe.regularly('integration', 'eva_interval') runs every 7 days while Fbe.pmp.integration.eva_interval (reading the same pmp.xml default) says 10.
Steps to Reproduce
fb = Factbase.new
f = fb.insert
f.what = 'pmp'
f.area = 'quality'
f.qos_days = 99
Fbe.regularly(fb: fb, area: 'quality', p_every_days: 'qos_interval', p_since_days: 'qos_days') { |f2| f2.since }
# => Time.now - 28*24*60*60, instead of Time.now - 99*24*60*60
What Should Happen
The PMP lookup should not require p_every_days to exist in order to read p_since_days (and vice versa) — each configured property should be honored independently of whether the other one is also set.
What Happens
Fbe.regularly(lib/fbe/regularly.rb, lines 38-60) looks up the project's PMP fact for a given area with a query constrained to also require the interval property (p_every_days) to exist:If a project configures only the since window (for example
qos_days) and leaves the interval property (qos_interval) unset,pmpcomes backnilbecause theexistsclause in the query never matches, anddayssilently falls back to the hardcoded default of28, even though the actualqos_daysvalue is sitting on that same fact andFbe.pmpreads it without any trouble. Adding the unrelatedqos_intervalproperty to the same fact is what makes thesincelookup start working, which is the confusing part.I confirmed this with two factbases:
pmpfact for areaqualitycarrying onlyqos_days = 99:Fbe.regularlyusedsince = 28 days ago, whileFbe.pmp.quality.qos_dayscorrectly returned99.qos_interval = 3added:Fbe.regularlythen usedsince = 99 days ago, as expected.Related, same root cause: when
pmpisnilat all,regularly.rbandrepeatedly.rb(line 41) fall back to hardcoded7days /24hours instead of consulting the defaults already declared inassets/pmp.xml. On an empty factbase,Fbe.regularly('integration', 'eva_interval')runs every 7 days whileFbe.pmp.integration.eva_interval(reading the samepmp.xmldefault) says10.Steps to Reproduce
What Should Happen
The PMP lookup should not require
p_every_daysto exist in order to readp_since_days(and vice versa) — each configured property should be honored independently of whether the other one is also set.