pub fn shape_hash(
hunk: &Hunk,
disposition_letter: u8,
generated: bool,
lang: &dyn Language,
) -> StringExpand description
Shape key: normalised removed + added lines, the file disposition, and whether the file is generated. Returns the 12-hex sha1 used as the class key.
The disposition is in the key because a whole-file-add hunk and a modification with identical text are different shapes.
generated is in the key because a class is a unit of routing, not only a
unit of text. A lockfile line and a source line can normalise to the same
shape, and without this they became one class β a mixed class, neither
generated nor not. The noise tier could then only ask βis every member
generated?β, which such a class answers no, so it went to the model and its
lockfile hunks went wherever the model put the class. That was how a
generated hunk reached a focus group.
With the flag in the key, every class is wholly generated or wholly not.
plan::class_is_generated becomes exact rather than a membership test that
fails on the one case that matters.
The cost is stated plainly: generated is a hint (built-in list,
gitattributes, repo config), so a [classify] glob now moves a class
boundary rather than only a routing decision. That is config tuning
classification, which is what config is for (ADR 0012); it still cannot add
or remove a hunk. The gain is that the routing decision is exact.