Skip to content

feat(organizations): add verified domain auto-join - #5437

Merged
jrf0110 merged 5 commits into
mainfrom
feature/verified-domains
Aug 26, 2026
Merged

jrf0110 merged 5 commits into
mainfrom
feature/verified-domains

Conversation

@jrf0110

@jrf0110 jrf0110 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

image
  • add WorkOS-backed verified domain claims with canonical validation, ownership constraints, lifecycle auditing, and organization settings UI
  • automatically add matching authenticated users as ordinary organization members across browser, WorkOS SSO, and native authentication
  • prefer the verified-domain organization after sign-in while preserving personal accounts, unrelated memberships, explicit destinations, and removal tombstones

Validation

  • 11 focused Jest suites, 269 tests passed
  • pnpm --filter web typecheck
  • scripts/typecheck-all.sh --changes-only
  • pnpm --filter web lint
  • pnpm --filter @kilocode/db exec drizzle-kit check
  • pnpm format:check
  • pnpm drizzle generate reports no schema changes
  • git diff --check

Remaining validation gaps

  • pnpm drizzle:verify-bootstrap exits before PostgreSQL receives SQL with a non-diagnostic Drizzle undefined error; migration consistency and database-backed feature tests pass
  • WorkOS behavior is covered with provider mocks rather than a live verification flow
  • popup and responsive behavior have component coverage but no browser smoke test

Comment thread apps/web/src/lib/user/server.ts
Comment thread apps/web/src/components/organizations/VerifiedDomainsCard.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/lib/organizations/verified-domain-service.ts 292 Soft-deleted organizations permanently keep domain claims
apps/web/src/lib/user/server.ts 951 A proven sign-in can auto-join using an unproven primary email
Files Reviewed (31 files)
  • .kilo/skills/specs/SKILL.md
  • .specs/verified-domains.md
  • apps/web/src/app/api/auth/native/token/route.test.ts
  • apps/web/src/app/api/auth/native/token/route.ts
  • apps/web/src/app/api/profile/route.test.ts
  • apps/web/src/app/api/profile/route.ts
  • apps/web/src/app/users/after-sign-in/route.test.ts
  • apps/web/src/components/organizations/OrganizationDashboard.tsx
  • apps/web/src/components/organizations/VerifiedDomainsCard.test.ts
  • apps/web/src/components/organizations/VerifiedDomainsCard.tsx
  • apps/web/src/lib/organizations/organizations.ts
  • apps/web/src/lib/organizations/verified-domain-destination.test.ts
  • apps/web/src/lib/organizations/verified-domain-destination.ts
  • apps/web/src/lib/organizations/verified-domain-membership.test.ts
  • apps/web/src/lib/organizations/verified-domain-membership.ts
  • apps/web/src/lib/organizations/verified-domain-service.ts - 1 issue
  • apps/web/src/lib/organizations/verified-domain.test.ts
  • apps/web/src/lib/organizations/verified-domain.ts
  • apps/web/src/lib/user/server-signin-callback.test.ts
  • apps/web/src/lib/user/server.test.ts
  • apps/web/src/lib/user/server.ts - 1 issue
  • apps/web/src/lib/user/sso.test.ts
  • apps/web/src/lib/user/sso.ts
  • apps/web/src/routers/organizations/organization-router.ts
  • apps/web/src/routers/organizations/organization-sso-router.ts
  • apps/web/src/routers/organizations/organization-verified-domains-router.test.ts
  • apps/web/src/routers/organizations/organization-verified-domains-router.ts
  • packages/db/src/migrations/0231_flaky_manta.sql
  • packages/db/src/migrations/meta/_journal.json
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.ts

Fix these issues in Kilo Cloud

Previous Review Summaries (4 snapshots, latest commit 928064c)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 928064c)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • apps/web/src/lib/organizations/verified-domain-service.ts
  • apps/web/src/routers/organizations/organization-verified-domains-router.test.ts

Previous review (commit bf86a30)

Status: No Issues Found | Recommendation: Merge

Files Reviewed (31 files)
  • .kilo/skills/specs/SKILL.md
  • .specs/verified-domains.md
  • apps/web/src/app/api/auth/native/token/route.test.ts
  • apps/web/src/app/api/auth/native/token/route.ts
  • apps/web/src/app/api/profile/route.test.ts
  • apps/web/src/app/api/profile/route.ts
  • apps/web/src/app/users/after-sign-in/route.test.ts
  • apps/web/src/components/organizations/OrganizationDashboard.tsx
  • apps/web/src/components/organizations/VerifiedDomainsCard.test.ts
  • apps/web/src/components/organizations/VerifiedDomainsCard.tsx
  • apps/web/src/lib/organizations/organizations.ts
  • apps/web/src/lib/organizations/verified-domain-destination.test.ts
  • apps/web/src/lib/organizations/verified-domain-destination.ts
  • apps/web/src/lib/organizations/verified-domain-membership.test.ts
  • apps/web/src/lib/organizations/verified-domain-membership.ts
  • apps/web/src/lib/organizations/verified-domain-service.ts
  • apps/web/src/lib/organizations/verified-domain.test.ts
  • apps/web/src/lib/organizations/verified-domain.ts
  • apps/web/src/lib/user/server-signin-callback.test.ts
  • apps/web/src/lib/user/server.test.ts
  • apps/web/src/lib/user/server.ts
  • apps/web/src/lib/user/sso.test.ts
  • apps/web/src/lib/user/sso.ts
  • apps/web/src/routers/organizations/organization-router.ts
  • apps/web/src/routers/organizations/organization-sso-router.ts
  • apps/web/src/routers/organizations/organization-verified-domains-router.test.ts
  • apps/web/src/routers/organizations/organization-verified-domains-router.ts
  • packages/db/src/migrations/0224_lonely_tombstone.sql
  • packages/db/src/migrations/meta/_journal.json
  • packages/db/src/schema-types.ts
  • packages/db/src/schema.ts

Previous review (commit 2b984dc)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/web/src/lib/user/server.ts 950 Unproven social emails still trigger verified-domain auto-join

WARNING

File Line Issue
apps/web/src/components/organizations/VerifiedDomainsCard.tsx 261 Closed or unmounted verification popup is not cleaned up
Files Reviewed (4 files)
  • apps/web/src/components/organizations/VerifiedDomainsCard.tsx - 1 issue
  • apps/web/src/lib/organizations/verified-domain-service.ts - 0 issues
  • apps/web/src/lib/user/server.ts - 1 issue
  • apps/web/src/routers/organizations/organization-verified-domains-router.test.ts - 0 issues

Fix these issues in Kilo Cloud

Previous review (commit 6228d1d)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 1
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
apps/web/src/lib/user/server.ts 950 Unproven social emails still trigger verified-domain auto-join

WARNING

File Line Issue
apps/web/src/components/organizations/VerifiedDomainsCard.tsx 261 Closed or unmounted verification popup is not cleaned up
Files Reviewed (31 files)
  • .kilo/skills/specs/SKILL.md - 0 issues
  • .specs/verified-domains.md - 0 issues
  • apps/web/src/app/api/auth/native/token/route.test.ts - 0 issues
  • apps/web/src/app/api/auth/native/token/route.ts - 0 issues
  • apps/web/src/app/api/profile/route.test.ts - 0 issues
  • apps/web/src/app/api/profile/route.ts - 0 issues
  • apps/web/src/app/users/after-sign-in/route.test.ts - 0 issues
  • apps/web/src/components/organizations/OrganizationDashboard.tsx - 0 issues
  • apps/web/src/components/organizations/VerifiedDomainsCard.test.ts - 0 issues
  • apps/web/src/components/organizations/VerifiedDomainsCard.tsx - 1 issue
  • apps/web/src/lib/organizations/organizations.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain-destination.test.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain-destination.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain-membership.test.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain-membership.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain-service.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain.test.ts - 0 issues
  • apps/web/src/lib/organizations/verified-domain.ts - 0 issues
  • apps/web/src/lib/user/server-signin-callback.test.ts - 0 issues
  • apps/web/src/lib/user/server.test.ts - 0 issues
  • apps/web/src/lib/user/server.ts - 1 issue
  • apps/web/src/lib/user/sso.test.ts - 0 issues
  • apps/web/src/lib/user/sso.ts - 0 issues
  • apps/web/src/routers/organizations/organization-router.ts - 0 issues
  • apps/web/src/routers/organizations/organization-sso-router.ts - 0 issues
  • apps/web/src/routers/organizations/organization-verified-domains-router.test.ts - 0 issues
  • apps/web/src/routers/organizations/organization-verified-domains-router.ts - 0 issues
  • packages/db/src/migrations/0222_flat_cardiac.sql - 0 issues
  • packages/db/src/migrations/meta/_journal.json - 0 issues
  • packages/db/src/schema-types.ts - 0 issues
  • packages/db/src/schema.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by grok-4.6 · Input: 144.6K · Output: 29.5K · Cached: 1.7M

Review guidance: REVIEW.md from base branch main

@jrf0110
jrf0110 force-pushed the feature/verified-domains branch from 2b984dc to bf86a30 Compare August 24, 2026 20:08

@pandemicsyn pandemicsyn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, that refresh/removal race my bot flagged seems very edge case. Not sure this would trigger in the real world. If it takes excessive locking or something to box out that case it might not be worth addressing.

Comment thread apps/web/src/lib/organizations/verified-domain-service.ts Outdated
@jrf0110
jrf0110 force-pushed the feature/verified-domains branch from 928064c to 8f079e0 Compare August 26, 2026 15:35
@jrf0110
jrf0110 merged commit 01b8901 into main Aug 26, 2026
11 of 12 checks passed
@jrf0110
jrf0110 deleted the feature/verified-domains branch August 26, 2026 16:08
lambertjosh added a commit to Kilo-Org/kilocode that referenced this pull request Sep 14, 2026
Verify domain status refresh against Kilo-Org/cloud#5437 and optional auto-commit against cloud#5529. Follow compaction setting move #14045 and current Mermaid support. Remove MiniMax free IDs absent from the live catalog on 2026-09-14, not merely from the expired cloud#5588 provider override: cloud#5788 and cloud#5797 had continued them through OpenRouter.
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.

2 participants