Add verified PAT account profiles and explicit default selection (#157 step 2a) #308
Loading…
Reference in a new issue
No description provided.
Delete branch "fj-157-account-profiles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 2a of #157: named, verified PAT account profiles stored next to the existing host entries, plus explicit default selection. Fjord gateway sessions, OIDC refresh/locking, instances and cookies are step 2b, a separate change; #157 stays open until both land.
Each host can now carry named account descriptors (keyed by the exact configured host and the canonical login) and a default pointer under
accounts.<host>inhosts.toml; host URL, API mount and proxy settings stay host-level.fj auth login --account <name>verifies the login with/user, stages a fresh credential under a host/account/pat/generation key, reads it back, and only then atomically publishes the descriptor, so a failed stage, read-back or rename leaves the old metadata and credential untouched. Updating a profile adds a new immutable generation instead of overwriting the live one. A named login without a new token migrates the matching legacy credential after verification, and never switches a different default;fj auth switch <host> --account <name>re-verifies the stored credential and fences the verified host snapshot before moving the pointer. With--account, an eligible environment PAT is used first, otherwise exactly that profile; a missing profile or credential never falls back to another account or host. Legacy host fields and credential keys are retained for at least a release, with no cleanup code.The review rounds also closed: named login reads
--with-tokenstdin exclusively so another host'sFJ_TOKENcan never reach the new host; the maintenance commands (token, refresh, session, setup-git, logout) refuse profiled hosts through the same host resolver the handlers use, and setup-git on a profiled host is rejected with a migration note because the old helper cannot pick an account; all file-backed token writes share one lock; legacy saves reload under the publication lock and apply only their own change; and account names stay out of--debugkeychain diagnostics.Status shows configured counts and a redacted default state. Tests (22 unit, workflow, recovery, overlapping-writer, debug-stderr and sole-host cases) run offline against the 0600 file store with dummy credentials; OS keychain integration and CI coverage are still to be confirmed.
Automated Codex review (read-only) of head
8d1ccf0930.No real findings against the diff or
~/fleet-week/STANDARDS.md. Profile selection, credential maintenance guards, and publication paths preserve the stated invariants.cargo fmt --all -- --checkpassed. Builds and tests were not run.BLOCKING: 0
Reviewed head
8d1ccf0930at 2026-11-10T17:16:52Z by codex exec (read-only sandbox).