refactor: tidy up the forge adapter interface#2874
Merged
Conversation
setchy
reviewed
May 10, 2026
setchy
reviewed
May 10, 2026
setchy
approved these changes
May 11, 2026
- Move GitHub-specific auth helpers (extractHostVersion, getGitHubAuthBaseUrl, getDeveloperSettingsURL, getNewTokenURL, getNewOAuthAppURL, isValidToken, isValidClientId) and the OAuth / device-flow helpers into forges/github. - Drop the answeredDiscussion capability from the shared ForgeCapabilities contract — only ever drove GitHub GraphQL query construction. Now a private supportsAnsweredDiscussion inside forges/github/capabilities.ts. isAnsweredDiscussionFeatureSupported removed from api/features.ts along with the Gitea stub. - Rename getDeveloperSettingsUrl -> getAccountSettingsUrl on the ForgeAdapter interface (and openDeveloperSettings -> openAccountSettings on the consumer). - Add device-flow / OAuth-app methods (startDeviceFlow, pollDeviceFlow, performWebOAuth, exchangeAuthCodeForToken, deviceFlowAuthMethod) to ForgeAdapter so App.tsx routes through the adapter instead of importing forges/github/flows directly. LoginWithDeviceFlow and LoginWithOAuthApp propagate the forge via route state. - Alias IFormData to LoginOAuthWebOptions to drop a redundant cast. - Bump per-test timeout to 15s and set isolate: false in vitest.config to stop CI flakes under parallel load. Closes #2873
b6780cb to
d8f3147
Compare
|
This was referenced May 12, 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 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.



Summary
Three follow-up cleanups on top of the forge adapter interface, each as its own commit:
extractHostVersion,getGitHubAuthBaseUrl,getDeveloperSettingsURL,getNewTokenURL,getNewOAuthAppURL,isValidToken,isValidClientId) out of sharedauth/utils.tsand into a newforges/github/auth.ts. Tests followed.answeredDiscussioncapability from the sharedForgeCapabilitiescontract. It only ever drove GitHub GraphQL query construction, so it now lives privately assupportsAnsweredDiscussioninsideforges/github/capabilities.ts.isAnsweredDiscussionFeatureSupportedremoved fromapi/features.tsalong with the Gitea stub.getDeveloperSettingsUrl→getAccountSettingsUrlon theForgeAdapterinterface (andopenDeveloperSettings→openAccountSettingson the consumer). The "developer settings" wording was GitHub-flavoured; the new name reads cleanly for any forge.Test plan
pnpm exec tsc --noEmit— cleanpnpm exec biome checkon touched files — only pre-existing warningspnpm exec vitest --run— 1040/1040 passCloses #2873