ADR 0025 T6: auth login — origin-aware, prompt-minimal, forge-wide #32

Closed
opened 2026-07-13 15:56:55 +00:00 by hexajon · 0 comments
hexajon commented 2026-07-13 15:56:55 +00:00 (Migrated from codeberg.org)

Rework internal/cmd/setup/ per ADR 0025 §2:

  • Inside a repo: derive the forge from origin (config.OriginForgeURL("")), print "Authenticating to ", skip the URL prompt; outside a repo: prompt as today.
  • Remove the storage-scope select (resolveConfigScope); a login is forge-wide.
  • --global on login → deprecated no-op with notice (MarkDeprecated); logout --global stays functional.
  • Writes: origin-derived login writes NO madtea.url anywhere (backend entry + global madtea.credential-backend marker only); prompted-URL login writes global madtea.url as the no-remote fallback. Git identity (user.name/email): local scope in a repo, global outside.
  • Username via GET /user (config.FetchUser) — already present, keep.
  • ADR 0013 locks stay green: TestSaveConfig_NoBackendRefusesPlaintext, TestPromptToken_NoBackendRefuses.

Also (T2/T4 review follow-ups): SystemdCredsCiphertextInScope (logout_helpers.go:154) still probes the bare madtea.token-enc — teach it the per-host madtea.token-enc-<sanitized-host> keys; DetectURL (git.go) config-first default is fine for the prompt default but document why.

Acceptance: go test ./internal/cmd/setup/ ./internal/config/ green; no scope prompt in any login path.

Part of #30.

Rework `internal/cmd/setup/` per ADR 0025 §2: - Inside a repo: derive the forge from origin (`config.OriginForgeURL("")`), print "Authenticating to <host>", skip the URL prompt; outside a repo: prompt as today. - Remove the storage-scope select (`resolveConfigScope`); a login is forge-wide. - `--global` on login → deprecated no-op with notice (`MarkDeprecated`); logout `--global` stays functional. - Writes: origin-derived login writes NO madtea.url anywhere (backend entry + global `madtea.credential-backend` marker only); prompted-URL login writes global madtea.url as the no-remote fallback. Git identity (user.name/email): local scope in a repo, global outside. - Username via `GET /user` (config.FetchUser) — already present, keep. - ADR 0013 locks stay green: TestSaveConfig_NoBackendRefusesPlaintext, TestPromptToken_NoBackendRefuses. Also (T2/T4 review follow-ups): `SystemdCredsCiphertextInScope` (logout_helpers.go:154) still probes the bare `madtea.token-enc` — teach it the per-host `madtea.token-enc-<sanitized-host>` keys; `DetectURL` (git.go) config-first default is fine for the prompt default but document why. Acceptance: `go test ./internal/cmd/setup/ ./internal/config/` green; no scope prompt in any login path. Part of #30.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
sixfold-space/madtea#32
No description provided.