Repository navigation
Key logins by the registry without its trailing slash - #1113
Merged
tolgaergin merged 2 commits intoNov 8, 2026
Merged
Conversation
This was referenced Nov 8, 2026
A login was stored under the registry URL exactly as given, so `lpm login --registry https://lpm.dev/` saved a session that a later command for https://lpm.dev didn't see, and `/api/cli/exchange` and the refresh were requested at `//api/...`. The trailing slash couldn't simply be trimmed when the CLI started, since that would have hidden logins already stored under the slashed spelling. lpm-auth now derives every credential key without trailing slashes: the keychain accounts, the encrypted-file keys, the credential authority records, the session lock and the expiry and OTP metadata. When a read finds nothing under that key, it reads the slashed spelling as earlier releases keyed it, and moves what it finds, with its expiry metadata, to the new key under the same store lock. Logout clears both spellings. With that, the CLI trims the registry once when it starts, and the session manager trims what it's given, which fixes every `/api/...` URL built from it. The MCP server derives the same keychain account names and changes with this (lpm-dev/mcp-server). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The move took an access and a refresh credential separately, so one login's access token could pair with another's refresh token, and a login cleared under the registry key made room for the slashed one to return. A slashed login now moves whole, with its session metadata and undone on a partial failure, only while the registry key has no credential or authority record. Clearing a credential under the registry key retires the slashed login. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tolgaergin
force-pushed
the
review/registry-session-keys
branch
from
November 8, 2026 05:42
f677de8 to
a534b64
Compare
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.
Problem
A login was stored under the registry URL exactly as given.
lpm login --registry https://lpm.dev/saved a session that a later command forhttps://lpm.devdidn't see. The exchange and refresh requests went to//api/.... Trimming the slash at startup wasn't possible either: logins already stored under the slashed spelling would have disappeared. That's why the first attempt was reverted in #1099.Change
SessionManager::newtrims what it's given. That fixes every{registry_url}/api/...URL built from it.LPM_REGISTRY_URLwon't find a login the new CLI stored. The default URL has no slash, so this doesn't affect it.Tests
a_login_stored_under_a_trailing_slash_url_is_found_without_it(workflow, failed before: whoami missed the login)both_spellings_of_a_registry_name_one_login,a_login_stored_under_a_trailing_slash_moves_to_the_registry_key,logging_out_also_clears_a_login_stored_under_a_trailing_slashscoped_account_matches_mcp_known_answer_vectorsnow expectshttps://lpm.dev/to map to the trimmed account, and pins the old slashed account.cache_status_uses_cli_registry_for_the_default_remote_cache_origin, which forced the revert in Fix dev and infra command bugs found in a performance and correctness review #1099, passes with the trim now in place.lpm-authpasses 3 runs in a row; the auth, cache, logout, setup and publish workflow suites pass.Docs: lpm-dev/rust-client-docs#455. MCP server: lpm-dev/mcp-server#3.
Council review follow-up
a_trailing_slash_login_is_not_merged_into_the_login_under_the_registry_key,a_trailing_slash_login_moves_its_tokens_and_session_metadata_together,a_trailing_slash_login_does_not_return_once_the_newer_login_is_rejected,a_trailing_slash_login_does_not_replace_a_revoked_credential.🤖 Generated with Claude Code