Skip to main content

finalize_rules

Function finalize_rules 

Source
pub fn finalize_rules(
    new_rules: Vec<Rule>,
    previous: &[Rule],
    batch_sources: &[String],
    now: &str,
) -> Vec<Rule>
Expand description

Mint identity for a freshly learned rule set, carrying lineage forward.

The learner rewrites whole sets, so identity has to survive the rewrite: a rule whose text matches one in previous keeps that rule’s id, created_at and sources (it is the same rule restated by a new pass); a rule with new text is new — it gets a fresh id, now, and the batch’s reflexion ids as sources. Retired rules in previous are carried into the result untouched, so a consolidation can never silently resurrect or erase what retirement recorded.