diff --git a/src/services/onboarding.ts b/src/services/onboarding.ts index d7a2d37..9f19e23 100644 --- a/src/services/onboarding.ts +++ b/src/services/onboarding.ts @@ -223,6 +223,14 @@ export function publishGroupCoveragePrompt(db: Database, groupId: string, ratio: return; } + // Umbral de cobertura: publicar solo si ratio < threshold (por defecto 1.0) + const thrRaw = Number(process.env.ONBOARDING_COVERAGE_THRESHOLD); + const threshold = Number.isFinite(thrRaw) ? Math.min(1, Math.max(0, thrRaw)) : 1; + if (!(ratio < threshold)) { + try { Metrics.inc('onboarding_prompts_skipped_total', 1, { group_id: groupId, reason: 'coverage_100' }); } catch {} + return; + } + // Gating enforce try { const mode = String(process.env.GROUP_GATING_MODE || 'off').toLowerCase();