Skip to content

Add organization merge and domain health monitoring#502

Merged
bokelley merged 1 commit into
mainfrom
bokelley/org-dedup-cleanup
Jan 3, 2026
Merged

Add organization merge and domain health monitoring#502
bokelley merged 1 commit into
mainfrom
bokelley/org-dedup-cleanup

Conversation

@bokelley

@bokelley bokelley commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add organization merge functionality to consolidate duplicate org records
  • Add domain health monitoring to ensure every corporate email domain maps to a known organization
  • Create admin page at /admin/domain-health for visualizing domain health issues
  • Add Addie admin tools: merge_organizations, find_duplicate_orgs, check_domain_health

Details

This implements tools to detect and resolve organization duplicates in the membership system. The core principle: every corporate email domain should map to a known organization (member or prospect).

New Files

  • server/src/db/org-merge-db.ts - Core merge logic with transaction safety
  • server/public/admin-domain-health.html - Admin UI for domain health monitoring

Modified Files

  • server/src/addie/mcp/admin-tools.ts - Added 3 new Addie admin tools
  • server/src/routes/admin/domains.ts - Added /api/admin/domain-health endpoint
  • server/src/routes/admin.ts - Added route for domain health page
  • server/public/admin-sidebar.js - Added nav link

Domain Health Categories

  1. Orphan Domains - Corporate email domains with users but no matching organization
  2. Misaligned Users - Users with corporate emails in personal workspaces
  3. Unverified Organizations - Orgs with members but no verified domain mapping
  4. Domain Conflicts - Multiple organizations claiming the same email domain

Test plan

  • Build passes
  • All existing tests pass
  • Code review completed
  • XSS vulnerabilities addressed with escapeHtml() and encodeURIComponent()
  • Manual test of domain health page with real data

🤖 Generated with Claude Code

Implements tools to detect and resolve organization duplicates in the
membership system, ensuring every corporate email domain maps to a
known organization (member or prospect).

New features:
- Organization merge tool (mergeOrganizations, previewMerge) in db layer
- Addie admin tools: merge_organizations, find_duplicate_orgs, check_domain_health
- Domain Health admin page at /admin/domain-health with:
  - Orphan domains (corporate emails without organizations)
  - Misaligned users (corporate users in personal workspaces)
  - Unverified organizations (orgs without verified domains)
  - Domain conflicts (multiple orgs claiming same domain)
- API endpoint at /api/admin/domain-health

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley force-pushed the bokelley/org-dedup-cleanup branch from e792ff6 to c95cf1b Compare January 3, 2026 19:22
@bokelley bokelley merged commit ba4603a into main Jan 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant