Repository navigation
[3/4] authentication: canonicalize enterprise credential storage - #338151
Merged
Merged
Conversation
This was referenced Sep 26, 2026
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-2-provider-lifecycle
branch
from
September 26, 2026 22:14
6ede8ba to
5dd8126
Compare
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-3-credential-storage
branch
from
September 26, 2026 22:14
68a940e to
0325d01
Compare
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-3-credential-storage
branch
from
September 27, 2026 05:55
0325d01 to
33e6ec6
Compare
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-2-provider-lifecycle
branch
from
September 27, 2026 05:55
5dd8126 to
30f2837
Compare
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-3-credential-storage
branch
from
September 27, 2026 17:27
33e6ec6 to
b691a97
Compare
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-2-provider-lifecycle
branch
from
September 27, 2026 17:27
30f2837 to
118cd44
Compare
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-3-credential-storage
branch
4 times, most recently
from
September 28, 2026 23:04
dbf2f8e to
e7260f8
Compare
Base automatically changed from
tyleonha/ghe-stack-2-provider-lifecycle
to
main
September 28, 2026 23:58
Use deterministic host and storage planning for the existing single enterprise URI. Retain original keychains and Microsoft account links across equivalent URI edits and restarts, reject storage collisions, and leave public GitHub usable when enterprise storage fails. Co-authored-by: Copilot <[email protected]>
TylerLeonhardt
force-pushed
the
tyleonha/ghe-stack-3-credential-storage
branch
from
September 29, 2026 00:10
e7260f8 to
44b817d
Compare
…them Use a canonical URI-derived credential key and migrate the matching legacy tokens and Microsoft account links before starting the host engine. Keep legacy data until destination writes succeed, preserve canonical sign-out state, and retry incomplete migration without a registry or completion marker. Co-authored-by: Copilot <[email protected]>
Read the canonical destination after inspecting legacy stores and recheck its token before copying. Cover concurrent canonical writes and assert exactly which credentials survive each failed migration write or cleanup. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Migration can reject authoritative canonical credentials, and URI normalization can mutate case-sensitive user-info.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Canonicalizes GitHub Enterprise credential storage and migrates legacy tokens/account links before engine creation.
Changes:
- Adds deterministic URI-derived storage keys and migration logic.
- Preserves public GitHub availability during enterprise failures.
- Adds migration, recovery, normalization, and failure-path tests.
| File | Description |
|---|---|
common/enterpriseConfiguration.ts |
Defines URI canonicalization. |
common/enterpriseStorage.ts |
Migrates legacy credentials. |
githubEnterprise.ts |
Migrates before engine creation. |
test/enterpriseStorage.test.ts |
Tests migration behavior. |
test/githubEnterprise.test.ts |
Tests provider lifecycle integration. |
test/extension.test.ts |
Tests activation and recovery. |
test/testMemento.ts |
Models key deletion correctly. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
Rely on URI serialization for hostname casing, retain explicit scheme and trailing-slash normalization, and fold the single-host configuration helper into enterpriseStorage. Extend coverage for uppercase schemes, default ports, root paths, repeated slashes and escaped deployment paths. Co-authored-by: Copilot <[email protected]>
Group temporary migration declarations and functions in a region scheduled for removal in 1.144, four releases after 1.140. Keep permanent URI and credential-key helpers outside the region. Co-authored-by: Copilot <[email protected]>
Select legacy token and account-link sources only when their canonical component is absent. Clean up aliases for authoritative canonical values without overwriting them, while retaining unresolved sources for missing data. Cover canonical sign-out, concurrent canonical writes, partial migration, cleanup retry, and case-sensitive URI user-info. Co-authored-by: Copilot <[email protected]>
TylerLeonhardt
marked this pull request as ready for review
September 29, 2026 17:45
TylerLeonhardt
enabled auto-merge (squash)
September 29, 2026 17:45
Vijay Upadya (vijayupadya)
approved these changes
Sep 29, 2026
This was referenced Oct 1, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.

Review stack
#338149 (merged) -> #338150 (merged) -> #338151 (canonical credential storage) -> #338080 (multi-host enablement)
This PR targets
main; #338080 remains stacked on this branch. The provider lifecycle and core registration buffering are already on main through #338150.Stack 3/4: Canonical credential storage
Derive enterprise credential keys from normalized instance URIs instead of maintaining a persistent canonical-to-storage registry.
github-enterprise.storageKeys, namespace claims, and the host/storage planning layer. No migration marker or replacement bookkeeping key is added.This remains a working single-host provider. It adds no plural setting, host picker, host-qualified identities, or workbench changes. Ambiguous legacy aliases require selecting the original URI rather than silently choosing a store.
Validation
Full-suite baseline:
f3150bec6a5.Tests use fake storage and isolated test profiles; no actual user credentials or settings were modified. The follow-on #338080 uses the same deterministic keys and handles ambiguous legacy HTTP/HTTPS ownership without a persistent registry.
URI helper consolidation
URI-consolidation checkpoint:
8bb82878fe5.Removed the tiny single-host
enterpriseConfiguration.tsmodule: its URI identity helper and legacy setting constant now live inenterpriseStorage.ts. Hostname lowercasing is left toUri.toString(); explicit scheme and trailing-slash normalization remain. Added coverage for uppercase schemes, explicit default ports, root paths, repeated trailing slashes, and escaped deployment paths.Fresh validation for this behavior-preserving follow-up: 51 targeted GitHub Enterprise tests passed, plus extension compilation, browser-target type checking, scoped lint, hygiene, and diff checks. The 128-test full-suite result above is the prior baseline.
Selected canonical-precedence feedback
Current head:
4ee145bdaef.Canonical tokens and Microsoft account links are authoritative independently. Alias selection is required only for a component still missing from the canonical destination; already-authoritative components can clean up their redundant aliases. Signed-out empty values remain authoritative. Unresolved ambiguity for missing data still fails before mutation.
Added explicit user-info casing coverage for the already-simplified URI helper. Seven migration regression cases were verified failing before the fix and passing afterward. 58 targeted GitHub Enterprise tests passed, with fresh extension compilation, browser-target type checks, scoped lint, hygiene, and diff checks. Earlier full-suite counts above are historical baselines. The migration-only region remains scheduled for removal in 1.144.