Last finding of the review of the default token per forge (#212).
Taking up a token the vault still holds for another server removes the
default that is saved. Whether the vault holds that token was asked when the
address was typed. Removed elsewhere before Save (another window, Windows'
Credential Manager), the saved default was still removed, which left no
default token at all under the new address.
The token is looked for again when Save is pressed. Without it nothing is
changed: the address stays, the saved token stays, and the log says so.
Refs #212
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>
Findings of the review of the previous fix commit (#212).
- What the app remembers by itself (the workspace that was open, Quick
Sync's connection) is written over settings.json as it is on disk at that
moment, those values only. With two windows open, the one that closed last
wrote its whole older copy, which dropped settings saved in the other in
the meantime, among them the address of the default Gitea server. A file
that cannot be read at that moment is left alone, and the log says so.
- A default token the vault still holds for a server can be taken up while
another server is the default. It was refused, so that token could not be
seen or removed without typing a new one. Taking it up removes the other
server's default token, as typing a token for another server does, and the
caption says so and names the accounts that depend on it.
- The Settings token boxes are no longer rewritten while they are typed into
(that could move the caret and scramble the token). The mask is taken out
where the value is read and from what is stored.
- The vault is asked once for each server while an address is typed, and a
credential store that cannot be read just then does not break typing.
- Two assertions that could not fail are replaced.
- ADR 0010.
Refs #212, #216
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>
Findings of the review of the default token per forge (#212).
- A Gitea default token could stay in Credential Manager with nothing in
Settings pointing at it (settings.json not written, or written back by an
older gclo): still used for that server, but not shown and not removable.
An address entered in Settings that already has a default token is now
taken up as the default it is, so it can be seen, replaced and removed.
- Moving the Gitea default to another server stores the new token first and
removes the old one after: a store that fails leaves the old default whole.
- The wizards for editing an account and for saving a Quick Sync connection
take the default token per place, as the wizard for a new account does. A
caller that knows one default token gives GitHub's, and it is offered and
sent for GitHub only. The rule was in the shell; it is in the view model
and has tests.
- "Open where you left off" is written whenever the window closes, not only
when it differs from what was read at the start.
- Messages that tell two servers apart name the whole address, not the host
(two servers can share a host).
- An address typed over and typed back is the server again without the box
being left (Load and Find stayed withheld). A token typed behind the mask
in Settings is stored without the mask's dots.
- A saved token without a server is refused when the Gitea group is made.
- Tests for: servers under a path on one host, a wizard for an account whose
place cannot be used, a token typed with the address taken out, path
recovery while the address is no place, GitHub having no address to edit.
A test on a lookup in flight fails fast instead of waiting for ever.
- README, ADR 0010, threat model T13, comments and test names that still
said "the default token is GitHub's".
Refs #212
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>
Step 5 of Gitea support (#201). Settings was all about GitHub; GitHub and
Gitea are equal options there too.
- Settings has a "Default tokens" section with two groups, named as
everywhere else: GitHub (token) and Gitea (the server's address and its
token). The Gitea address and token are saved, replaced and removed
together; the saved token is never carried to another address, and a token
for an address that cannot be used is not saved (Save is withheld, with the
reason).
- The rule "the default token is a GitHub token" is replaced by: a default
token belongs to one place and is never used for another. It is in the name
of the vault entry: GitHub's is the one it always was, a Gitea server's is
made from the server's address. Asking for the default token of a place
finds the one saved for exactly that place, or none.
- Quick Sync fills in the default token of the place on its card.
- An account that uses the default token gets the one of its own place. The
wizard offers the choice for a place that has one; accounts add and
accounts edit take --use-default-token for any place that has one.
- A workspace is told which place's default token changed, and takes only its
own.
- README, docs/CLI.md, ADR 0010, threat model T16.
Closes#212
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: James Maes <james@kof22.com>