Skip to content

feat(member-profile): orphan-adoption decision prompt in brand-identity form - #3185

Merged
bokelley merged 2 commits into
mainfrom
bokelley/orphan-adoption-ux
Apr 25, 2026
Merged

bokelley merged 2 commits into
mainfrom
bokelley/orphan-adoption-ux

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Surfaces the orphan-adoption decision in the dashboard. When the server returns 409 `orphan_manifest_decision_required` (the contract added in #3168), the brand-identity form now shows an inline prompt naming the prior owner and offering Adopt / Start fresh / Cancel buttons. The chosen action re-fires the save with `adopt_prior_manifest` set explicitly.

Why

#3168 forced the orphan decision to be explicit at the API. But `/member-profile` only showed a generic "failed to save" error when the 409 came back — a member trying to claim a previously-registered domain had no way to actually pick. The whole design was invisible to the people it was meant to serve.

What's in the diff

`server/public/member-profile.html`:

  • New hidden `#orphan-decision-prompt` panel between the brand summary and the edit form
  • `saveBrandIdentity` detects 409 `orphan_manifest_decision_required`, captures the pending save context, and shows the prompt populated with the prior owner id from the response
  • Adopt button re-calls saveBrandIdentity with `adoptPriorManifest: true`; Start fresh re-calls with `false`; Cancel dismisses
  • Success message branches on `claimed_orphaned_brand` + `kept_prior_manifest` so the member sees "adopted prior identity" vs "started fresh"

Test plan

  • All 4 `<script>` blocks parse cleanly via `new Function(...)` smoke check
  • Type-check passes (HTML-only change but verified to be safe)
  • 834 unit tests pass
  • Manual reviewer verification needed — couldn't end-to-end test without a real orphaned brand row in the DB. To test in staging:
    1. Relinquish a test brand: `DELETE /api/brands/hosted/{test-domain}`
    2. As a different org member with that profile linked, open `/member-profile`, click Edit on the brand identity, enter a logo URL, Save
    3. Confirm the orphan prompt appears, Adopt button preserves prior manifest + applies new logo, Start fresh wipes and applies new logo

Out of scope

  • Proactive prompt before the user submits (would require the GET endpoint to surface orphan state — separate change). The reactive 409-handling shipped here matches the API contract.

🤖 Generated with Claude Code

…ty form

#3168 made adopt-vs-clear an explicit decision in the API (409 with
code orphan_manifest_decision_required), but the dashboard form only
surfaced that as a generic error message. A member trying to claim a
previously-registered domain had no way to pick.

This commit adds the inline prompt:

* Hidden #orphan-decision-prompt panel above the brand-edit form,
  shown when the server returns 409 + the orphan code.
* saveBrandIdentity captures the pending save context, pops the
  prompt with the prior owner id, and re-fires when adopt or fresh
  is clicked. Cancel dismisses without writing.
* Success message now reads "adopted prior identity" or "started
  fresh" so members can confirm which path landed.

Backend was already wired (#3168). This is the UX surface that makes
the design usable.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…click

Security-reviewer (Low/defense-in-depth): user-facing prompt no longer
echoes prior_owner_org_id back. The 409 response still includes it for
support diagnostics and tooling, but a member who has never seen that
id has no way to act on it, and a screenshotted prompt won't leak the
prior owner's id externally.

Code-reviewer (style): switched orphan prompt buttons from
DOMContentLoaded-wired listeners to inline onclick, matching the rest
of the file's house style. Dropped the now-unused id attributes and
DOMContentLoaded handler.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit 6c807b6 into main Apr 25, 2026
12 checks passed
@bokelley
bokelley deleted the bokelley/orphan-adoption-ux branch April 25, 2026 17:19
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