Skip to content

Extract the shared git auth capability - #84

Merged
AhmadKharfan merged 1 commit into
developfrom
feat/git-auth-capability
Jul 30, 2026
Merged

Extract the shared git auth capability#84
AhmadKharfan merged 1 commit into
developfrom
feat/git-auth-capability

Conversation

@AhmadKharfan

Copy link
Copy Markdown
Owner

Why

The last feature-to-feature dependency: :feature:settings imported :feature:git's internal auth plumbing — GitAuthController, GitHubAuthDialog, GitAuthPromptState, GitAuthPromptActions and GitAuthMode.

The obvious fix would have been to export those from :feature:git:api, and it would have been wrong. Settings is not asking git to perform an operation. Both features reuse the same auth capability: git needs it when a push hits a 401, settings needs it so you can connect an account up front. Exporting one feature's internals to the other would have blessed the accidental coupling, and it would have dragged :designsystem into a contract module that is otherwise restricted to :domain.

What changed

New :core:gitauth, owning the capability both features share:

  • GitAuthController — the auth state machine
  • GitAuthPromptState, GitAuthPromptActions, GitAuthMode, GitHubDeviceCodeUi
  • GitHubAuthDialog
  • The 20 git_auth_* string resources, which had to move with the dialog
  • The GitAuthController characterization tests

:feature:settings now depends on :core:gitauth and no longer on :feature:git at all. :feature:git depends on it too, as one consumer among two rather than the owner.

It is a :core: module rather than a contract module because it carries UI. That is the honest distinction: :feature:*:api modules hold contracts and may only see :domain; a capability module is shared implementation and may use the design system.

The module boundary baseline is now empty. Every feature-to-feature dependency introduced before this migration has been removed, and the check runs with zero tolerated exceptions.

Behavior

No behavior change. Code moved between modules; no logic altered.

Scope

GitHubAuthDialog's existing LongMethod and CyclomaticComplexMethod findings moved with it as baseline entries rather than being regenerated. They were already baselined in :feature:git; splitting the dialog is separate work.

Tests

  • 714 tests passing, 0 failures.
  • The 18 GitAuthController characterization tests moved with the controller and pass unchanged. They were written for exactly this refactor — they pin the device-flow ordering, the 1100 ms deferred close, cancellation, and the re-entrancy quirk, so this move is provably behaviour-preserving rather than merely compiling.

Verification

./gradlew test detekt verifyModuleBoundaries :app:assembleDebug — BUILD SUCCESSFUL. Boundary report: 136 dependencies checked, 0 baseline entries, 0 violations.

Verified on an emulator, with attention to the resource move, since android.nonTransitiveRClass=true means a string left behind would fail at runtime rather than at build time:

  • Settings → Git & GitHub renders the account card and the Git author form
  • "Sign in with GitHub" opens the dialog, and every relocated string resolves: the "Sign in to github.com" title with its host argument, the GitHub-account and access-token mode chips, the device hint, and action_cancel from :core:common
  • No Resources$NotFoundException, AbstractMethodError or NoClassDefFoundError in logcat

@AhmadKharfan
AhmadKharfan merged commit b668d3c into develop Jul 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant