feat(server): drop primary_brand_domain column (#4159 Stage 2)#4313
Merged
Conversation
Cuts the column entirely after Stage 1 routed reads through getBrandPrimaryDomain. organization_domains.is_primary=true is now the single source of truth for both org-membership inference and brand identity. - migration 472 drops the column - resolver now reads only org_domains.is_primary (fallback removed) - WorkOS webhook auto-promote on org_domains covers what the auto-populate write did - brand-identity, registry-api, member-agents, member-profiles writes removed - PUT /api/me/organization/domains/:domain/primary refuses non-WorkOS sources (with is_primary now driving brand identity, admin-imported rows can't be promoted via member self-service) - API response field preserved via resolver-derived value - one-shot Stage 0 scripts and their tests deleted Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 10, 2026
Open
bokelley
pushed a commit
that referenced
this pull request
May 11, 2026
Regenerated by build; reflects the primary_brand_domain → Linked Domains UI description update committed in #4313 that was not yet reflected in dist. https://claude.ai/code/session_01Qy5CniM5du4RLEDiTadFuJ
This was referenced May 12, 2026
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
Stage 2 of #4159 — drop
member_profiles.primary_brand_domainentirely. After Stage 1 routed every read throughgetBrandPrimaryDomain(resolver-first, column-fallback), this PR cuts the column.organization_domains.is_primary=trueis now the single source of truth for both org-membership inference and brand identity. One row, one write, no more drift between the four overlapping domain columns that started this issue.What's removed
member_profiles.primary_brand_domaincolumn (migration 472)member_profiles—getBrandPrimaryDomainnow reads onlyorganization_domains.is_primarymember_profiles.primary_brand_domainon first verified domain (the auto-promote-to-is_primaryonorganization_domainscovers the same ground in one row)member_profiles/api/me/agentsPOST backfill that setprimary_brand_domainfrom agent hostnamesprimary_brand_domainin the request body (silently ignored — value derived fromorganization_domains.is_primary)What's added
domain_not_workos_verifiedresponse onPUT /api/me/organization/domains/:domain/primaryfor non-WorkOS sources. Withis_primarynow driving brand identity too, an admin-imported "verified" row shouldn't be promotable via member self-service — that would let an admin escalate brand identity by importing a row.API compat
The response field
primary_brand_domainonGET /api/me/member-profileis preserved; its value is now derived from the resolver rather than stored on the profile. HTML clients (member-profile.html, dashboard-agents.html) keep working.Test plan
organization_domains.is_primary=trueinstead of writing the dropped column/api/me/member-profilereturnsprimary_brand_domainderived from the resolver🤖 Generated with Claude Code