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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "karajan-code",
3
- "version": "4.51.0",
3
+ "version": "4.51.1",
4
4
  "description": "Local multi-agent coding orchestrator with TDD, SonarQube, and code review pipeline",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
package/src/policy/add.js CHANGED
@@ -44,7 +44,15 @@ function mergeFragment(doc, frag) {
44
44
  }
45
45
  }
46
46
  }
47
- if (frag.invariants) out.invariants = [...(doc.invariants || []), ...frag.invariants];
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