Skip to content

refactor!: unify local and hosted into a single deployment flow#348

Merged
beubax merged 4 commits into
mainfrom
refactor/unify-deployment-flow
May 29, 2026
Merged

refactor!: unify local and hosted into a single deployment flow#348
beubax merged 4 commits into
mainfrom
refactor/unify-deployment-flow

Conversation

@manojbajaj95
Copy link
Copy Markdown
Collaborator

Summary

Collapses the local/hosted deployment-mode split into one flow, identical for every deployment — the former hosted flow. There is no longer a deployment mode.

New flow: authsome init registers an Identity and the daemon returns a browser claim URL → the user registers (or logs in) with email + password (first Principal created becomes admin, rest are users) → that Principal confirms the claim → PoP-authenticated calls are then authorized.

Why

Two code paths doubled the test surface, scattered if get_deployment_mode() == "hosted" branches across five files, and meant "local and hosted behave the same" was asserted in prose (ADR 0006) but never enforced in code — free to drift. The synthetic local@authsome.internal principal also let a second local identity silently inherit the admin principal.

Changes

  • Remove AUTHSOME_DEPLOYMENT_MODE, get_deployment_mode(), LOCAL_PRINCIPAL_EMAIL, the Local*/Hosted* resolver + bootstrap classes, and the AuthService(deployment_mode=...) parameter.
  • OwnershipResolver and IdentityBootstrapService become single concrete (claim-based) classes.
  • Admin gating is purely role-based: non-admin principals are blocked in every deployment (previously implicitly allowed in local mode).
  • Server UI always requires a hosted browser session; remove the vestigial HealthResponse.mode field.
  • CLI ensure_identity_ready was already mode-agnostic; it now prints the claim URL to stderr for headless use.
  • Add ADR 0007 recording the decision; amend ADR 0006 and CONTEXT.md.

Net −183 lines across 21 files.

⚠️ Breaking change

Existing local installs have an Identity registered with no accepted claim and data under the local@authsome.internal principal/vault. After upgrading, those identities are rejected until the user registers a Principal (email+password) and claims the Identity. A vault-rebind migration is possible but intentionally out of scope here.

Test plan

  • uv run pytest352 passed
  • uv run ruff check / ruff format — clean
  • uv run ty check src/ — clean
  • pre-commit run --all-files — passed
  • Integration tests exercise the full HTTP claim path end to end (register → claim page → /auth/register → confirm → PoP whoami).
  • Zero remaining references to any deployment-mode symbol in src/ or tests/.

🤖 Generated with Claude Code

manojbajaj95 and others added 4 commits May 29, 2026 13:18
The daemon branched on AUTHSOME_DEPLOYMENT_MODE and ran two parallel
implementations of nearly every ownership concept. "Local and hosted
behave the same" was asserted in prose (ADR 0006) but never enforced in
code, so the paths were free to drift, and the synthetic local principal
let a second local identity silently inherit the admin principal.

Collapse to one flow, identical for every deployment: authsome init
registers an identity and gets back a browser claim URL; the user
registers email+password (first principal becomes admin); that principal
confirms the claim; PoP calls are then authorized.

- Remove AUTHSOME_DEPLOYMENT_MODE, get_deployment_mode(),
  LOCAL_PRINCIPAL_EMAIL, the Local*/Hosted* resolver and bootstrap
  classes, and the AuthService(deployment_mode=...) parameter.
- OwnershipResolver and IdentityBootstrapService become single concrete
  classes (the former hosted, claim-based implementations).
- Admin gating is purely role-based: non-admin principals are blocked in
  every deployment (previously implicitly allowed in local mode).
- The server UI always requires a hosted browser session; remove the
  vestigial HealthResponse.mode field.
- CLI ensure_identity_ready was already mode-agnostic; it now prints the
  claim URL to stderr for headless use.

Add ADR 0007 recording the decision; amend ADR 0006 and CONTEXT.md.

BREAKING CHANGE: existing local installs have an unclaimed identity under
local@authsome.internal and are rejected until the user registers a
principal (email+password) and claims the identity.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: d31cf246f6f2
The first protected command now registers the identity and blocks on a
browser email+password registration + claim (first account = admin),
matching the single deployment flow. Also drop the removed `mode` field
from the daemon health block.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: 68b4ca3c1fc0
The guide had drifted well beyond the deployment-flow change:

- Commands moved under the `provider` and `connections` groups
  (`provider list`, `provider inspect`, `provider register|remove|revoke`,
  `connections inspect`, `connections set-default`). Update every invocation.
- Remove the documented `get`, `export`, `--show-secret`, and `--json`
  commands/flags — none exist. `connections inspect` is always redacted
  and there is no human-table mode; output is always JSON (`{"v": 1, ...}`).
- Add sections for `scan`, `profile`, and `daemon restart`/`logs`.
- Note admin-only operations (register/revoke) and JSON-shaped expected
  output throughout; fix the `daemon status` health block (no `mode`).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Entire-Checkpoint: b68c1ae5d66c
@beubax beubax merged commit 2e7ff5c into main May 29, 2026
4 checks passed
@beubax beubax deleted the refactor/unify-deployment-flow branch May 29, 2026 08:12
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