karajan-code 4.51.0 → 4.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/policy/add.js +9 -1
package/package.json
CHANGED
package/src/policy/add.js
CHANGED
|
@@ -44,7 +44,15 @@ function mergeFragment(doc, frag) {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
// KJC-BUG-0355: a threshold on a metric already measured CHANGES that invariant
|
|
48
|
+
// (keeping its id): a second one beside it would leave the stricter ruling.
|
|
49
|
+
const invariants = [...(doc.invariants || [])];
|
|
50
|
+
for (const inv of frag.invariants || []) {
|
|
51
|
+
const same = invariants.findIndex((cur) => cur?.kind === inv?.kind && cur?.metric === inv?.metric);
|
|
52
|
+
if (same === -1) invariants.push(inv);
|
|
53
|
+
else invariants[same] = { ...invariants[same], ...inv, id: invariants[same].id };
|
|
54
|
+
}
|
|
55
|
+
if (frag.invariants) out.invariants = invariants;
|
|
48
56
|
return out;
|
|
49
57
|
}
|
|
50
58
|
|