Repository navigation
v7.0.76
Map agent brands: recurse the brand tree
Root cause of "only one agent mapped": the connected brand's direct children are groupings (offices/teams with many users). Each agent's personal 1-user brand sits one or more levels deeper. The one-level scan only saw the single personal brand that happened to be a direct child (updated 1, skipped 6).
Fix: the mapper now walks the whole brand subtree:
- A brand with exactly one user = personal brand (leaf) → mapped
user_id => brand_id, not descended. - A grouping brand (0 or >1 users) → fetched and recursed into to reach the personal brands beneath it.
- Guards: visited-set (no re-fetch/cycles), max depth 8, max 800 fetches.
Every mapping is then matched against agent api_id (whitespace/quote-normalized on both sides) and brand_id assigned to all matches.
Response message now reports: updated / no-match / personal brands found / brands scanned. Debug payload adds stats (fetched, fetch_failed, children_seen).
Version bumped 7.0.75 → 7.0.76.