chore(scripts): narrow email_domain backfill to nulls; flag M&A cases for review#4552
Merged
Merged
Conversation
The original script flipped any `organizations.email_domain` that didn't
match `organization_domains.is_primary=true`. Audit on prod revealed
three distinct classes inside that broad definition:
1. `null` — never had a webhook fire / missed migration 468.
Strictly safe to fill from canonical.
2. `www_drift` — Scope3 class. Webhook patched in #4459; opt-in via
`--include-www-drift` if another org regresses.
3. `mismatched` — subsidiary/M&A (LinkedIn↔Microsoft,
EdDomus↔quattroruote.it, Omnicom↔omc.com, Teal↔teal.works,
Cora AI↔noverift.ai). NOT a drift bug. These are
structural modeling questions for `brands.house_domain`
+ `brand_domain_aliases` and possibly separate org
records, not for an automated overwrite.
Default behavior now applies only class (1). Class (3) is reported and
never written. Class (2) requires explicit `--include-www-drift`.
Applied on prod 2026-05-12 12:02 UTC: 7 null cases backfilled (Diageo,
digital opua GmbH x2, harvingupta, Spectrum Reach, TVIQ, Willem LLC).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #4459. The original
sync-email-domain-from-is-primary.tsflipped anyorganizations.email_domainthat didn't matchorganization_domains.is_primary=true. Prod audit showed three distinct classes inside that broad definition; only one is safe to auto-fix.This narrows the default behavior and flags M&A/subsidiary cases for human review instead of overwriting them.
Drift classes
nullDiageo: email_domain=null, canonical=diageo.comwww_driftemail_domainvs canonical differs only by wwwScope3: www.scope3.com vs scope3.com--include-www-driftmismatchedLinkedIn (Microsoft): linkedin.com vs microsoft.comApplied on prod 2026-05-12 12:02 UTC
7 null cases backfilled:
5 mismatched cases NOT touched (filed as #4448 follow-up issue):
Test plan
--apply(null only) writes 7 rows🤖 Generated with Claude Code