wulf-pulse/lib/services
lorentz 6945591f76 fix(18-05): decrement origin campaign report_count on migration + diverged create-new (CR-02)
Cross-campaign migration (a report moves from campaign A to a
different existing campaign B on re-analyze) never decremented A's
report_count, leaving it permanently stale. The same abandonment
happens on the signal-diverged create-new fall-through added for
CR-03 (Task 1) — landing on a brand-new campaign instead of an
existing sibling's, but the same class of staleness.

Add a shared decrementOriginCampaign() helper and call it in both
locations, guarded so it only fires when there is a real origin
(ownReport.campaign_id non-null) and the match doesn't resolve back to
the report's own campaign (the existing same-campaign no-op guard is
unchanged). D-08 sibling upgrades (never-grouped report -> sibling
campaign) increment the destination only, with no origin to
decrement.

- Test E: cross-campaign migration decrements origin, increments destination
- Test F: D-08 upgrade with no prior campaign increments destination only
- Test G (renamed from existing 18-04 test): same-campaign re-match remains zero mutations
- Test H: signal-diverged create-new also decrements the abandoned origin (plan-checker-flagged case)

Tests E and H failed against the pre-fix code (confirmed during RED).
2026-07-16 00:10:45 -04:00
..
analyzer feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
b2 feat(16-02): add EML_OBJECT_KEY_REGEX + parameterize B2 key validation (D-05) 2026-07-15 10:23:19 -04:00
llm feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
pipeline-steps fix(09.1-01): pulse-me- prefix, company ntfy server + bearer auth for personal channels 2026-05-11 06:42:52 -04:00
rmm feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
workflow-steps feat: IT Glue integration, workflow engine, pipelines, Zabbix WAN, notification channels, backup status UI improvements, nav alignment fixes 2026-02-27 14:52:14 -05:00
addigy-client.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
addigy-factory.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
ai-triage-service.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
analytics-engine.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
analytics-integration.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
appgate-client.ts feat(appgate): add AppGate SDP integration health check and sync service 2026-07-11 09:43:48 -04:00
appgate-factory.ts feat(appgate): add AppGate SDP integration health check and sync service 2026-07-11 09:43:48 -04:00
appgate-sync-service.ts feat(appgate): add AppGate SDP integration health check and sync service 2026-07-11 09:43:48 -04:00
audit.ts feat: add authentication, user management, and admin features 2026-01-31 12:43:14 -05:00
autotask-client.test.ts test(16-02): add failing test for AutotaskClient.getAttachmentContent 2026-07-15 10:22:01 -04:00
autotask-client.ts feat(16-02): add AutotaskClient.getAttachmentContent() 2026-07-15 10:22:03 -04:00
autotask-factory.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
autotask-webhook-manager.ts feat: QuickBooks Online integration 2026-03-17 07:39:55 -04:00
auvik-client.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
auvik-factory.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
background-processor.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
cache.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
campaign-grouping-service.test.ts fix(18-05): decrement origin campaign report_count on migration + diverged create-new (CR-02) 2026-07-16 00:10:45 -04:00
campaign-grouping-service.ts fix(18-05): decrement origin campaign report_count on migration + diverged create-new (CR-02) 2026-07-16 00:10:45 -04:00
datto-rmm-client-simple.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
datto-rmm-client.ts feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
datto-rmm-factory.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
datto-rmm-sync-service.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
device-link-reconciler.ts feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
duo-client.ts feat: Duo Security integration — full data sync from Accounts + Admin API 2026-03-27 09:18:04 -04:00
duo-sync-service.ts feat: Duo Security integration — full data sync from Accounts + Admin API 2026-03-27 09:18:04 -04:00
email.ts feat(design): nav/visual overhaul — brand layer, /status route, KPI dashboard, TanStack DataTable 2026-05-03 09:33:13 -04:00
eml-parser.fixtures.ts test(16-01): add failing tests for parseEml/parseAuthResults/extractUrls/buildBodyPreview 2026-07-15 10:28:22 -04:00
eml-parser.test.ts feat(16-01): implement parseEml, parseAuthResults, extractUrls, buildBodyPreview 2026-07-15 10:30:18 -04:00
eml-parser.ts feat(16-01): implement parseEml, parseAuthResults, extractUrls, buildBodyPreview 2026-07-15 10:30:18 -04:00
engagement-sync-service.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
entity-sync.ts fix(quick-260521-foj-02): defensively nullify ticket company_id for missing companies 2026-05-21 11:22:33 -04:00
integration-health-alerts.ts feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
integration-health.ts feat(13-02): register PAX8 as a toggleable integration-health row 2026-07-11 09:46:06 -04:00
issue-type-assignment.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
itglue-client.ts feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
itglue-sync-service.ts feat: RMM Overshell, IT Glue audit/write-back, LogLift, link-aware bundles, dashboard overhaul 2026-05-03 07:13:18 -04:00
llm-analyzer.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
mimecast-blast-radius.test.ts feat(17-01): build mimecast-blast-radius.ts fan-out orchestration 2026-07-15 14:30:00 -04:00
mimecast-blast-radius.ts feat(17-01): build mimecast-blast-radius.ts fan-out orchestration 2026-07-15 14:30:00 -04:00
mimecast-client.test.ts feat(17-01): add isMimecastConfigured() config gate + test seam 2026-07-15 14:27:47 -04:00
mimecast-client.ts feat(17-01): add isMimecastConfigured() config gate + test seam 2026-07-15 14:27:47 -04:00
mimecast-sync-service.ts feat(engagement): replace Graph email counts with real-time mimecast data 2026-06-02 20:25:14 -04:00
morning-summary-service.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
msgraph-client.ts feat(08-01): add getUserPhotoBytes() to MsGraphClient 2026-05-07 20:39:42 -04:00
msgraph-factory.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
pax8-client.test.ts test(12-02): add pagination + GET-only tests for listAllInvoices/listAllInvoiceItems 2026-07-10 22:46:12 -04:00
pax8-client.ts fix(12): WR-03 follow-up - fix TS type narrowing on token return 2026-07-11 07:24:15 -04:00
pax8-company-match-resolver.test.ts test(14-02): add failing test for resolvePax8CompanyMatch 2026-07-11 14:28:44 -04:00
pax8-company-match-resolver.ts docs(14-02): drop literal candidate_company_ids mention from resolver docstring 2026-07-11 14:29:43 -04:00
pax8-company-matcher.test.ts test(12-03): add pax8-company-matcher unit tests 2026-07-10 22:47:43 -04:00
pax8-company-matcher.ts fix(12): WR-02 rotate matchPax8Companies eligibility ordering and raise the limit to prevent starvation 2026-07-11 07:22:25 -04:00
pax8-factory.test.ts test(10-01): add failing tests for pax8-factory config check + singleton 2026-07-10 17:33:52 -04:00
pax8-factory.ts feat(10-01): implement pax8-factory config check + singleton 2026-07-10 17:33:56 -04:00
pax8-sync-service.test.ts fix(12): CR-02 stop folding company-match review counts into sync_history.records_deleted 2026-07-11 07:18:27 -04:00
pax8-sync-service.ts fix(12): WR-01 isolate per-row failures in pax8 sync loops so one bad record can't abort the batch 2026-07-11 07:20:54 -04:00
performance-optimizer.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
personal-channels.ts fix(09.1-01): pulse-me- prefix, company ntfy server + bearer auth for personal channels 2026-05-11 06:42:52 -04:00
phishing-detector.test.ts test(15-02): add failing tests for phishing pattern matcher + content hash 2026-07-15 07:41:14 -04:00
phishing-detector.ts fix(15): exclude soft-deleted notes/time entries from phishing evidence 2026-07-15 08:17:07 -04:00
phishing-eml-service.test.ts test(16-03): phishing-eml-service.test.ts orchestration coverage (mocked I/O) 2026-07-15 10:39:59 -04:00
phishing-eml-service.ts feat(16-03): phishing-eml-service.ts orchestration (list->select->fetch->B2->parse->persist) 2026-07-15 10:37:35 -04:00
phishing-sweep-service.ts feat(18-02): wire groupReportIntoCampaign into webhook + cron sweep paths 2026-07-15 19:31:18 -04:00
pipeline-engine.ts feat: IT Glue integration, workflow engine, pipelines, Zabbix WAN, notification channels, backup status UI improvements, nav alignment fixes 2026-02-27 14:52:14 -05:00
postgres-client.ts fix: prevent sync from nullifying assigned_resource_id on tickets 2026-04-05 08:55:41 -04:00
qbo-client.ts feat(260519-0oz-01): add QboPaymentCreatePayload, QboDepositCreatePayload types and createPayment/createDeposit methods to QboClient 2026-05-19 00:36:01 -04:00
qbo-sync-service.ts feat: QuickBooks Online integration 2026-03-17 07:39:55 -04:00
rate-limiter.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
redis-client.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00
rmm-device-resolver.ts feat: Veeam RPO analysis, comparison, ticket analysis + company teams table 2026-04-29 09:16:46 -04:00
robotic-classifier.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
salesbldr-client.ts feat: add authentication, user management, and admin features 2026-01-31 12:43:14 -05:00
sentinelone-client.ts feat: Add SentinelOne integration 2026-02-27 05:31:31 -05:00
sentinelone-sync-service.ts feat: Add SentinelOne integration 2026-02-27 05:31:31 -05:00
sync-progress-tracker.ts Add comprehensive admin features and multi-system integration 2025-11-19 14:18:16 -05:00
sync-scheduler.ts feat(15-03): register phishing-sweep schedule + migration 098 2026-07-15 07:49:01 -04:00
sync-service.ts feat: add Autotask tags sync (tag groups, tags, ticket tag associations) 2026-03-20 09:22:40 -04:00
ticket-digest-service.ts fix(09.1-01): pulse-me- prefix, company ntfy server + bearer auth for personal channels 2026-05-11 06:42:52 -04:00
ticket-reconciliation-service.ts feat(260521-fci-01): add ticket reconciliation service + API route 2026-05-21 11:08:24 -04:00
ticket-workflow-engine.ts feat: IT Glue integration, workflow engine, pipelines, Zabbix WAN, notification channels, backup status UI improvements, nav alignment fixes 2026-02-27 14:52:14 -05:00
triage-validator.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
user-timezone.ts feat(07.1-03): add lib/services/user-timezone.ts helper 2026-05-07 08:01:23 -04:00
veeam-analysis-state.ts feat: Veeam RPO analysis, comparison, ticket analysis + company teams table 2026-04-29 09:16:46 -04:00
veeam-client.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
veeam-compliance-service.ts feat: Veeam VSPC backup integration - sync, compliance, UI 2026-02-11 21:04:28 -05:00
veeam-factory.ts feat: Veeam VSPC backup integration - sync, compliance, UI 2026-02-11 21:04:28 -05:00
veeam-rpo-service.ts feat: Veeam RPO analysis, comparison, ticket analysis + company teams table 2026-04-29 09:16:46 -04:00
veeam-sync-service.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
webhook-service.ts feat(18-02): wire groupReportIntoCampaign into webhook + cron sweep paths 2026-07-15 19:31:18 -04:00
workflow-engine.ts feat: Autotask webhook integration, TicketNotes, Datto RMM, workflow engine, Veeam agents/alarms, AI triage, misc improvements 2026-02-20 10:28:15 -05:00
zabbix-client.ts feat: QuickBooks Online integration 2026-03-17 07:39:55 -04:00
zabbix-wan-utils.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
zoom-client.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
zoom-factory.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00
zoom-sync-service.ts feat: Morning NOC Summary adaptive card for Teams 2026-03-11 09:34:51 -04:00