Skip to content

feat(login): derive the managed API URL - #371

Merged
fazpu merged 6 commits into
mainfrom
feat/device-login-hostname
Sep 3, 2026
Merged

feat(login): derive the managed API URL#371
fazpu merged 6 commits into
mainfrom
feat/device-login-hostname

Conversation

@fazpu

@fazpu fazpu commented Sep 3, 2026

Copy link
Copy Markdown
Member

Problem

remember login already receives the deployment hostname and its readiness from the token host, but ignored both. Managed users therefore had to pass an API URL the control plane had already supplied.

What this does

  • derives https://{data_plane_hostname} when --api-url is absent and the advertised hostname is live
  • keeps explicit --api-url as the winning self-host/local override
  • refuses a not-yet-live hostname with the hostname and a clear retry message
  • preserves the existing missing-hostname request for --api-url
  • withdraws a newly minted token when either refusal occurs and writes no credential file

How verified

  • uv run pytest src/tests/surfaces/test_login.py -q — 58 passed
  • uv run lint-imports
  • uv run ruff check src/ benchmarks/
  • uv run ruff format --check src/ benchmarks/
  • uv run pyright src/ benchmarks/
  • the monolithic local suite is not a reliable DB gate in this checkout: its shared-schema migration fixtures deadlock; split GitHub CI lanes are authoritative

Docs

The CLI reference now shows the one-flag managed form, retains the two-flag self-host form, and documents both refusal cases.

Contributor agreement

Use the live data-plane hostname already returned by the token host when --api-url is absent. Refuse not-yet-live or missing hostnames without writing credentials, while preserving the explicit override for self-hosted and local deployments.
@fazpu
fazpu force-pushed the feat/device-login-hostname branch from 7750635 to 1c96c44 Compare September 3, 2026 18:01
Normalize and reject malformed managed hostnames, accept nullable readiness from the separately deployed token service, and preserve predecessor credentials on refusal. Document why only an explicit API URL overrides the credential-bound hostname.
Validate the advertised endpoint as a real DNS or IP authority, quote it in errors, and warn when an environment URL will override the stored endpoint. Complete the token response design and prove refusal revokes the new bearer.
Guard httpx's lazy IDNA decoding so every malformed advertised host becomes a normal adoption refusal and the freshly minted credential is withdrawn. Record all hostname refusal outcomes in the normative recovery table.
Accept underscore labels and one DNS root dot while refusing a second, document the exact authority shape, and tell users how to override an invalid advertised host.
Reject empty-userinfo and trailing-path forms that URL parsing normalizes away, cover both in the refusal suite, and keep the adoption recovery comment exact.
@fazpu
fazpu merged commit d353944 into main Sep 3, 2026
12 checks passed
@fazpu
fazpu deleted the feat/device-login-hostname branch September 3, 2026 18:59
@fazpu fazpu mentioned this pull request Sep 3, 2026
1 task
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