Resolve the normalisation patch for a layer's raw clustering value.
Returns null when the value is absent or not an object, which callers treat as
"leave the definition untouched" — an absent clustering block is not the same as
clustering: false.
⚠️ This is a pure, single-argument function by design. It replaces two
mutating helpers that carried the same logic under opposite parameter orders —
_applyClusteringConfig(destination, source) in ./profile.ts and
_applyDeferredClusteringNorm(source, destination) in
../../themes/theme-applier/deferred.ts. Merging them into a two-argument
(source, destination) helper would have type-checked in both directions, since
both parameters are structurally loose — so an inverted call would have compiled
and silently written the wrong way round. Returning a patch removes that failure
mode by construction rather than by vigilance (R.40, backlog résiduel S5).
Parameters
clustering: unknown
The layer definition's raw clustering value, of unknown shape.
Resolve the normalisation patch for a layer's raw
clusteringvalue.Returns
nullwhen the value is absent or not an object, which callers treat as "leave the definition untouched" — an absentclusteringblock is not the same asclustering: false.⚠️ This is a pure, single-argument function by design. It replaces two mutating helpers that carried the same logic under opposite parameter orders —
_applyClusteringConfig(destination, source)in./profile.tsand_applyDeferredClusteringNorm(source, destination)in../../themes/theme-applier/deferred.ts. Merging them into a two-argument(source, destination)helper would have type-checked in both directions, since both parameters are structurally loose — so an inverted call would have compiled and silently written the wrong way round. Returning a patch removes that failure mode by construction rather than by vigilance (R.40, backlog résiduel S5).