Documentation Index
Fetch the complete documentation index at: https://docs.kaireonai.com/llms.txt
Use this file to discover all available pages before exploring further.
Inheritance dedupe
Without the flag,getEffectiveRules returns every rule whose
scope matches the offer (global, category, subcategory, offer). When
two rules share a name (e.g., a global “min_age=18” and an
offer-specific “min_age=21”), both flow through.
When inheritanceEnabled is on (or ?explainCascade=true is
supplied), the resolver collapses duplicates to the most-specific
scope per name using the precedence:
resolveEffectiveRules in
lib/qualification/inheritance.ts.
Configuration
Time-aware windows
Rules can declare aconfig.timeWindow shape. The resolver evaluates
matchesTimeWindow(asOf, window) per rule when the route is called
with ?asOf=ISO8601. Rules whose window does not include asOf are
filtered out.
Window shape
Honest fail-open on malformed windows
When a rule hasconfig.timeWindow set but the value is not a plain
object, the filter falls open (the rule is preserved). This matches
the existing “rules must work even when storage shape drifts” contract
elsewhere in the codebase. Schema validation upstream is the place to
enforce strict shape.
explainCascade
?explainCascade=true implies inheritance dedupe and populates
cascadeTrace in the response — a per-name list of every candidate
that contributed to the dedupe:
Snapshot regression
Six new tests ineffective-rules-inheritance.test.ts:
- Default options preserve every matching rule (bit-identical to prior behavior).
inheritanceMode: "deduped"collapses duplicates to most-specific scope.explainCascade: truepopulates cascadeTrace per-name.asOffilters rules whosetimeWindowexcludes the instant.asOfkeeps rules whosetimeWindowincludes the instant.- Malformed
timeWindowfalls open (preserves the rule).