Skip to content

feat: support android in SDK generation and validation - #85

Open
ajay-k wants to merge 2 commits into
mainfrom
android-sdk-enablement
Open

feat: support android in SDK generation and validation#85
ajay-k wants to merge 2 commits into
mainfrom
android-sdk-enablement

Conversation

@ajay-k

@ajay-k ajay-k commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Prepares this repo to generate and validate the new android SDK
(workos/workos-android, emitter in oagen-emitters#206). Three files,
+31/-6. Inert for the eight existing languages — see the test plan.

scripts/sdk-generate.sh — two fixes, both required for --lang android
to work at all:

  1. android added to the cased-namespace branch. The namespace becomes the
    Kotlin client type prefix, so defaulting to workos generated
    WorkosClient.* accessors that do not match the hand-maintained
    WorkOSClient — the SDK did not compile.
  2. ${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"} instead of a bare
    "${EXTRA_ARGS[@]}". Under set -u, bash 3.2 — still what macOS ships as
    /bin/bash — treats expanding an empty array as an unbound variable. Only
    the node branch populates that array, so every other language failed
    locally on macOS
    while Linux CI's bash 5 masked it. Pre-existing and
    unrelated to android, but it blocks the android path, so it is fixed here.

.github/actions/setup-sdk-runtime/action.yml — an android case plus JDK
and Gradle. It cannot reuse the kotlin branch: that greps
JavaVersion.VERSION_, which workos-android's build.gradle.kts never
mentions — it sets the JVM target with jvmToolchain(17) — so the kotlin
pattern yields an empty java-version. android needs no Android SDK: the
library targets the JVM (kotlin("jvm")), so it builds on ubuntu-latest with
the same JDK + Gradle pair kotlin uses.

.github/workflows/validate-sdks.yml — skips the three compatibility steps
for android. No extractor is registered, so sdk:compat-extract --lang android
exits 1 and would fail the whole matrix; and android is unreleased, so there is
no published surface for a baseline to protect.

Deliberately not included

The .github/sdk-matrix.json entry. That is the activation switch, and it must
not merge until workos/workos-android is public — the SDK checkout step uses a
plain actions/checkout that cannot read a private repo, and one failing matrix
column fails the whole sdk-validation check via
if [[ "${{ needs.sdk_build.result }}" != "success" ]]. Once the repo is
public, activation is one line:

{ "language": "android", "sdk_repo": "workos/workos-android" }

No runner key — ubuntu-latest is correct.

Test plan

Inertness for existing languages, traced from the real script:

--lang namespace before after
python workos workos
ios WorkOS WorkOS
kotlin workos workos
android workos (broken) WorkOS

Adding a term to an OR chain can only change the android outcome; the
case addition cannot reach other branches; and matrix.language != 'android'
is always true for the other eight, so those steps run unchanged. Argv is
identical where the old array expansion worked — verified including a path
containing a space — and works where it previously errored.

Correctness of the android additions:

  • jvmToolchain\(\K\d+ against workos-android/build.gradle.kts17,
    matched once. Negative control: kotlin's JavaVersion.VERSION_ pattern finds
    nothing there.
  • Both YAML files parse. Enumerated the parsed steps to confirm exactly
    Extract baseline snapshot, Extract candidate snapshot and Compat diff
    carry the guard — and that Compat summary correctly does not, since it
    already guards on steps.compat-diff.outcome != 'skipped'.
  • Skipping compat is safe downstream: buildLanguageData has an explicit
    compat-report.json missing branch, build-sdk-diff-report.mjs needs only
    sdk-code.diff, and both jq aggregations skip absent files via nullglob
    or an empty-changes fallback.
  • sdk:compat-extract --lang android confirmed to exit 1
    (No extractor registered for language: android) — measured, not assumed.

End to end: npm run sdk:generate -- --lang android exits 0, two
consecutive runs are byte-identical (800 files), all 30 @oagen-ignore-file
files survive, and the SDK's script/ci passes with 590 tests.

Not verified: I cannot run GitHub Actions locally, so no green
sdk_build (android) job has been observed. The first CI run after the matrix
entry lands is the test of record.

🤖 Generated with Claude Code

ajay-k added 2 commits July 30, 2026 21:15
`android` was missing from the cased-namespace branch, so
`sdk-generate.sh --lang android` defaulted to `workos` and generated
`WorkosClient` accessors that do not match the hand-maintained
`WorkOSClient` — the SDK does not compile.

Separately, `"${EXTRA_ARGS[@]}"` is an unbound-variable error under `set -u`
in bash 3.2, which macOS still ships as /bin/bash. Only the node branch
appends to that array, so the script failed locally for every other
language while Linux CI's bash 5 was unaffected.
Two additions so that adding android to sdk-matrix.json later is a one-line
change rather than a broken build. Both are inert until that entry exists,
because no current matrix entry has language == 'android'.

setup-sdk-runtime gains an android case. It cannot reuse the kotlin branch:
that greps JavaVersion.VERSION_, which workos-android's build.gradle.kts never
mentions -- it sets the JVM target with jvmToolchain(17) -- so the kotlin
pattern yields an empty java-version. The Java and Gradle steps are widened to
android, which needs no Android SDK because the library targets the JVM
(kotlin("jvm")) and so builds on ubuntu with the same JDK + Gradle pair kotlin
uses.

validate-sdks skips the three compatibility steps for android. No extractor is
registered for it, so sdk:compat-extract exits 1 and would fail the whole
matrix; and android is unreleased, so there is no published surface for a
baseline to protect. Downstream aggregation already tolerates the absence: the
PR-comment script has an explicit "compat-report.json missing" branch,
build-sdk-diff-report needs only sdk-code.diff, and both jq passes skip absent
files. Compat summary is already guarded on the diff step's outcome being
'skipped'. Remove the conditions once an android extractor exists.
@greptile-apps

greptile-apps Bot commented Jul 31, 2026

Copy link
Copy Markdown

Greptile Summary

Prepares Android SDK generation and validation without activating it in the SDK matrix.

  • Defaults Android generation to the WorkOS namespace and preserves empty-array compatibility with Bash 3.2.
  • Detects Android’s JVM toolchain and configures Java and Gradle.
  • Skips compatibility extraction and diffing for the unreleased Android SDK while downstream reporting tolerates absent compatibility artifacts.

Confidence Score: 5/5

The PR appears safe to merge, with Android remaining inactive until a future SDK matrix entry is added.

The Android-specific branches are isolated from existing matrix languages, and the validation workflow’s downstream consumers already handle skipped compatibility steps and absent compatibility reports.

Important Files Changed

Filename Overview
scripts/sdk-generate.sh Adds the Android namespace default and safely forwards an optional argument array across supported Bash versions.
.github/actions/setup-sdk-runtime/action.yml Adds Android JVM-version detection and reuses the existing Java and Gradle setup path.
.github/workflows/validate-sdks.yml Skips unsupported Android compatibility operations while preserving generation, SDK testing, diagnostics, and final result aggregation.

Reviews (1): Last reviewed commit: "ci: prepare the SDK matrix jobs for andr..." | Re-trigger Greptile

@ajay-k
ajay-k requested a review from gjtorikian July 31, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant