Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

test: give every coverage floor room for two uncovered units

Yudhi Armyndharisd0827af05e2a
diff --git a/docs/09-testing-strategy.md b/docs/09-testing-strategy.md
index 103436bd0..8e761e5a8 100644
--- a/docs/09-testing-strategy.md
+++ b/docs/09-testing-strategy.md
@@ -184,38 +184,42 @@ authoritative gate. Current policy:
| `src/common/storage/` | 75% | 85% | 84% | 80% |
| `src/common/utils/` | 87% | 92% | 92% | 92% |
| `src/config/` | 85% | 92% | 91% | 91% |
-| `src/core/agent-tools/` | 88% | 87% | 83% | 83% |
-| `src/core/hooks/` | 84% | 73% | 86% | 85% |
+| `src/core/agent-tools/` | 83% | 86% | 83% | 83% |
+| `src/core/hooks/` | 84% | 71% | 86% | 85% |
| `src/core/plugins/` | 73% | 76% | 82% | 81% |
| `src/database/` | 69% | 69% | 72% | 72% |
| `src/engine/adapters/` | 78% | 85% | 86% | 86% |
-| `src/engine/identity/` | 85% | 95% | 94% | 93% |
+| `src/engine/identity/` | 85% | 86% | 94% | 93% |
| `src/modules/audit/` | 59% | 45% | 73% | 70% |
| `src/modules/auth/` | 76% | 85% | 86% | 86% |
| `src/modules/automation/` | 67% | 86% | 83% | 79% |
-| `src/modules/chat-media/` | 75% | 76% | 84% | 84% |
+| `src/modules/chat-media/` | 75% | 72% | 84% | 84% |
| `src/modules/contact/` | 82% | 92% | 89% | 88% |
| `src/modules/docker/` | 84% | 93% | 92% | 92% |
| `src/modules/events/` | 72% | 84% | 84% | 82% |
| `src/modules/group/` | 67% | 65% | 79% | 79% |
| `src/modules/infra/` | 75% | 76% | 89% | 88% |
| `src/modules/integration/` | 76% | 83% | 90% | 89% |
-| `src/modules/mcp/` | 62% | 81% | 78% | 78% |
-| `src/modules/media/` | 71% | 87% | 89% | 88% |
+| `src/modules/mcp/` | 62% | 76% | 78% | 78% |
+| `src/modules/media/` | 69% | 86% | 89% | 88% |
| `src/modules/message/` | 75% | 66% | 86% | 85% |
-| `src/modules/metrics/` | 64% | 65% | 70% | 67% |
+| `src/modules/metrics/` | 64% | 58% | 70% | 67% |
| `src/modules/plugins/` | 69% | 64% | 77% | 76% |
| `src/modules/queue/` | 74% | 81% | 95% | 95% |
-| `src/modules/search/` | 69% | 87% | 78% | 78% |
+| `src/modules/search/` | 69% | 86% | 78% | 78% |
| `src/modules/session/` | 75% | 79% | 88% | 87% |
| `src/modules/stats/` | 67% | 63% | 78% | 76% |
-| `src/modules/status-store/` | 79% | 83% | 92% | 91% |
+| `src/modules/status-store/` | 79% | 79% | 92% | 91% |
| `src/modules/status/` | 70% | 60% | 83% | 82% |
-| `src/modules/template/` | 77% | 99% | 92% | 89% |
+| `src/modules/template/` | 76% | 87% | 91% | 89% |
| `src/modules/webhook/` | 72% | 89% | 90% | 87% |
When raising a floor, set it about five points below that scope's measured coverage, so it catches
-a real regression without failing on ordinary churn. When coverage legitimately shifts — a refactor
+a real regression without failing on ordinary churn, and then check that gap in UNITS rather than
+percent. Five points is denominator-blind: on a scope with 14 functions it buys nothing, and a floor
+that admits zero growth has stopped measuring coverage and started blocking ordinary change. Every
+floor here leaves room for at least two newly uncovered units of its metric, which is the one case
+where a floor may be lowered: not because coverage fell, but because the margin was unattainable. When coverage legitimately shifts — a refactor
relocating covered logic, a lane split changing which specs a lane runs — reset the floor to the
newly measured coverage instead. Floors exist to catch regressions, not to force coverage.
diff --git a/package.json b/package.json
index 66a4d040c..a2a246aff 100644
--- a/package.json
+++ b/package.json
@@ -241,14 +241,14 @@
"statements": 91
},
"./src/core/agent-tools/": {
- "branches": 88,
- "functions": 87,
+ "branches": 83,
+ "functions": 86,
"lines": 83,
"statements": 83
},
"./src/core/hooks/": {
"branches": 84,
- "functions": 73,
+ "functions": 71,
"lines": 86,
"statements": 85
},
@@ -272,7 +272,7 @@
},
"./src/engine/identity/": {
"branches": 85,
- "functions": 95,
+ "functions": 86,
"lines": 94,
"statements": 93
},
@@ -296,7 +296,7 @@
},
"./src/modules/chat-media/": {
"branches": 75,
- "functions": 76,
+ "functions": 72,
"lines": 84,
"statements": 84
},
@@ -338,13 +338,13 @@
},
"./src/modules/mcp/": {
"branches": 62,
- "functions": 81,
+ "functions": 76,
"lines": 78,
"statements": 78
},
"./src/modules/media/": {
- "branches": 71,
- "functions": 87,
+ "branches": 69,
+ "functions": 86,
"lines": 89,
"statements": 88
},
@@ -356,7 +356,7 @@
},
"./src/modules/metrics/": {
"branches": 64,
- "functions": 65,
+ "functions": 58,
"lines": 70,
"statements": 67
},
@@ -374,7 +374,7 @@
},
"./src/modules/search/": {
"branches": 69,
- "functions": 87,
+ "functions": 86,
"lines": 78,
"statements": 78
},
@@ -392,7 +392,7 @@
},
"./src/modules/status-store/": {
"branches": 79,
- "functions": 83,
+ "functions": 79,
"lines": 92,
"statements": 91
},
@@ -403,9 +403,9 @@
"statements": 82
},
"./src/modules/template/": {
- "branches": 77,
- "functions": 99,
- "lines": 92,
+ "branches": 76,
+ "functions": 87,
+ "lines": 91,
"statements": 89
},
"./src/modules/webhook/": {