Skip to content

Connect the backend to the GitHub Rock Android client - #24

Merged
SayanthRock merged 14 commits into
mainfrom
integration/android-client-v1
Jul 23, 2026
Merged

Connect the backend to the GitHub Rock Android client#24
SayanthRock merged 14 commits into
mainfrom
integration/android-client-v1

Conversation

@SayanthRock

@SayanthRock SayanthRock commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

End-to-end Android contract

  • aligns backend OAuth scopes with the Android app, including user:follow
  • preserves access-token expiry and refresh-token metadata
  • adds POST /v1/auth/device/refresh
  • keeps OAuth client secrets server-only
  • returns explicit 503 errors when Device Flow or refresh is not configured
  • exposes oauthDeviceProxy and oauthRefreshProxy through /v1/config

Configuration

  • adds GITHUB_OAUTH_CLIENT_SECRET
  • requires the client secret for production deployments
  • updates .env.example, README, and API documentation

Continuous compatibility

Backend CI now validates both the Ktor server and the companion Android main branch in one workflow:

  • backend tests and fat JAR
  • Docker image
  • Android unit tests
  • Compose UI-test compilation
  • Android lint
  • debug APK
  • release APK
  • backend and Android artifacts

Coordinated client

Merged Android PR: Sayanthrock-Developer/GitHub-Rock#144

Validation required

  • Backend unit tests
  • fat-JAR build
  • Docker image build
  • complete Android compatibility pipeline
  • workflow artifacts

@ai-coding-guardrails ai-coding-guardrails Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work! 😎

I didn't find anything of concern

Risk: 🟢 Low

Risk analysis

The highest scores are for security_impact and blast_radius. Security_impact is elevated due to the introduction of a new OAuth client secret configuration (GITHUB_OAUTH_CLIENT_SECRET) that must be handled securely, and the exposure of new endpoints (/v1/auth/device/refresh) that interact with GitHub's OAuth system. Blast_radius is moderate because the changes affect core authentication flows used by the Android client across potentially many users, and introduce new API surface area. Reversibility and operational_risk are lower concerns since the changes appear to be additive, include proper configuration guards, and maintain backward compatibility.

Reviewed with 🤟 by Zenable

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The backend adds OAuth client-secret configuration, device-flow refresh support, capability flags, nullable refresh metadata, expanded API documentation, contract tests, and CI coverage for backend and Android integration workflows.

Changes

OAuth refresh flow

Layer / File(s) Summary
OAuth configuration and token contracts
.env.example, src/main/kotlin/.../config/AppConfig.kt, src/main/kotlin/.../model/ApiModels.kt
Adds server-side OAuth client-secret configuration and models refresh-token request and response metadata.
Device-flow service and route orchestration
src/main/kotlin/.../service/GitHubDeviceFlowService.kt, src/main/kotlin/.../routes/Routes.kt
Adds OAuth readiness checks, refresh-token handling, standardized token mapping, endpoint gating, and configuration feature flags.
OAuth contract validation and documentation
README.md, docs/API.md, src/test/kotlin/.../*
Documents refresh and webhook contracts, connection setup, secret handling, and validates scopes, configuration loading, token metadata, and polling states.
Backend and Android integration CI
.github/workflows/ci.yml
Extends verification with backend environment setup, Android tests, APK builds, linting, and artifact collection.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AndroidApp
  participant Routes
  participant GitHubDeviceFlowService
  participant GitHubOAuthAPI
  AndroidApp->>Routes: Submit device start, poll, or refresh request
  Routes->>GitHubDeviceFlowService: Check availability and process request
  GitHubDeviceFlowService->>GitHubOAuthAPI: Send device or refresh token grant
  GitHubOAuthAPI-->>GitHubDeviceFlowService: Return OAuth response
  GitHubDeviceFlowService-->>Routes: Map to DevicePollResponse
  Routes-->>AndroidApp: Return OAuth status or structured error
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly reflects the main change: connecting the backend to the GitHub Rock Android client.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch integration/android-client-v1

Comment @coderabbitai help to get the list of available commands.

@ai-coding-guardrails ai-coding-guardrails Bot added the zenable/risk:low Zenable assessed this PR as LOW risk. label Jul 23, 2026
@SayanthRock
SayanthRock marked this pull request as ready for review July 23, 2026 08:36
Copilot AI review requested due to automatic review settings July 23, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codeant-ai

codeant-ai Bot commented Jul 23, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 397cf00 Jul 23, 2026 · 08:36 08:40

Updated in place by CodeAnt AI · last 5 reviews

@ai-coding-guardrails ai-coding-guardrails Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work! 😎

I didn't find anything of concern

Risk: 🟢 Low

Risk analysis

The highest scores are for test_coverage and blast_radius. Test coverage is strong for the new OAuth flows but lacks regression tests for existing functionality. Blast radius is moderate due to new endpoints affecting Android client authentication. Security impact is low-moderate as client secrets remain server-side, but the expanded OAuth scopes introduce some risk.

Reviewed with 🤟 by Zenable

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jul 23, 2026
Comment thread src/main/kotlin/com/sayanthrock/githubrock/backend/routes/Routes.kt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

78-78: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

android-actions/setup-android@v3 is not the latest major version.

android-actions/setup-android has released v4.0.0 (Node 24 migration, updated cmdline-tools default). Not urgent, but worth bumping since this is a newly-introduced action in this file.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 78, Update the
android-actions/setup-android action reference from v3 to the latest major
version, v4, while leaving the surrounding CI workflow unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 67-72: Update both companion-repository checkout steps using
actions/checkout in the workflow to set persist-credentials to false in their
with configuration. Keep the existing repository, ref, and path values
unchanged, and do not alter unrelated checkout steps.
- Around line 82-100: Update the Android workflow steps for unit tests, Compose
UI test compilation, lint, debug APK, and release APK to use failure isolation
with continue-on-error enabled, matching the backend Gradle build pattern. Add a
single “Enforce Android result” gate after these steps that explicitly fails
when any Android step failed, while preserving diagnostic and artifact
collection before the gate.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Line 78: Update the android-actions/setup-android action reference from v3 to
the latest major version, v4, while leaving the surrounding CI workflow
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d366af4d-4b99-477e-868e-cb983e547632

📥 Commits

Reviewing files that changed from the base of the PR and between d6ae072 and fa7a2cf.

📒 Files selected for processing (10)
  • .env.example
  • .github/workflows/ci.yml
  • README.md
  • docs/API.md
  • src/main/kotlin/com/sayanthrock/githubrock/backend/config/AppConfig.kt
  • src/main/kotlin/com/sayanthrock/githubrock/backend/model/ApiModels.kt
  • src/main/kotlin/com/sayanthrock/githubrock/backend/routes/Routes.kt
  • src/main/kotlin/com/sayanthrock/githubrock/backend/service/GitHubDeviceFlowService.kt
  • src/test/kotlin/com/sayanthrock/githubrock/backend/AppConfigTest.kt
  • src/test/kotlin/com/sayanthrock/githubrock/backend/OAuthContractTest.kt

Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml
@SayanthRock
SayanthRock merged commit 8c6cfc7 into main Jul 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files zenable/risk:low Zenable assessed this PR as LOW risk.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants