Repository navigation
an account adopts a login the host staged - #4
Merged
Merged
Conversation
`adoptLogin(from:)` on `Account`. The host runs the tool's login against a throwaway directory and hands that directory over; everything after is the tool's. The split falls where the knowledge does. Running an interactive login is the host's: it knows how to give a subprocess a terminal, and the only tool-specific inputs — `authLoginCommand` and the config-dir variable — are already on the tool's own description, so it needs no further knowledge to do it. What it cannot know is what the tool then wrote. Which file holds a credential, or which entry in a platform keychain, how that entry is named, and what travels with it, has never been expressible as a path. So the host passes one and asks nothing more. On `Account` rather than the tool, for the reason the others are: the caller is holding the account the login is for. The directory's lifetime is the host's and may end the moment the call returns, so a conformer copies rather than remembering where it was. A test deletes the directory afterwards and checks the login survived. `adoptLogin` throws when no usable login was found. That is the failure worth legislating for: reported as done, it hands someone an account they believe works and will not discover otherwise until they try to use it. Verified the tests catch it — a conformer that returns quietly instead of throwing fails immediately, and that lenient version is exactly what someone writes by accident. 132 tests pass.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The host runs the tool's login against a throwaway directory and hands that directory over. Everything after is the tool's.
Why the split falls there
Running an interactive login is the host's: it knows how to give a subprocess a terminal and a foreground process group, and the only tool-specific inputs —
authLoginCommandand the config-dir variable — are already on the tool's own description. It needs no further knowledge to do it.What it cannot know is what the tool then wrote. Which file holds a credential, or which entry in a platform keychain, how that entry is named, what else travels with it — none of that has ever been expressible as a path. So the host passes one and asks nothing more.
On
Accountrather than the tool, for the same reason as the others: the caller is holding the account the login is for.The directory is a throwaway
Its lifetime is the host's and may end the moment the call returns, so a conformer copies rather than remembering where it was. A test deletes the directory afterwards and checks the login survived.
The failure worth legislating for
adoptLoginthrows when no usable login was found.Reported as done instead, it hands someone an account they believe works and will not discover otherwise until they try to use it.
Verified the tests catch it: a conformer that returns quietly rather than throwing fails immediately — and that lenient version is exactly what gets written by accident.
Verification
132 tests pass;
-strict-concurrency=complete -warnings-as-errorsis clean.The pinned capability set gains
tool/adoptLogin, which is what that test is for — adding a method means updating it, and that is where documenting the method gets remembered.🤖 Generated with Claude Code