pub struct Fact {
pub rule_id: RuleId,
pub file: FilePath,
pub kind: String,
pub data: String,
pub sequence: u32,
}Expand description
One observation a rule emitted while checking one file.
Fields§
§rule_id: RuleIdWhich rule emitted it.
A rule sees only its own facts. Letting one rule read another’s would make an internal payload shape into a contract between rules, and would make the result depend on the order rules were declared in.
file: FilePathThe file being checked when it was emitted.
Set by the host, not by the rule. A rule that puts its own file in the payload
does not get to change where the engine thinks the fact came from.
kind: StringThe fact’s kind, lifted out of the payload so ctx.facts('export') can filter
without parsing every fact in the corpus.
data: StringThe payload, as JSON. Always a JSON object.
sequence: u32Position among the facts this rule emitted for this file, from zero.
Emission order within a file is the rule’s own doing and is worth preserving — but it only orders facts within a file. Across files, the path breaks the tie.