mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
fix(ai): neutralize protection guardrail for products with CA<10EUR or margin<=0%
This commit is contained in:
1 parent
4716659c29
commit
8b73363550
2 files changed
+15
-5
No files matched your search
@@ -23,6 +23,7 @@ IMPORTANT : La gamme C est RÉSERVÉE aux produits saisonniers et gérée MANUEL
|
||||
--- ORDRE DE PRIORITÉ (STRICT) ---
|
||||
|
||||
1. GARDE-FOU PROTECTION : Si isProtected = true (Nouveauté / Dernier Produit / Top30) → A obligatoire.
|
||||
EXCEPTION : La protection est déjà neutralisée pour les produits à CA réseau < 10€ ou marge ≤ 0%. Si tu ne vois pas le signal 🛡️, le produit n'est PAS protégé.
|
||||
|
||||
2. SEUIL PLANCHER ABSOLU (règle critique) :
|
||||
Si isLowContribution = true [poids CA < 0.5% ET poids QTÉ < 0.5% du fournisseur]
|
||||
|
||||
@@ -270,15 +270,24 @@ export class ContextProfiler {
|
||||
);
|
||||
|
||||
// 8. Gardes-fous
|
||||
const isProtected =
|
||||
// Neutralisation : un produit à CA réseau trivial (< 10€) ou marge ≤ 0%
|
||||
// n'a pas d'activité économique réelle. Le protéger serait absurde.
|
||||
const rawCa = target.totalCa ?? 0;
|
||||
const rawMarge = target.tauxMarge ?? 0;
|
||||
const isEconomicallyViable = rawCa >= 10 && rawMarge > 0;
|
||||
|
||||
const isProtected = isEconomicallyViable && (
|
||||
scoring.decision.isRecent ||
|
||||
scoring.decision.isTop30Supplier ||
|
||||
scoring.decision.isLastProduct;
|
||||
scoring.decision.isLastProduct
|
||||
);
|
||||
|
||||
let protectionReason = "";
|
||||
if (scoring.decision.isRecent) protectionReason = "Nouveauté (< 3 mois de données)";
|
||||
else if (scoring.decision.isTop30Supplier) protectionReason = "Top 30% CA Fournisseur";
|
||||
else if (scoring.decision.isLastProduct) protectionReason = "Dernière référence du fournisseur";
|
||||
if (isProtected) {
|
||||
if (scoring.decision.isRecent) protectionReason = "Nouveauté (< 3 mois de données)";
|
||||
else if (scoring.decision.isTop30Supplier) protectionReason = "Top 30% CA Fournisseur";
|
||||
else if (scoring.decision.isLastProduct) protectionReason = "Dernière référence du fournisseur";
|
||||
}
|
||||
|
||||
// 9. Règle absolue
|
||||
const scoreCritique = (target.score ?? 0) < 20;
|
||||
|
||||
Reference in new issue
Block a user