Repository navigation
feat(brand-claim): chat tools + member-profile UI for domain challenge - #3224
Conversation
|
Issue #3229 proposes conditional rendering of the Generated by Claude Code |
|
Issue #3231 proposes adding a Generated by Claude Code |
|
Issue #3230 proposes a copy-all IT-handoff button, challenge expiry/issued-at surfacing, and a reissue button — same Generated by Claude Code |
|
Issue #3228 proposes surfacing the brand-claim panel from the not-linked state when PUT Generated by Claude Code |
…hallenge Chat tools `request_brand_domain_challenge` / `verify_brand_domain_challenge` in the member tool set. Member-profile.html gains a DNS-TXT panel (admin/owner- only) so members can claim a domain registered to another org without leaving the app. Pulls the WorkOS orchestration out of the routes into services/brand-claim.ts so chat handlers and HTTP handlers share one implementation of the issue/verify flow. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Security M1: callerIsOrgAdmin and resolveBrandClaimOrgOr401 now use
resolveUserRole so inactive/pending memberships can't pass the gate. A
removed admin must not be able to claim a brand on the org that
removed them.
- HTTP response shape: restore { brand } object on /verify success and
human-readable error strings + domain field across error paths so the
routes match what shipped in #3189. Add machine-readable code field
alongside error so chat consumers can branch without prose matching.
- Anti-loop: 60s in-process verify cooldown + explicit STOP guidance in
chat handler markdown when WorkOS returns still_pending.
- Surface prior_manifest_exists from issue so chat callers can prompt
the user about the adopt-vs-fresh decision; flow through to verify
tool description as the precondition for adopt_prior_manifest=true.
- Tighten tool descriptions with explicit "Do NOT use when" clauses to
stop speculative LLM calls.
- Hoist dynamic imports in member-tools.ts to top of file; brandDb
becomes a module-scope singleton matching memberDb / orgDb pattern.
- UI: copyDomainClaimField receives the button via inline onclick so it
no longer depends on event.target inside a microtask. toggleDomainClaim
tracks open state in JS rather than reading display style.
- Service unit tests (16 cases) covering invalid/shared-platform/eTLD,
collision disambiguation, idempotent re-issue, prior_manifest_exists
detection, no_challenge, still_pending, success+brand, and the
cooldown.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Caps verifyAttemptTimes at 10K entries with expired-first eviction so a buggy admin client can't grow the in-process map without limit. Drops "the LLM should not poll" wording from the still_pending cooldown message — it ships through the HTTP /verify path too and reads weird to non-chat consumers. Anti-loop guidance for the LLM still lives in the chat handler markdown where it belongs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
dac16d9 to
e01e7f4
Compare
Summary
Follow-ups from #3189 (WorkOS-backed domain claim challenge):
request_brand_domain_challengeandverify_brand_domain_challengeare exposed in the member tool set so an org admin can run the DNS-TXT claim flow inside Addie without leaving the chat./member-profile(admin/owner only) that calls the existing/brand-claim/issueand/brand-claim/verifyendpoints, surfaces the DNS record (Name / Type / Value with copy buttons), and lets the user opt into adopting the prior owner's manifest.routes/member-profiles.tsintoservices/brand-claim.tsso the chat handlers and HTTP handlers share one implementation of issue/verify, including the 422-collision-vs-syntactic disambiguation andisVerifiedState()cast that bypasses the SDK'sOrganizationDomainStatenarrowing weirdness.The chat tool handlers re-check role (admin/owner) via
workos.userManagement.listOrganizationMembershipsbefore running, mirroring the HTTPresolveBrandClaimOrgOr401gate. The UI hides the panel for non-admins so members don't see a button that would 401.Test plan
npm run typecheckcleannpm run test:server-unit— 2215 passed, 34 skipped, 0 failednew Functionsmoke check)/member-profileas admin, click Start → Request DNS challenge → see DNS record fields populate; verify panel hidden when role=memberrequest_brand_domain_challengeand gets DNS instructions; non-admin gets 403-style refusal🤖 Generated with Claude Code