wulf-pulse/lib
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
..
hooks feat(07.1-04): add useUserTimezone client hook 2026-05-07 07:52:16 -04:00
services fix(18-05): decrement origin campaign report_count on migration + diverged create-new (CR-02) 2026-07-16 00:10:45 -04:00
types feat(appgate): add AppGate SDP integration health check and sync service 2026-07-11 09:43:48 -04:00
utils fix(quick-260521-foj-01): widen Companies full sync to fetch all companies 2026-05-21 11:21:48 -04:00
auth-client.ts feat: add authentication, user management, and admin features 2026-01-31 12:43:14 -05:00
auth-utils.ts feat(design): nav/visual overhaul — brand layer, /status route, KPI dashboard, TanStack DataTable 2026-05-03 09:33:13 -04:00
auth.ts feat(09-01): add theme column to user table + Better Auth additionalField 2026-05-10 07:22:26 -04:00
bootstrap.ts fix: "user" table writes use "updatedAt" not updated_at 2026-05-10 23:03:36 -04:00
permissions.test.ts fix(auth): stop hasPermission crashing for non-admin ("user") roles 2026-07-12 18:20:36 -04:00
permissions.ts feat(18-01): add phishing permission resource + role grants 2026-07-15 19:23:09 -04:00
status-registry.ts feat(design): nav/visual overhaul — brand layer, /status route, KPI dashboard, TanStack DataTable 2026-05-03 09:33:13 -04:00
utils.ts Restructure: rename to Pulse and move app to root 2025-10-28 23:08:54 -04:00