Skip to content

refactor: tidy up the forge adapter interface#2874

Merged
afonsojramos merged 1 commit into
mainfrom
refactor-forge-adapter-interface
May 11, 2026
Merged

refactor: tidy up the forge adapter interface#2874
afonsojramos merged 1 commit into
mainfrom
refactor-forge-adapter-interface

Conversation

@afonsojramos
Copy link
Copy Markdown
Member

Summary

Three follow-up cleanups on top of the forge adapter interface, each as its own commit:

  • Move GitHub-specific auth helpers (extractHostVersion, getGitHubAuthBaseUrl, getDeveloperSettingsURL, getNewTokenURL, getNewOAuthAppURL, isValidToken, isValidClientId) out of shared auth/utils.ts and into a new forges/github/auth.ts. Tests followed.
  • Drop the answeredDiscussion capability from the shared ForgeCapabilities contract. It only ever drove GitHub GraphQL query construction, so it now lives privately as supportsAnsweredDiscussion inside forges/github/capabilities.ts. isAnsweredDiscussionFeatureSupported removed from api/features.ts along with the Gitea stub.
  • Rename getDeveloperSettingsUrlgetAccountSettingsUrl on the ForgeAdapter interface (and openDeveloperSettingsopenAccountSettings on the consumer). The "developer settings" wording was GitHub-flavoured; the new name reads cleanly for any forge.

Test plan

  • pnpm exec tsc --noEmit — clean
  • pnpm exec biome check on touched files — only pre-existing warnings
  • pnpm exec vitest --run — 1040/1040 pass

Closes #2873

@github-actions github-actions Bot added the refactor Refactoring of existing feature label May 10, 2026
Comment thread src/renderer/utils/auth/flows.ts Outdated
Comment thread src/renderer/context/App.tsx Outdated
Copy link
Copy Markdown
Member

@setchy setchy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one minor sonar issue reported, otherwise looks good to me

im sure we'll come across more tidy-up opportunities in the near future.

- 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
@afonsojramos afonsojramos force-pushed the refactor-forge-adapter-interface branch from b6780cb to d8f3147 Compare May 11, 2026 18:34
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Refactoring of existing feature

Development

Successfully merging this pull request may close these issues.

refactor: forge adapter tidy up

2 participants