In shadow/dry-run/kill-switch modes, when the target has no token/recipient/
chat, or when not in the canary cohort, the handlers returned without marking
the notification, so the poller (pendingFilter on notified:{$ne:true})
re-selected the same batch every cycle forever (observed: fcm:500 every 10s).
Add a service-owned per-channel marker processedBy.<channel>, set in every
terminal 'won't/can't send' branch, and exclude marked docs in pendingFilter.
Unlike the shared notified/emailNotified/telegramNotified flags, processedBy is
invisible to the old system, so it never suppresses a real send in prod shadow.
- types.ts: NotificationDoc.processedBy?: Partial<Record<Channel, Date>>
- poller.ts: pendingFilter excludes processedBy.<channel>
- handlers.ts: markProcessed() in no-token/no-recipient/no-chat, decideSend=false,
dead-token and telegram-blocked branches
- fake-repo: dotted-path support in matching and $set/$unset
- tests: regression test + processedBy assertions (86 passing)
El smoke-test contra prod revelo MongoDB 3.2.11 (EOL): el driver v6 exige >=4.2
y no conecta. Cambios:
- mongodb ^3.7.4 + @types/mongodb; db.ts con useUnifiedTopology, sin retryWrites
- sends.ts: deteccion de duplicate-key (11000) sin depender de MongoServerError
- poller.ts: FilterQuery en vez de Filter
- tests de integracion migrados de mongodb-memory-server a un fake en memoria
(test/fake-repo.ts) porque no hay mongod 3.x ejecutable en hosts modernos;
emula operadores ($ne/$in/$gte/$exists), $set/$unset e indice unico (11000)
- docs: legacy-behavior.md §0 (entorno MongoDB 3.2, sin change streams -> fase
1b usara polling; recomendacion de upgrade de Mongo como fase propia)
47 tests en verde, typecheck y build OK. Datos reales del import: 413 pendientes
FCM, 0 email, 8176 users con fireBaseToken.
Sustituye el envío de push por la API legacy de GCM (muerta desde jun-2024) y
saca el envío del observer de Meteor a una cola BullMQ controlada.
- poller: consume 'notifications' pendientes (campos correctos; el cron viejo
tenía un typo nofitied/emailNofitied que nunca casaba)
- fcm-worker: firebase-admin (FCM HTTP v1), payload compatible con la app
Flutter (FLUTTER_NOTIFICATION_CLICK, collapseKey=_id, data); purga tokens
muertos sin reintentar
- email-worker: nodemailer + plantillas new-fire portadas verbatim
- idempotencia persistente: notification_sends, indice unico (notificationId,
channel) -> sobrevive reinicios y replays
- salvaguardas anti-spam: modos dry-run/shadow/canary/full, exclusion mutua por
canal (OWNED_CHANNELS + notifDisabledChannels en Meteor), kill switch,
limites por usuario/dia y circuit breaker por batch
- docs/legacy-behavior.md (caracterizacion) + docs/rollout.md
- 47 tests (vitest + mongodb-memory-server), typecheck y build OK
- deploy: systemd + pm2 (Node 22 standalone)
Falta el service account de Firebase para envio real de push (pedir al usuario).