- Shipped
- 22 Julai 2026, 20:23 UTC
- Author
- Kamo
- Commit
- c09cad2
assignLead had zero callers and had never run in production. Before wiring the bulk reassignment path to it, give it the guarantees that path needs: - take orgId and verify BOTH the lead and the new assignee belong to it, so a reassignment can't reach across tenants (reported as "not found" rather than "forbidden" so the error can't be used to probe foreign lead ids) - lock the row with findByUidForUpdate: a manual reassignment and a concurrent pool-accept target the same lead and would otherwise interleave into a lost update - clear the pool flags, mirroring CreditLeadAssignmentService. A lead marked for auto-assignment otherwise stays in the pool after being claimed by hand and gets taken out from under its new owner - publish chat routing, as updateLead already does, so the borrower's open live chat follows the lead instead of staying with the previous officer Also add the LEADS_ASSIGNED canonical template. The key must be in CANONICAL_KEYS or it can never be seeded and can never self-heal, and every send returns a permanent 404.