Surface the FJ_TOKEN fallback when the OS keychain is unavailable #96
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What
In
src/auth/mod.rs::load_token, treat keychain failures that mean "no usable secret is reachable here" (service unavailable, no Secret Service / D-Bus, locked keychain, access denied, and anEntry::newfailure at path (a)) the same waykeyring::Error::NoEntryis treated today: returnOk(None)instead of propagating the raw error. That lets the existing actionable message insrc/client/resolve.rs:27-36("no token stored for host '...'. Runfj auth login --host ...or set FJ_TOKEN for this process.") be what the user sees on headless/CI machines. Match the relevantkeyring::Errorvariants explicitly so a genuinely unexpected error still propagates, and log the underlying platform cause under--debugbefore returningOk(None)so diagnosis is not lost.Why
rasterstate/fj#93: when
FJ_TOKENis unset and the OS keychain is unreachable (headless container with no Secret Service, a Login keychain locked over SSH, or a copiedhosts.tomlon a machine that never ranfj auth login), every authenticated command dies with a raw keychain error and never mentions theFJ_TOKENlever, even though that lever is documented inCLAUDE.mdand used by this repo's own CI. The helpful hint only fires onkeyring::Error::NoEntry; any other keychain error propagates through?. CI and remote dev are exactly where teams evaluate a forge CLI and exactly where the keychain is absent, so the current behavior reads as "fj is broken in containers" and is a silent adoption cliff for the headless buyer.Acceptance
FJ_TOKENunset, an authenticated command prints the actionableresolve.rsmessage namingFJ_TOKEN, not a raw keychain error.FJ_TOKENmakes the same command succeed without touching the keychain (unchanged behavior).--debug.Ok(None)mapping (e.g. via keyring's mock store or an injected error).cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings, andcargo test --allpass.Dependencies
none
Out of scope
Size
S