isLightLaneRule function
Whether rule belongs to the light (in-process) lane.
Three conditions, all required:
- Severity is ERROR or WARNING (kLightLaneSeverities). Uses the
rule's declared
code.severity, NOT SaropaLintRule.effectiveSeverity — lane membership must be a stable property of the rule itself. If it honored user severity overrides, a consumer bumping one INFO rule to WARNING would silently pull it into the in-process lane and change the memory profile the lane exists to protect. - Cost is trivial or low (kLightLaneCosts).
- Does not use type resolution — the memory-critical condition.
Condition 3 rests on the rule's own SaropaLintRule.usesTypeResolution
declaration, which defaults to false and is not enforced by the compiler.
A rule that touches the element model while declaring false would defeat
the entire lane, so that declaration is audited against actual element-API
usage by test/integrity/rule_lane_test.dart. A mis-declaration found
there is a defect in the RULE (fix the override), never a reason to special
-case it here.
Implementation
bool isLightLaneRule(SaropaLintRule rule) {
if (rule.usesTypeResolution) return false;
if (!kLightLaneSeverities.contains(rule.code.severity)) return false;
return kLightLaneCosts.contains(rule.cost);
}